Repository navigation
feat(coderd/x/chatd): list a chat's descendants with list_agents - #278
Conversation
With fork-nested-subagents on, list_agents takes chat_id to list the children of the caller or one of its descendants, and recursive to list the whole subtree. Entries then carry parent_chat_id. A chat can never list outside its own subtree. A call without either option still runs the upstream tool unchanged. Part of #249.
@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. |
|
Codex Review: Didn't find any major issues. Nice work! 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". |
fork-ci chat-tests failed on 5cd0a90: the list_agents subtests shared one context made before they waited for a parallel slot, so it expired under CI load. ade5fbe gives each subtest its own context. @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". |
Merged as Gates checked on head
Not exercised: a live chat on the deployed server calling |
Part of #249.
What changes
With the
fork-nested-subagentsexperiment on,list_agentstakes two new options:chat_idlists the children of that chat instead of the caller's. It must be the caller or one of its descendants (isSubagentDescendant). Any other chat getschat_id must be this chat or one of its descendants.recursive: truelists every unarchived descendant of the chat, walked level by level through unarchived chats withGetChildChatsByParentIDs, at most 64 levels.With either option, each entry also has
parent_chat_id. Paging (limit,offset,has_more),todos,waiting_for_capacityand the stored agent type work as before. A call without either option runs the upstream tool unchanged, so its output matchesmain. Withfork-chat-todoson, the tool description also says to pass a listed ID toread_chat_transcript, which already reads any chat the owner can read.Code:
fork_list_agents.gowraps the tool, one hook line infork_tools.goinside the existingfork-nested-subagentsblock.fork_subagent_types.gonow sets the stored type for entries that are not direct children. No new experiment. No site change: the existinglist_agentscard renders the entries with their links.Docs:
docs/fork/pstack-adapter.md(adapter block, Nested subagents, Subagent limits, Chat transcripts, Evidence sources) andcoderd/x/chatd/ARCHITECTURE.md.Tests
cd coderd/x/chatd && flock ~/.fork-go.lock go test -count=1 -run 'TestForkListAgentsDescendants|ListAgents|TestNestedSubagentTargets|TestForkAgentDefinitionToolResultType' -v .passes.RootListsSubtreeAndReadsGrandchild: the root lists a grandchild withrecursive, then reads its transcript withread_chat_transcript.ChildListsOnlyItsSubtree: a child cannot list its sibling or the root.PagesTheSubtree,WithoutOptionsListsChildrenAsUpstream,ExperimentOffKeepsUpstreamSchema.fork_tools.gocommented out, three subtests fail.golangci-lint run ./coderd/x/chatd/reports nothing in the changed files.make lint/emdash,make lint/docs-htmlandmarkdownlint-cli2 docs/fork/pstack-adapter.mdpass.Not verified