Skip to content

fix(acp): keep mode state synchronized - #2829

Open
xinyuan0801 wants to merge 2 commits into
MoonshotAI:mainfrom
xinyuan0801:codex/fix-acp-mode-state
Open

fix(acp): keep mode state synchronized#2829
xinyuan0801 wants to merge 2 commits into
MoonshotAI:mainfrom
xinyuan0801:codex/fix-acp-mode-state

Conversation

@xinyuan0801

@xinyuan0801 xinyuan0801 commented Aug 11, 2026

Copy link
Copy Markdown

Related Issue

Resolve #2828

Problem

ACP initialized both mode projections to default regardless of the engine's active permission or plan state. The cached projection also became stale when permission or plan mode changed at runtime, so an IDE could display a mode that did not match the behavior actually enforced by the engine.

What changed

  • Expose the current permission mode and its change event through the Klient agent facade.
  • Derive ACP mode state from the engine's permission and plan state when a session is created or restored, with plan mode taking precedence.
  • Keep both ACP projections synchronized at runtime by coalescing permission and plan invalidations into an authoritative refresh, discarding stale snapshots and suppressing intermediate states during session/set_mode.
  • Push current_mode_update and config_option_update from the same reconciled snapshot and stop in-flight refreshes from publishing after session disposal.
  • Cover configured and persisted modes, runtime permission changes, plan entry and exit, atomic plan-to-permission transitions, event routing, and both memory and IPC transports.
  • Add a patch changeset for the corrected ACP behavior. No documentation update is needed because the existing mode configuration and protocol surface are unchanged.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 427658b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@xinyuan0801
xinyuan0801 marked this pull request as ready for review August 11, 2026 23:44

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aababa4ed5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/acp-server/src/session.ts Outdated
@xinyuan0801 xinyuan0801 changed the title fix(acp): report active permission mode fix(acp): keep mode state synchronized Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ACP reports default mode while the engine uses auto or yolo permissions

1 participant