fix(tools): route low-risk external writes through approval ask#387
fix(tools): route low-risk external writes through approval ask#387phantom5099 merged 8 commits into1024XEngineer:mainfrom
Conversation
| droppedCount := len(history) | ||
| droppedRunes := estimateSubAgentMessagesRunes(history) | ||
|
|
||
| for idx := len(history) - 1; idx >= 0; idx-- { |
There was a problem hiding this comment.
trimSubAgentMessageWindow trims by raw recency/size only, without preserving assistant tool-call ↔ tool-result pairing. This can leave orphaned tool messages (or drop the corresponding assistant tool_calls) after truncation, which can make the next provider request invalid for OpenAI-compatible message sequencing. Consider trimming in conversation atoms (assistant+its tool results) instead of individual messages.
| - Only call tools that are actually exposed in the current tool schema. Do not invent tool names. | ||
| - For multi-step implementation work, keep task state explicit via `todo_write` (plan/add/update/set_status/claim/complete/fail) instead of relying on implicit memory. | ||
| - Execute Todos sequentially in the main loop unless the user explicitly asks for another strategy. | ||
| - `spawn_subagent` supports two modes: |
There was a problem hiding this comment.
The prompt now instructs usage of spawn_subagent, but the runtime bootstrap tool registry still does not register this tool. That creates a docs/behavior mismatch: the model is told to use a tool that is not actually exposed in the schema. Please either register spawn_subagent in bootstrap or remove these instructions until exposure is wired.
|
|
||
| // isLowRiskExternalWritePath 判断工作区外写入目标是否属于可审批放行的低风险路径。 | ||
| func isLowRiskExternalWritePath(targetPath string) bool { | ||
| cleaned := strings.TrimSpace(filepath.Clean(targetPath)) |
There was a problem hiding this comment.
isLowRiskExternalWritePath currently treats almost any non-system, non-executable-extension path as "low risk". That still includes shell/profile startup files (for example ~/.bashrc, ~/.zshrc, PowerShell profiles), which can become code-execution persistence points once written. Since this path is now eligible for approval/remembered allow, this widens the trust boundary more than intended. Recommend explicitly classifying startup/profile/autoload script paths as high-risk and keeping them hard-denied in this flow.
|
@xgopilot 审查这个Pr,给我一版能够用于ai审查的提示词 |
审查结论发现 1 个高严重度问题,需要先修复后再合并。 Findings
问题说明:
复现证据:
建议修复方向:
可用于 AI 审查的提示词完成情况已完成:规则读取、diff 审查、关键测试验证、问题定位、审查提示词整理。 |
|
@xgopilot 你是一名严格的 Go 安全代码审查助手。请审查当前分支相对 origin/main 的变更,重点检查“将 workspace 外写入从 deny 调整为 ask”这条链路是否引入绕过。 审查目标:
必须执行:
输出格式(只输出问题,不要表扬):
|
High1)
2) 对 symlink 逃逸的风险分级错误(被误判为 low-risk 可 ask)
Medium3) “外写低风险”判定基于未解引用路径,无法识别最终落点是否系统保护目录
Low4) 测试回归:当前分支未通过你要求的工具测试,且已暴露 symlink 场景行为倒退
剩余风险与测试盲区
|
|
@xgopilot 修复你所提到的review #387 (comment) |
High
Low
|
|
@xgopilot 修复你所提到comment中的风险问题 #387 (comment) |
审查结论仍存在阻塞级安全问题,当前修复未覆盖我在 High
Low
执行说明已完成:阅读历史评论、对比 |
|
/code 修复review的问题 |
|
已按你在 review/comment 中提到的风险点完成修复,并已推送到当前 PR 分支 修复内容
已执行验证
未执行项
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: Cai-Tang-www <106404101+Cai-Tang-www@users.noreply.github.com>
ea0bd17 to
c9d2152
Compare
|
@xgopilot 提升测试率到100 |
|
已完成本次“提升测试率到100”的处理并推送到当前 PR 分支 结果
验证
未完成
补充:按 fork 推送流程,已同步创建/更新 fork PR: |
Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: Cai-Tang-www <106404101+Cai-Tang-www@users.noreply.github.com>
|
@xgopilot 批判性review |
High
实际风险:
最小修复建议:
Low
实际风险:
最小修复建议:
已执行验证: |
|
/simplify |
处理结果已按本次触发指令完成:读取历史评论并处理值得修复的未解决项,然后执行简化复核并推送。 已完成
提交与推送
未完成项
|
|
/simplify #387 (comment) |
处理结果已按你给的 comment( 本次变更
提交与推送
验证
未完成项
|
Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: Cai-Tang-www <106404101+Cai-Tang-www@users.noreply.github.com>
|
/simplify #387 (comment) |
处理结果已按你指定的 comment( 本次修复
代码位置
验证
提交与推送
|
Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: Cai-Tang-www <106404101+Cai-Tang-www@users.noreply.github.com>
|
/simplify #387 (comment) |
处理结果已按你指定的 comment( 本次修复
变更文件
验证
提交与推送
未完成项
|
Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: Cai-Tang-www <106404101+Cai-Tang-www@users.noreply.github.com>
|
/code 你提到我仓库的Pr冲突了,自己修一下然后重新推送Cai-Tang-www#35 |
处理结果已按你的要求修复冲突并重新推送到你指定分支。 已完成
当前状态
|
Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: Cai-Tang-www <106404101+Cai-Tang-www@users.noreply.github.com>
fix(tools): allow remembered low-risk external write retry

Summary
filesystem_write_fileworkspace-boundary rejections to permissionaskinstead of hard failureworkdir,target,sandbox_target) so model can correctly detect failure contextTest