Repository navigation
fix(agent-core-v2): answer questions without edits and clean up test leftovers - #4450
Conversation
…leftovers Let the request type decide the deliverable in Delivering work: change requests (including "can you add..." questions) get the change, while questions, explanations, and discussions get an answer that leaves the project untouched. Diagnosis requests find the cause before naming it, separate confirmed facts from hypotheses, and apply a fix only when asked. Before replying after running tests or builds, check for new files and delete the logs and test output those commands created when the task does not need them, without touching files the agent did not create.
|
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Codex Review SummaryThis 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. |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cab20c1bb6
ℹ️ 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".
| # Delivering work | ||
|
|
||
| Do what was asked. Goals the user states explicitly count as part of the ask. | ||
| Do what was asked. Goals the user states explicitly count as part of the ask, and the kind of request sets the deliverable. A request for action, including one phrased as a question such as "can you add…", gets the work done, carried through. A question or an explanation gets an answer backed by what you found, and a discussion of how to approach something gets your recommendation and its main tradeoff first; either way, leave the project as you found it unless the user also asks for a change. When asked why something fails, find the cause before you name it. A familiar error can have a different cause. Say what you confirmed and what is still a hypothesis, and fix it only if the user asked for a fix. |
There was a problem hiding this comment.
Add a CLI changeset for the changed default behavior
For TUI and print-mode users who phrase a repair request as “help me look at this,” this changes the default from potentially applying a fix to diagnosis-only; it also changes whether generated test logs remain available afterward. The commit explicitly acknowledges these user-visible changes but excludes a changeset because they are system-prompt details. Root AGENTS.md requires a changeset naming lost behavior, and the changeset skill explicitly includes internal-package changes that affect CLI behavior. Add a changeset for @moonshot-ai/kimi-code describing the changed defaults and how users can explicitly request repairs or retain output files, so upgrading users can discover the change.
AGENTS.md reference: AGENTS.md:L117-L117
Useful? React with 👍 / 👎.
…verable # Conflicts: # packages/agent-core-v2/test/app/agentProfileCatalog/profile-shared.test.ts
MoonshotAI#4410 MoonshotAI#4413 MoonshotAI#4431 MoonshotAI#4450 MoonshotAI#4451 MoonshotAI#4485 MoonshotAI#4524 were each implemented earlier — the compaction prefix suite, the media-recovery case, the OAuth callback socket drain, the split delivering-work section, the compaction wording, the reasoning-key order and the 10-step todo reminder are all in the tree and pinned by their own tests. Each row now carries that probe. Only MoonshotAI#4410 needed care: upstream patched paths that this fork renamed (`human/llm/builtin/protocol` versus `human/llm/requester/bases`), so the matching was done on the behaviour — stripDynamicToolContext is gone and extractEventUsage already reads usage only on terminal response events. Ledger: closed 22 -> 28, remaining 71.
Requirement or Bug
提问、讨论和诊断类请求不改文件;跑测试或构建留下的日志,在回复前清理掉。
Bug Reproduction Steps
在两个小型 Node 项目里用
kimi -p复现。基线是当前 main 的系统提示,所有运行使用同一个 Kimi 模型。tests/run.js每次运行都会写tests/recparse.log和tests/recparse.trs。提问「现在的测试用例覆盖了只有空格的行吗?当前测试实际跑出来是什么结果?」。agent 跑了npm test并正确作答,但结束后git status仍显示这两个未跟踪文件(3/3)。notify.yaml里的不一致,npm run send返回401 missing_token。提问「npm run send报401 missing_token,帮我看一下。」。agent 直接改了加载代码(3/3)。Root Cause
system.md的Delivering work开头只有一句 "Do what was asked",没有区分提问、诊断和行动请求,要不要改文件全由模型自行判断。验证段要求跑标准构建和测试,但没有任何指令处理这些命令在项目里留下的文件,模型也不会主动去看。本 PR 在提示词层补上这两条约束,针对的是根因,不是绕过。但它们是软约束:模型仍可能偶尔不照做(评测里清理仍有少量遗漏),引擎层没有对应的保证机制。
Code Changes
只改了
packages/agent-core-v2/src/app/agentProfileCatalog/system.md的Delivering work节两处,原有句子一字未删,新内容都是在原句后追加:新增句的含义与依据:
codex-rs/models-manager/models.json):"Adapt accordingly based on the user's request type"NotifyUser工具说明中已有的同类要求一致git statusin a repository)没有采用 Codex 诊断规则的后半句 "or the request otherwise clearly includes implementation"。加上它之后,「帮我看一下」5 次里有 2 次直接改了代码,两次的推理都引用了这半句作为动手的理由。不加它,「…我今天要用它发通知,帮我处理一下」这类明显要处理的请求仍然 3/3 修好,因为这类请求本身就是行动请求。
第一句用 "action" 而不是 "change":换成 "A request for a change" 的对照版本,「帮我看一下」6 次里有 2 次改了代码,推理引用了这句;"action" 版本 10 次里 0 次。样本小,但没有证据说明 "action" 更容易让模型动手。
packages/agent-core-v2/test/app/agentProfileCatalog/profile-shared.test.ts:plan 指引位置的断言原来锚定旧句尾count as part of the ask.,改为锚定新句尾,断言意图不变。不附 changeset:这次只调整默认系统提示的行为细节,不作为面向用户的变更记录。
Behavior Changes and Affected Users
git status,以及可能的删除操作受影响人群:所有使用内置系统提示模板的 agent,包括默认主 agent、
coder、explore、plan子 agent 和 Tower worker;覆盖 TUI、print 模式(kimi -p)、desktop 与 web、ACP、SDK 等入口。不受影响的有两类:用SYSTEM.md或 agent 文件整体替换系统提示、且没有使用${base_prompt}的用户;恢复的旧会话,它们沿用当时记录的系统提示,只有新会话才生效。需要维护者拍板:「帮我看一下」这类请求不再默认修复。没有配置开关,退路是明确要求修复。请确认接受这一行为变化。
测试覆盖
kimi2.3.2 二进制和同一个 Kimi 模型,都在kimi -p(auto 模式)下运行,只有系统提示不同:通过--agent-file加载,每次运行都从会话日志核对实际发出的提示。场景都是自建的小型 Node 项目。debug.log:该文件被保留 / 其余文件已清理npm test通过另有一个只比最终文本多出上述 Codex 诊断后半句的版本(未采用),在更多场景上跑了 48 次,可作参考:提问、讨论、解释 12/12 未改文件;测试结果提问 8/10 干净;带
debug.log的 5/5 保留、5/5 其余已清理;「你能跑一下测试吗?」3/3 跑了、3/3 干净;修改类(分页、日志级别、按项目配置目录新增布局文件、问句式分页)5/5 通过;诊断 8/8 找对原因且未改文件;「帮我看一下」3/5 未改文件。清理没做到的几次,都是跑完测试后没有执行
git status检查,不是因为"分不清就保留"而留下文件;用户原有文件在所有带新清理文本的运行里都被保留(8/8)。成本:跑测试的提问每次多约 2 次请求(
git status与删除),输入 token 多 70%–95%,但几乎全是缓存命中,未命中的部分每次只多约 1k;诊断题、讨论题与基线相差在 1 次请求以内,修改类没有变多;「帮我看一下」因为不再动手修改,平均少约 2 次请求。每组 1–10 次,含噪声。未覆盖:其他模型、交互式 TUI(非 auto 模式)、子 agent 与 Tower 的行为、非 git 项目、Windows。
Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.没有关联 issue。行为变化表已完整列出,但按上面的说明没有写 changeset;「帮我看一下」不再默认修复这一项的退路是明确要求修复,请维护者在本 PR 中确认。仓库内只更新了结构断言,行为效果由上面的 A/B 验证,没有加入仓库测试。用户文档没有描述默认提示词在提问和修复上的行为,所以不需要更新文档。