Repository navigation
feat(coderd): cascade interrupts and archive active nested subagent families - #42
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
|
@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: 18c26edfed
ℹ️ 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".
|
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". |
…-3-cascade # Conflicts: # coderd/x/chatd/ARCHITECTURE.md # coderd/x/chatd/fork_tools_internal_test.go
Merge evidence at head
|
Part of #8 (W2 nested subagents, PR 3 of the stack). Stacked on #37: review only the commits after it.
With
fork-nested-subagentson, stopping a chat stops its whole subtree, and archiving a root whose family is still working no longer fails. With the experiment off, interrupt and archive behave exactly as upstream: no fork queries, no cascade, and archiving an active family returns upstream's 409.InterruptChat(the Stop button,POST /chats/{chat}/interrupt,interrupt_agent) first interrupts every active descendant of the chat, leaves first, through the new forkdb queryGetChatSubtreeIDs(recursive walk onparent_chat_id). Interrupting an idle chat whose descendants were running now succeeds instead of returning "transition not allowed".interrupt_agenton an idle child also stops that child's running descendants.SetFamilyArchived, a root archive interrupts the family, waits up to 30 seconds until no member isrunning,interruptingorrequires_action(state-update pubsub plus a fallback ticker), then archives every member in the one upstreamSetFamilyArchivedtransaction, which keeps the root-first lock order. If the family does not settle in time, the archive fails with upstream's error.pausedmembers keep upstream's refusal.chat_mutations.go, one line insubagent_operations.go); the logic is infork_cascade.go.ARCHITECTURE.mdgets only a TODO for the author.Validation
go test ./coderd/x/chatd/with real Postgres (Colima),./coderd/database/forkdb/...,TestForkQuerier,./coderd/ -run 'TestArchiveChat|TestInterruptChat';forkdb/generate.shleaves no diff;chatdmig check.TestGetChatSubtreeIDs,TestNestedInterruptCascade(subtree, idleinterrupt_agenttarget, experiment off),TestNestedArchiveActiveFamily(a running, worker-owned grandchild settles and the family archives; a stuck family times out to upstream's error with nothing archived, on a mock clock; experiment off). Negative controls: removing each hook or experiment gate made the matching test fail.main, so CI for this stacked PR runs throughworkflow_dispatchon the branch until feat(coderd): give nested general subagents the subagent tools, direct children only #37 merges.