Repository navigation
fix(acp): synchronize plan mode and handle missing plan files - #5404
Merged
Merged
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
7723qqq
pushed a commit
to 7723qqq/kimi-code
that referenced
this pull request
Nov 25, 2026
MoonshotAI#5359 and MoonshotAI#5404 need the fork's loop/ACP shapes (LiveTurn state machine, session extensions), MoonshotAI#5434 depends on testkit signal imports, and MoonshotAI#5332 needs a merged SessionAction table. Each is in_progress with the precise remaining work rather than a forced apply.
7723qqq
pushed a commit
to 7723qqq/kimi-code
that referenced
this pull request
Nov 25, 2026
…AI#5404) Port the ACP half: permission modes are lowercased onto AcpModeId, the server resolves a live session's plan/permission state into modes, session initialization and set_mode publish current_mode_update, and readTextFile maps ACP -32002 (missing file) to OS_FS_NOT_FOUND so plan-file reads can fall back. Verified: acp-server config + acp-fs 33 pass, typecheck clean. The e2e plan-mode test stays on the row; the fork's e2e-turn still uses scriptedProvider.
7723qqq
pushed a commit
to 7723qqq/kimi-code
that referenced
this pull request
Nov 26, 2026
Record the attempted testkit fake-model migration for MoonshotAI#5404/MoonshotAI#5385: the plan-review cases pass, but ToolUpdated field propagation, /usage context size, /compact scripting and the two terminal reverse-RPC cases need a dedicated test-engine update, so the suite stays on scriptedProvider.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Screenshots / Recordings
下面是同一组
session/new请求的实际响应摘录。配置开启了default_plan_mode,编辑器声明了文本文件读取能力。模式选择器的响应
修复前
{ "currentModeId": "default", "configMode": "default", "editorFileReads": 0 }修复后
{ "currentModeId": "plan", "configMode": "plan", "editorFileReads": 0 }Requirement or Bug
编辑器声明文件能力时,首次进入 Plan 模式会遇到尚不存在的计划文件,回合因此失败。新建或恢复会话时的模式选择器也可能显示错误状态,批准计划或选择「拒绝并退出」后容易停留在 Plan。
Bug Reproduction Steps
fs.readTextFile和fs.writeTextFile,进入 Plan 模式并发送提示。让客户端针对不存在的计划文件返回 ACP-32002。基线回合无法继续到计划审阅。default_plan_mode = true并创建会话。modes.currentModeId和configOptions都返回default。Root Cause
ACP 文件适配没有把读文件时的
-32002归为引擎能够处理的缺文件。模式选择器由 ACP 缓存,而批准或拒绝计划会直接修改引擎的 Plan 状态。Code Changes
flowchart LR E[编辑器] -->|计划文件尚不存在| F[ACP 文件适配] F -->|文件不存在| P[引擎创建和审阅计划] P -->|模式状态变更| M[ACP 读取实际 Plan 和权限状态] M -->|模式与配置通知| EACP 将编辑器的缺文件错误转换为已有的 host 文件错误。初始模式与后续通知都读取 live main agent 的 Plan 标志和实际权限,建立会话时即可拿到状态。显式切换完成后发布最终模式,批准和拒绝退出则由引擎事件触发通知。
Behavior Changes and Affected Users
-32002中断回合defaultVerification
pnpm lint、ACP 类型检查、CLI 构建与 smoke、双语文档构建、98 项仓库检查测试均通过。平台验证使用 macOS。Checklist