Pin backend to the depth-one subagent loop #140

Merged
weichen merged 9 commits from feature/agent-harness-p3 into main 2026-10-01 14:51:02 +00:00
Owner

feature/agent-harness-p3 任务卡

任务主记录:https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/140 ;状态:进行中;owner:weichen

基线与授权

  • 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= bc8fef76bb
  • 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-agent-harness-p3(worktree);分支:feature/agent-harness-p3
  • 授权与交付终点:实现 P3a(子代理 profile、带工具的子循环、深度 1、历史隔离)。允许改 Agent-System-Backend,并在 feature/agent-harness-p3 上提 PR;Dev 仓只推进 modules/backend 并提 PR。未授权:合入 main、改 agent-native、改 agent-squad、改 core 契约、做后台通知或评审流水线。
  • 启动自检(2026-10-01T14:01Z):make precheck verdict READY。head=bc8fef76bb,origin/main 同步,树干净。必读 core/baseline.md、workflows/delivery.md §1 已读。
  • 裁定:profile 的 tools、model、maxTurns 只从内置库文件读取,用户覆盖正文不能改这三项,因此不改 core.PromptModule。子代理不挂终轮 Stop 检查,父回复的终轮检查覆盖子代理产出的工件。小队步骤一律用 agent.sub.general。

目标与非目标

  • 目标:delegate_task 按 profile 拉起带工具的内核子循环,深度为 1,父会话只收到摘要和工件;子 run 消息不进入主对话历史。小队步骤经 SpawnSubagent 走同一运行时。
  • 非目标:后台运行与完成通知、评审流水线、小队角色到 profile 的映射。不改内核、小队仓和 core 契约。

同步记录

节点 sync_base_sha tested_head_sha checked_at
启动 bc8fef76bb bc8fef76bb 2026-10-01T14:02:12Z
同步前验收 bc8fef76bb 5ed3649b42 2026-10-01T14:13:39Z

结果与验证

  • 结果:六个 agent-sub-*.md 写入 tools、model、maxTurns,只从内置库读取。SubLLMRunner 改为带工具的内核子循环,深度为 1,父会话收到摘要和已确认工件。子 run 消息不进入 History(),ListMessages 仍保留。Backend 5051a06。Dev 只推进 modules/backend 到该提交(5ed3649)。三处编译用 agent-native 仍为 a34689c(Dev deps/agent-native、deps/agent-squad/deps/agent-native、backend deps/agent-native)。
  • 验证:见下方三段输出。make test 退出码 0(boundaries、core、backend、frontend vitest 51、ui vitest 71、agent-command)。
  • 影响与剩余项:小队步骤改为最多 12 轮的轻量子循环,不含执行类工具。子代理不挂终轮 Stop 检查。用户不能改工具白名单。Backend PR https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Backend/pulls/45 与 Dev PR https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/140 均未合入。

真实对话核对

服务 p3a(scripts/svc.sh p3a deploy --from dev@f823118,http://127.0.0.1:8934,数据从 dev 复制)。未改代码。

  • explore(cnv_feb01f134edd):子 run run_afe7397a04c6 调用了 knowledge_search、tavily_search、web_search。父回复只有 delegate_task 的摘要。下一轮追问工具名,模型回答记录里没有这些工具名;ListMessages 仍保留子 run 消息。
  • writer(cnv_73fdad281472):子 run 调用了 run_python 并写了 p3a-check.md。父回复钉上了 art_e7734e155382 等工件。终轮检查给出「本轮回复未通过终轮检查」,父模型在登记后又反复改文件。
  • 确认卡(cnv_443b8b5bcae7,画像 Confirm: ["knowledge_search"]):卡片 hitl_85bc6a141b8e 挂在子 run run_a2a874a6ab4c。收件箱显示「执行工具 knowledge_search?」和「执行 / 取消」。批准后子代理继续检索并完成。
  • 小队(cnv_bac0acb41e71):四个步骤都是子代理工具循环,工具属于 general(write_artifact、quality_review,没有 run_python)。leader 写出 output.md(art_0af18d24d11a)。父 run 随后因轮次上限 16 失败,发生在质检打回后的重排,不是子代理运行时错误。

Tavily 返回 HTTP 402,是账户额度,不是这次的代码问题。

precheck

[verdict] READY
head=bc8fef76bb,origin/main 同步,树干净
必读 core/baseline.md、workflows/delivery.md §1
checked_at=2026-10-01T14:01Z

task-sync

Already up to date.
[synced] sync_base=bc8fef76bb tested_head=5ed3649b42 checked_at=2026-10-01T14:13:39Z
[next] 跑正式验收(make test 等),证据写入任务卡

make test

bash scripts/lint-boundaries.sh
boundaries ok
cd modules/core && go test ./...
ok  	agent-system-core	0.002s
cd modules/backend && go test ./...
(各包 ok,含 internal/prompts、internal/runtime、internal/runmgr、internal/server)
cd modules/frontend && npm ci && npx vitest run
 Test Files  9 passed (9)
      Tests  51 passed (51)
cd modules/ui && npm ci && npx tsc --noEmit && npx vitest run
 Test Files  11 passed (11)
      Tests  71 passed (71)
cd deps/agent-command && go vet ./... && go test -count=1 ./...
ok  	agent-command	0.002s
ok  	agent-command/conformance	0.001s
# feature/agent-harness-p3 任务卡 任务主记录:https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/140 ;状态:进行中;owner:weichen ## 基线与授权 - 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= bc8fef76bb8cec7b6ea1acf6c061232d20a78102 - 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-agent-harness-p3(worktree);分支:feature/agent-harness-p3 - 授权与交付终点:实现 P3a(子代理 profile、带工具的子循环、深度 1、历史隔离)。允许改 Agent-System-Backend,并在 `feature/agent-harness-p3` 上提 PR;Dev 仓只推进 `modules/backend` 并提 PR。未授权:合入 main、改 agent-native、改 agent-squad、改 core 契约、做后台通知或评审流水线。 - 启动自检(2026-10-01T14:01Z):`make precheck` verdict READY。head=bc8fef76bb,origin/main 同步,树干净。必读 core/baseline.md、workflows/delivery.md §1 已读。 - 裁定:profile 的 tools、model、maxTurns 只从内置库文件读取,用户覆盖正文不能改这三项,因此不改 `core.PromptModule`。子代理不挂终轮 Stop 检查,父回复的终轮检查覆盖子代理产出的工件。小队步骤一律用 `agent.sub.general`。 ## 目标与非目标 - 目标:`delegate_task` 按 profile 拉起带工具的内核子循环,深度为 1,父会话只收到摘要和工件;子 run 消息不进入主对话历史。小队步骤经 `SpawnSubagent` 走同一运行时。 - 非目标:后台运行与完成通知、评审流水线、小队角色到 profile 的映射。不改内核、小队仓和 core 契约。 ## 同步记录 | 节点 | sync_base_sha | tested_head_sha | checked_at | |---|---|---|---| | 启动 | bc8fef76bb8cec7b6ea1acf6c061232d20a78102 | bc8fef76bb8cec7b6ea1acf6c061232d20a78102 | 2026-10-01T14:02:12Z | | 同步前验收 | bc8fef76bb8cec7b6ea1acf6c061232d20a78102 | 5ed3649b42679d1a75cbbb8c14d615bd141ac4eb | 2026-10-01T14:13:39Z | ## 结果与验证 - 结果:六个 `agent-sub-*.md` 写入 tools、model、maxTurns,只从内置库读取。`SubLLMRunner` 改为带工具的内核子循环,深度为 1,父会话收到摘要和已确认工件。子 run 消息不进入 `History()`,`ListMessages` 仍保留。Backend `5051a06`。Dev 只推进 `modules/backend` 到该提交(`5ed3649`)。三处编译用 agent-native 仍为 `a34689c`(Dev `deps/agent-native`、`deps/agent-squad/deps/agent-native`、backend `deps/agent-native`)。 - 验证:见下方三段输出。`make test` 退出码 0(boundaries、core、backend、frontend vitest 51、ui vitest 71、agent-command)。 - 影响与剩余项:小队步骤改为最多 12 轮的轻量子循环,不含执行类工具。子代理不挂终轮 Stop 检查。用户不能改工具白名单。Backend PR https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Backend/pulls/45 与 Dev PR https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/140 均未合入。 ## 真实对话核对 服务 `p3a`(`scripts/svc.sh p3a deploy --from dev@f823118`,http://127.0.0.1:8934,数据从 dev 复制)。未改代码。 - explore(`cnv_feb01f134edd`):子 run `run_afe7397a04c6` 调用了 `knowledge_search`、`tavily_search`、`web_search`。父回复只有 `delegate_task` 的摘要。下一轮追问工具名,模型回答记录里没有这些工具名;`ListMessages` 仍保留子 run 消息。 - writer(`cnv_73fdad281472`):子 run 调用了 `run_python` 并写了 `p3a-check.md`。父回复钉上了 `art_e7734e155382` 等工件。终轮检查给出「本轮回复未通过终轮检查」,父模型在登记后又反复改文件。 - 确认卡(`cnv_443b8b5bcae7`,画像 `Confirm: ["knowledge_search"]`):卡片 `hitl_85bc6a141b8e` 挂在子 run `run_a2a874a6ab4c`。收件箱显示「执行工具 knowledge_search?」和「执行 / 取消」。批准后子代理继续检索并完成。 - 小队(`cnv_bac0acb41e71`):四个步骤都是子代理工具循环,工具属于 general(`write_artifact`、`quality_review`,没有 `run_python`)。leader 写出 `output.md`(`art_0af18d24d11a`)。父 run 随后因轮次上限 16 失败,发生在质检打回后的重排,不是子代理运行时错误。 Tavily 返回 HTTP 402,是账户额度,不是这次的代码问题。 ### precheck ``` [verdict] READY head=bc8fef76bb,origin/main 同步,树干净 必读 core/baseline.md、workflows/delivery.md §1 checked_at=2026-10-01T14:01Z ``` ### task-sync ``` Already up to date. [synced] sync_base=bc8fef76bb tested_head=5ed3649b42 checked_at=2026-10-01T14:13:39Z [next] 跑正式验收(make test 等),证据写入任务卡 ``` ### make test ``` bash scripts/lint-boundaries.sh boundaries ok cd modules/core && go test ./... ok agent-system-core 0.002s cd modules/backend && go test ./... (各包 ok,含 internal/prompts、internal/runtime、internal/runmgr、internal/server) cd modules/frontend && npm ci && npx vitest run Test Files 9 passed (9) Tests 51 passed (51) cd modules/ui && npm ci && npx tsc --noEmit && npx vitest run Test Files 11 passed (11) Tests 71 passed (71) cd deps/agent-command && go vet ./... && go test -count=1 ./... ok agent-command 0.002s ok agent-command/conformance 0.001s ```
weichen added 5 commits 2026-10-01 14:14:56 +00:00
Why: The subagent runtime task needs an explicit write scope and the two rulings before backend edits.
Evidence: make precheck verdict READY at bc8fef76bb. Required reading baseline.md and delivery.md section 1.
Impact: No code change. Kernel, squad, and core contracts stay as on main.
Refs: feature/agent-harness-p3
Co-authored-by: Cursor <cursoragent@cursor.com>
Why: Subagents now run a profile-scoped tool loop and stay out of the parent history. The Dev checkout has to build that backend.
Evidence: Backend 5051a06; go test ./... and make test passed in this checkout. The three agent-native gitlinks stay a34689c.
Impact: Only modules/backend moves. Squad, core, and the three agent-native pins stay put.
Refs: feature/agent-harness-p3
Co-authored-by: Cursor <cursoragent@cursor.com>
Record the harness P3a verification on the task card
ci / test (pull_request) Failing after 1m31s
099bcd5e01
Why: Acceptance needs the precheck, task-sync, and test evidence on the same card that will become the pull request.
Evidence: make task-sync at 5ed3649; make test exited 0 (boundaries, core, backend, frontend 51, ui 71, agent-command).
Impact: Task card only. No code or submodule change.
Refs: feature/agent-harness-p3
Co-authored-by: Cursor <cursoragent@cursor.com>
weichen added 1 commit 2026-10-01 14:15:10 +00:00
Record the harness pull requests on the task card
ci / test (pull_request) Failing after 1m31s
f8231182ed
Why: The card is the pull request body, so it has to name the open Backend and Dev requests.
Evidence: Backend pull 45 and Dev pull 140 are open and unmerged.
Impact: Task card only. Neither request is merged.
Refs: feature/agent-harness-p3
Co-authored-by: Cursor <cursoragent@cursor.com>
weichen added 1 commit 2026-10-01 14:50:10 +00:00
Record the live subagent conversation check
ci / test (pull_request) Failing after 1m35s
53f8a059bd
Why: The confirm card on a child run and the history split were only covered by tests. A real conversation had to show they hold before merge.
Evidence: p3a at dev@f823118. explore hid tool names from the next turn, writer pinned artifacts, the inbox showed the child confirm card, and the squad leader wrote output.md.
Impact: Task card only. No code change.
Refs: feature/agent-harness-p3
Co-authored-by: Cursor <cursoragent@cursor.com>
weichen added 2 commits 2026-10-01 14:50:41 +00:00
Move the merge sync row into the task card table
ci / test (pull_request) Failing after 1m56s
8c43d4b16c
Why: task-sync appended the checkpoint after the test block. The card keeps sync rows in one table.
Evidence: sync_base bc8fef76bb, tested_head 53f8a05, checked_at 2026-10-01T14:50:18Z.
Impact: Task card only.
Refs: feature/agent-harness-p3
Co-authored-by: Cursor <cursoragent@cursor.com>
weichen merged commit 5096a052dc into main 2026-10-01 14:51:02 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-System-Dev#140