Skip to content

feat(coderd/x/chatd): list a chat's descendants with list_agents - #278

Merged
ibetitsmike merged 2 commits into
mainfrom
mike/issue-249-list-descendants
Nov 13, 2026
Merged

ibetitsmike merged 2 commits into
mainfrom
mike/issue-249-list-descendants

Conversation

@ibetitsmike

Copy link
Copy Markdown
Owner

Coder Agents opened this PR on behalf of @ibetitsmike.

Part of #249.

What changes

With the fork-nested-subagents experiment on, list_agents takes two new options:

  • chat_id lists the children of that chat instead of the caller's. It must be the caller or one of its descendants (isSubagentDescendant). Any other chat gets chat_id must be this chat or one of its descendants.
  • recursive: true lists every unarchived descendant of the chat, walked level by level through unarchived chats with GetChildChatsByParentIDs, at most 64 levels.

With either option, each entry also has parent_chat_id. Paging (limit, offset, has_more), todos, waiting_for_capacity and the stored agent type work as before. A call without either option runs the upstream tool unchanged, so its output matches main. With fork-chat-todos on, the tool description also says to pass a listed ID to read_chat_transcript, which already reads any chat the owner can read.

Code: fork_list_agents.go wraps the tool, one hook line in fork_tools.go inside the existing fork-nested-subagents block. fork_subagent_types.go now sets the stored type for entries that are not direct children. No new experiment. No site change: the existing list_agents card renders the entries with their links.

Docs: docs/fork/pstack-adapter.md (adapter block, Nested subagents, Subagent limits, Chat transcripts, Evidence sources) and coderd/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 with recursive, then reads its transcript with read_chat_transcript.
    • ChildListsOnlyItsSubtree: a child cannot list its sibling or the root.
    • PagesTheSubtree, WithoutOptionsListsChildrenAsUpstream, ExperimentOffKeepsUpstreamSchema.
  • With the hook line in fork_tools.go commented out, three subtests fail.
  • golangci-lint run ./coderd/x/chatd/ reports nothing in the changed files. make lint/emdash, make lint/docs-html and markdownlint-cli2 docs/fork/pstack-adapter.md pass.

Not verified

  • Not exercised on a running server or in the web UI.
  • Vale was not run (its packages are not synced in this workspace).

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.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T22:01:06.712470Z ade5fbe Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 5cd0a90c59

ℹ️ 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".

@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

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

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: ade5fbe69b

ℹ️ 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".

@ibetitsmike
ibetitsmike merged commit b1a5e2f into main Nov 13, 2026
9 checks passed
@ibetitsmike
ibetitsmike deleted the mike/issue-249-list-descendants branch November 13, 2026 22:15
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

Merged as b1a5e2f442 (squash of ade5fbe69b) by the Coder Agents maintainer. This is the first merge from Coder Agents (pilot item of #254).

Gates checked on head ade5fbe69b9eaa74fae51b89e3d7dd4563d0e2dd:

  1. Head pinned with --match-head-commit; main asserted at c980fb84ea in the same script.
  2. 9 of 9 check runs passed; fork-ci run 43515315483 on this head: success.
  3. Codex receipt on this head: feat(coderd/x/chatd): list a chat's descendants with list_agents #278 (comment)
  4. 0 review threads.
  5. Behind main by 0.
  6. The maintainer ran go test -count=1 -run 'TestForkListAgentsDescendants|ListAgents|TestNestedSubagentTargets|TestForkAgentDefinitionToolResultType' -v ./coderd/x/chatd/ on the exact head: all passed, including RootListsSubtreeAndReadsGrandchild, ChildListsOnlyItsSubtree and ExperimentOffKeepsUpstreamSchema.

Not exercised: a live chat on the deployed server calling list_agents with chat_id or recursive. It goes live with fork-nested-subagents, which is on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant