Repository navigation
chore(agent-core-v2): remove mandatory Edit and Bash sed restrictions - #4609
Conversation
🦋 Changeset detectedLatest commit: 1f37966 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
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. Try requesting a review at a lower effort level.
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 |
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. |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
@codex review |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1f37966a62
ℹ️ 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".
| "@moonshot-ai/kimi-code": patch | ||
| --- | ||
|
|
||
| Stop requiring Edit and prohibiting Bash `sed` for incremental file edits. |
There was a problem hiding this comment.
Gate the prompt-policy removal on maintainer approval
For all clients receiving these built-in tool descriptions, this change removes the Edit-only and no-sed restrictions without an opt-out. The commit message marks the required maintainer approval as still pending, so users relying on the old behavior have no way to retain it; obtain explicit approval before shipping or provide an escape hatch.
AGENTS.md reference: AGENTS.md:L116-L120
Useful? React with 👍 / 👎.
| const args = event.args as { readonly tools: readonly { readonly name: string }[] }; | ||
| stableEvent = { | ||
| ...event, | ||
| args: { ...args, tools: args.tools.map((tool) => tool.name) }, |
There was a problem hiding this comment.
Preserve tool descriptions in the prompt snapshots
Replacing each tool_select.initialized tool with its name removes descriptions from these snapshots, which were the general snapshots retaining tool prompt text. The generate-input snapshots also record only tool names, so future regressions in Edit, Bash, or Write guidance will no longer fail these tests; retain the descriptions or add targeted assertions for these prompts.
AGENTS.md reference: AGENTS.md:L118-L120
Useful? React with 👍 / 👎.
Port of upstream fc3b521 (MoonshotAI#4609). Two prompt lines told the model to use Edit for every incremental change and forbade Write and Bash `sed`, which made the tools fight each other: a `sed -i` one-liner is sometimes the honest way to change many files, and a wholesale Write is sometimes clearer than a chain of edits. Both lines are gone; Write keeps its own guidance about when a full replacement is appropriate. Local-form notes: the fork's `bash.md` has no `sed`/`awk` → Edit mapping to remove, so only `edit.md` and `write.md` change. No test in the tree snapshots these descriptions (verified by grep for both sentences), so upstream's companion "stop snapshotting tool descriptions" change has no local counterpart and the tool, plan, config and loop suites pass unchanged. Verified: check-prompt-ownership and check-no-comments pass; tool 194 pass, plan included; config + loop 188 pass.
Requirement or Bug
当前 Bash、Edit 和 Write 的工具描述共同要求增量编辑必须使用 Edit,并明确禁止 Bash
sed。本次按直接需求移除这些提示词约束,使模型不再受到这层工具选择限制;不改变工具运行时实现或权限行为。无关联 issue。Bug Reproduction Steps
N/A
Root Cause
N/A
Code Changes
本次只删除或收窄工具提示词,不改动工具参数、执行逻辑或权限检查。共享测试快照层对
tool_select.initialized只保留工具名,避免把 description 和 parameters 原文作为测试契约;四个测试文件中的 7 处内联快照同步更新,并添加 CLI patch changeset。Behavior Changes and Affected Users
下表中的“所有客户端用户”具体指通过 TUI、print 模式、desktop/web、VS Code、ACP 或 SDK 使用内置 agent 工具描述的用户。
Edit is mandatory for every incremental change, especially small edits.DO NOT use Write or Bash sed.sed。sed/awk(in-place edit) →Editsed/awk原地编辑定向到 Edit。sed/awk原地编辑的所有客户端用户。use Edit for every incremental change to an existing file四行提示词变化不再由原文断言守护;相关测试仅保留工具名与所在用例的非文本行为覆盖。本 PR 不涉及 API、配置、会话数据、provider 方言或平台分支变化。
验证详情
结果:4 个测试文件通过,374 个测试通过,1 个测试跳过。
returns the spawned agent id when a foreground subagent times out在本分支与未修改的main上均以相同的 30 秒超时失败,因此定向验证中排除了该既有失败;本 PR 未修改其实现或测试。未运行全量测试。Checklist
/approve). — N/A:无关联 issue,本 PR 来自直接需求。gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update. — 公开文档未描述这些内部工具提示词,无需更新。