Files
Genarrative/docs/project-memory/shared-memory
lhk229 323db581fa
Project CI / Repository checks (pull_request) Successful in 1m9s
Project CI / Frontend tests (pull_request) Successful in 2m54s
Project CI / Backend tests (pull_request) Successful in 3m56s
Project CI / Native shell tests (pull_request) Failing after 10m41s
修复 M1A-2 引入的回归:未知工具名不是身份违规
background_agent_runtime_persists_receipts_for_rejected_actions 在本分支
恒失败(3/3),master 通过。首个 tool-plan 请求能收到,动作被拒绝后第二次
Provider follow-up 不再发出,测试等待超时。不是已知的 mock-LLM 本机 flake。

根因是 M1A-2 给主循环加身份门时用了 agent_runtime_tool_allowed_for_agent,
而该函数对非 project-planning 的 Agent 退化成「这个工具名是否已知」。于是
普通 Agent 调用一个不存在的工具(模型编名字,常见协议错误)被判成身份违规,
main_loop 直接 mark_needs_reconciliation 并返回 NeedsReconciliation,整个
run 中断。现役语义是未知工具产出一条 rejected observation、run 继续、由下
一轮 tool-plan 收束。

两类必须分开:身份禁止某个已知工具是安全边界,命中即硬拒;工具名根本不存在
是可恢复的协议错误,不得升级成中断整个 run。

新增 agent_runtime_tool_rejected_by_agent_identity,只在「该 Agent 带 exact
allowlist 且工具不在其中」时为真。三个命中即中断或整体拒绝的调用点改用它:
main_loop(本次回归直接原因)、provider_action_batch 的 identity_block(原会
把普通 Agent 的未知工具从 rejected 误判成 blocked)、runtime_tools/policy
(原本就正确限定 planning,改为复用同一判据以免再次分叉)。parallel_ledger
内部批次资格判定不变,其下一行的 command_id 检查本就拦得住。

planning 侧约束未放松,两条单测分别钉死普通 Agent 与 planning 两侧。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 06:35:45 +00:00
..