Repository navigation
feat(coderd): give nested general subagents the subagent tools, direct children only - #37
Conversation
…ind fork-nested-subagents
…s, direct children only With fork-nested-subagents on, a general subagent below the maximum depth gets spawn_agent and the other subagent tools, keeps the orchestration prompt, and the subagent tools act only on the caller's direct children. With the experiment off, tools, prompts and target rules stay upstream's.
…nd spawn description Assert that wait, message and interrupt reject a grandchild, that list_agents works on a delegated chat and lists direct children only, that the spawn_agent description rewrite applies with the configured depth, and that appendForkTools leaves delegated chats untouched with fork experiments off.
…en and the depth flag
The Coder-Ancestor-Chat-Ids header carried only the immediate parent, so a grandchild's file edits and commands were never attributed to the family root's path store and the root's git watch and diff omitted that work. Resolve the chain with a new chatd helper: nil for a root, the parent alone when fork-nested-subagents is off (upstream behavior, no extra queries), and the full chain nearest ancestor first up to the root when it is on. A failed lookup warns and keeps the ancestors found so far.
|
@codex review |
Codex Review Summary: ✅ CompletedThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a202b75306
ℹ️ 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".
…for subagent depth
…nto mike/nested-subagents-2-tools # Conflicts: # coderd/x/chatd/ARCHITECTURE.md # coderd/x/chatd/fork_tools.go
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b248122ef5
ℹ️ 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".
…-2-tools # Conflicts: # coderd/x/chatd/fork_subagents.go # coderd/x/chatd/fork_subagents_internal_test.go
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
…-2-tools # Conflicts: # coderd/x/chatd/ARCHITECTURE.md
Merge evidence at head
|
Note
Xum opened this PR for Mike.
Part of #8 (W2 nested subagents, PR 2 of the stack). Stacked on #33: review only the commits after it.
With
fork-nested-subagentson, ageneralsubagent below the maximum depth (--chat-max-subagent-depth, default 2) now gets the subagent tools, so a root, coordinator and worker family works end to end. With the experiment off, tool lists, prompts, descriptions and target rules stay upstream's.appendForkToolsnow takes the model config and returns an error. It appendsspawn_agent,list_subagent_models,list_agents,wait_agent,message_agentandinterrupt_agentfor a non-root chat that can spawn: not explore or computer use, anddepth + 1 <= max.wait_agent,message_agent,interrupt_agentandlist_agentsact only on the caller's direct children. A root can no longer reach its grandchild. Upstream lets a chat target any descendant, and that rule still applies with the experiment off.spawn_agentdescription names the depth limit.Coder-Ancestor-Chat-Idsheader now carries the whole parent chain up to the root, for agent connections and workspace-file uploads. Without it, a grandchild's touched paths never reached the root's git watch (Codex P1 on feat: record nested subagent depth and enforce a maximum behind fork-nested-subagents #33).chatd.AncestorChatIDsdoes no extra reads with the experiment off.ARCHITECTURE.mdgets only a TODO for the author.Shared seam: W1 (custom agent types) and W4 (todos) can extend
nestedSubagentToolsand thelist_agentsoutput instead of adding new hooks.Validation
go test ./coderd/x/chatd/with real Postgres (Colima),TestPostChatWorkspaceFile,./codersdk/, CLI help goldensTestNestedSubagentFamilyCompletes(three-level family against a fake OpenAI server; the worker's result reaches the root),TestNestedSubagentTools,TestNestedSubagentTargets(all four call sites andlist_agents),TestNestedSubagentOrchestrationPrompt,TestNestedSubagentSpawnDescription,TestAncestorChatIDs. A test audit broke each covered behavior and saw the test fail.chat_subagentsrecorded depths 1 and 2, and the root could not target its grandchild.spawn_agent.spawn_agent.main, so CI for this stacked PR runs throughworkflow_dispatchon the branch.