Run subagents through a depth-one tool loop #45

Merged
weichen merged 1 commits from feature/agent-harness-p3 into main 2026-10-01 14:50:49 +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)= 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 检查。确认卡挂在子 run 上,e2e 未覆盖,需要一次真实对话核对。用户不能改工具白名单。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 均未合入。

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 检查。确认卡挂在子 run 上,e2e 未覆盖,需要一次真实对话核对。用户不能改工具白名单。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 均未合入。 ### 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 1 commit 2026-10-01 14:14:55 +00:00
Why: Subagents were a single lightweight call that dropped the hint and wrote their messages into the parent history. Profiles now decide tools, model, and turn cap, and the parent only keeps the summary plus confirmed artifacts.
Evidence: go test ./... passed. New tests cover the six builtin specs, tool execution and whitelist, explore versus writer models, maxTurns, artifact parts, hint text, SpawnAgent pinning, depth-1 refusal, summary artifact lines, and history isolation.
Impact: Squad steps share the general profile (up to 12 lightweight turns, no exec tools). Child runs do not attach the final-turn verifier. Profile fields stay in builtin files, so core.PromptModule is unchanged. The agent-native pin stays a34689c.
Refs: feature/agent-harness-p3
Co-authored-by: Cursor <cursoragent@cursor.com>
weichen merged commit 2c1a8994ef into main 2026-10-01 14:50:49 +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-Backend#45