Repository navigation
feat(coderd): report subagents waiting for a fork concurrency slot - #57
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.
…for subagent depth
…nto mike/nested-subagents-2-tools # Conflicts: # coderd/x/chatd/ARCHITECTURE.md # coderd/x/chatd/fork_tools.go
…-2-tools # Conflicts: # coderd/x/chatd/fork_subagents.go # coderd/x/chatd/fork_subagents_internal_test.go
…nto mike/nested-subagents-3-cascade # Conflicts: # coderd/database/dbauthz/fork_forkdb.go # coderd/database/dbauthz/fork_forkdb_test.go # coderd/database/dbmetrics/fork_forkdb.go # coderd/database/forkdb/forkdbmock/forkdbmock.go # coderd/database/forkdb/querier.go
…description cannot read organization limits
…d spawn pre-check
…' into mike/nested-subagents-7-capacity-wait
@codex review |
|
Codex Review: Didn't find any major issues. 👍 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". |
…mike/coder into mike/nested-subagents-7-capacity-wait
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! 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". |
…mike/coder into mike/nested-subagents-7-capacity-wait
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. 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". |
…ted-subagents-7-capacity-wait
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. 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". |
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. 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". |
Closing and reopening only to make GitHub recompute the merge ref against current main ( |
The merge ref now points at current main ( |
Merge evidence for head
|
Part of #8 (W2 nested subagents, PR 7 of the stack). Stacked on #49: review only the commits after #49.
With
fork-nested-subagentson, a subagent that a concurrency limit holds back now says so. With the experiment off, nothing changes.queued_for_capacityon a subagent chat now comes from the fork limiter, which owns subagent admission since feat: enforce subagent concurrency limits behind fork-nested-subagents #47. It is true when the subagent is running, no worker with a fresh heartbeat owns it, and the deployment, organization or family limit is full. The deployment limit includes upstream's subagent pool, counted without the subagent's ancestors, so the answer matches what the limiter admits. Root chats and the experiment-off path keep upstream's answer. This adds one hook statement to upstream'sChatQueuedForCapacity.list_agents. Each listed child getswaiting_for_capacity: truewhile it waits for a slot. The field is omitted otherwise, and the output is unchanged when bothfork-chat-todosandfork-nested-subagentsare off. The existingforkListAgentshook insubagent.gonow also passes the children.GetChatAwaitingWorkeruses the heartbeat predicate of upstream'sGetChatQueuedForCapacity. It reads as chatd, with a dbauthz wrapper that checks chat read.subagentCapacityFullandsubagentPoolLimit, so admission and this report share it.ARCHITECTURE.mdgets only a TODO for the author.Validation
go test ./coderd/x/chatd/, plus./coderd/database/forkdb/...,./coderd/database/dbauthz/,./coderd/database/dbmetrics/and./coderd/database/migrations/chatdmig/....forkdb/generate.shleaves no diff.TestGetChatAwaitingWorker(unowned, stale and fresh owners),TestForkQuerier/GetChatAwaitingWorker,TestForkChatQueuedForCapacity(only a running, unarchived, unowned subagent in a full family is queued; roots and the experiment-off server are not; slots free when owners go stale),TestForkChatQueuedForCapacityUpstreamPool(a child whose coordinator holds the only pool slot is not queued, where upstream would say it is; a subagent of another family is), andTestForkListAgentsWaitingForCapacity(the field appears only withfork-nested-subagentson). Each guarded condition was broken in turn and its test failed.queued_for_capacity: trueon the chat API andwaiting_for_capacity: trueinlist_agents. Both cleared when the slot freed or the limit was raised, an interrupt cleared them, and with the experiment off nothing was reported. The later merge of feat: enforce the live subagent limit per family behind fork-nested-subagents #49 moved the upstream pool into the fork answer; a UAT round on the current head will follow in a comment.main, so CI for this stacked PR runs throughworkflow_dispatchon the branch until it targetsmain.