Skip to content

feat(site/src): show nested subagent family capacity in the agents sidebar - #116

Merged
ibetitsmike merged 18 commits into
mainfrom
mike/nested-subagents-11-family-ui
Nov 10, 2026
Merged

ibetitsmike merged 18 commits into
mainfrom
mike/nested-subagents-11-family-ui

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Xum opened this PR on behalf of @ibetitsmike.

Part of #8 (W2 nested subagents, item 5b: family capacity in the sidebar). This is the UI half. It reads the family capacity endpoint from #109.

With fork-nested-subagents on, the agents sidebar tree marks two capacity states:

  • A running subagent that waits for a concurrency slot shows an hourglass in place of its status icon, and "Waiting for a free subagent slot" replaces its "streaming…" subtitle.
  • An expanded root whose family is at its live subagent limit shows a live N/M chip after its title. Its title attribute and a screen reader suffix say the family cannot spawn another subagent until enough subagents finish.

Why. Before this change, a subagent that waited for a slot looked the same as one that ran, and nothing in the sidebar told the user why the next spawn or message_agent resume failed.

Change.

  • site/src/api/forkChatFamily.ts and api/queries/forkChatFamily.ts call GET /api/v2/chats/fork/{chat}/family. They live in fork files so api.ts stays unchanged. No event announces a capacity change, so the query polls every 5 seconds, backing off to 30 seconds after a failed read.
  • ChatsSidebar/tree/ForkFamilyCapacity.tsx has useForkFamilyCapacity and the chip. A root row asks only while it is expanded and has a live subagent. A subagent row asks only while it is running. All rows of a family share one query key and only the root row polls, so a family costs one request per interval. Rows of another user's shared chats never ask, because the endpoint answers only the owner. With the experiment off, nothing asks.
  • ChatTreeNode.tsx gains about fifteen lines: the hook call, the status icon and subtitle override, and the chip.
  • Story NestedSubagentFamilyAtCapacity covers both markers for the visual check.
Validation
  • New vitest ChatsSidebar nested subagent capacity: a collapsed root sends no family request, and expanding it sends exactly one for the whole family. A negative control (query disabled) fails the test. The NestedSubagentFamilyAtCapacity story covers the markers visually.
  • UI UAT against a dev server built from this branch, driven with Playwright: UAT comment.
  • vitest on ChatsSidebar/, biome check on the touched files and tsc --noEmit pass.

Adds GET /api/v2/chats/fork/{chat}/family behind fork-nested-subagents. For a
root chat it returns the family's live subagent count and live limit, and the
running subagents that wait for a concurrency slot.
…api' into mike/nested-subagents-11-family-ui
…debar

A running subagent that waits for a concurrency slot shows a waiting icon,
and an expanded root whose family is at its live subagent limit shows a
live N/M chip. Both read GET /api/v2/chats/fork/{chat}/family behind
fork-nested-subagents.
…-11-family-ui

# Conflicts:
#	coderd/database/dbauthz/fork_forkdb.go
#	coderd/database/dbauthz/fork_forkdb_test.go
#	coderd/database/dbmetrics/fork_forkdb.go
#	coderd/database/forkdb/chat_capacity.sql.go
#	coderd/database/forkdb/forkdbmock/forkdbmock.go
#	coderd/database/forkdb/querier.go
#	coderd/database/forkdb/queries/chat_capacity.sql
#	coderd/fork_chat_family.go
#	coderd/x/chatd/fork_family.go
#	coderd/x/chatd/fork_family_internal_test.go
#	site/src/pages/AgentsPage/components/ChatsSidebar/ChatsSidebar.stories.tsx
#	site/src/pages/AgentsPage/components/ChatsSidebar/ChatsSidebar.test.tsx
#	site/src/pages/AgentsPage/components/ChatsSidebar/tree/ChatTreeNode.tsx
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum commented on behalf of @ibetitsmike.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 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-10T07:48:50.760709Z b26b7d5 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 chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 85b759847b

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

Xum commented on behalf of @ibetitsmike.

UI UAT on head 85b7598 (dev server built from this head, fork-nested-subagents on, GLM-5.3 Flash via oMLX). Organization limits for the run: max_concurrent_per_family: 1, max_live_per_family: 2, reset afterwards.

A root spawned two workers. While worker-a held the family's only concurrency slot, the API reported:

06:38:35 family={"live_subagents":2,"max_live_subagents":2,"waiting_for_capacity":["1a08f6a9-..."]}  (worker-b)

Playwright (Chromium, 1400x900) against the sidebar:

collapsed family requests: 0
waiting icons: 1
chip text: live 2/2 subagents at limit title: This family is at its live subagent limit. It cannot spawn another subagent until one finishes.
family requests after expand: 1 http://localhost:18080/api/v2/chats/fork/b033b4b0-756b-4377-b992-79c4976b607f/family
  • With the root collapsed, the page sent no family request.
  • Once expanded, the page sent exactly one GET /api/v2/chats/fork/<root>/family. worker-b showed the hourglass (accessible name "Waiting for a free subagent slot"), worker-a kept its spinner, and the root showed the live 2/2 chip with its title text.

After worker-a finished (06:39:40 family={"live_subagents":1,"max_live_subagents":2,"waiting_for_capacity":[]}), a fresh page showed:

collapsed family requests: 0
waiting icons: 0
chips: 0
family requests after expand: 2 http://localhost:18080/api/v2/chats/fork/b033b4b0-756b-4377-b992-79c4976b607f/family

worker-b now shows the running spinner, worker-a a check, and the root has no chip. The polling refetch also fired (2 requests in 7 s).

@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum commented on behalf of @ibetitsmike.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 406915e43e

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

@codex review

Xum commented on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 967c890c14

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

@codex review

Xum commented on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9412ccb35a

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

@codex review

Xum commented on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 98f97b68cb

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

@codex review

Xum commented on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c3c3df99ee

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

Comment thread site/src/api/forkChatFamily.ts Resolved
Comment thread site/src/api/queries/forkChatFamily.ts Resolved
Comment thread site/src/api/queries/forkChatFamily.ts Resolved
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum commented on behalf of @ibetitsmike.

1 similar comment
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum commented on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b26b7d5013

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

Xum (AI agent) closed and reopened this on behalf of @ibetitsmike.

Closing and reopening only to make GitHub recompute the merge ref against current main (3d4b5f5508) and run fork-ci on it. The head is unchanged.

@ibetitsmike ibetitsmike reopened this Nov 10, 2026
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) closed and reopened this again on behalf of @ibetitsmike.

The merge ref now points at current main (3d4b5f5508), but the run started by the first reopen was queued against the old merge ref. This second reopen starts fork-ci on the recomputed merge. The head is unchanged.

@ibetitsmike ibetitsmike reopened this Nov 10, 2026
@ibetitsmike
ibetitsmike merged commit 4c0cf8c into main Nov 10, 2026
20 of 27 checks passed
@ibetitsmike
ibetitsmike deleted the mike/nested-subagents-11-family-ui branch November 10, 2026 08:28
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) merged this on behalf of @ibetitsmike.

Merge evidence for head b26b7d5013ccebeebbf22e65bf7d3fa3a9b299ba:

  • fork-ci pull_request run 42779810997 passed; its build job checked out Merge b26b7d5013 into 3d4b5f5508 (current main). All checks green. Run 42777020051 had also passed on this head.
  • Codex: seven rounds; the review of 406915e found no major issues. Every finding was fixed except four, which were declined with replies: loading and error indicators (on 85b7598), and the three P2 findings on this head (fixture naming, parentById membership, a separate waiting-only story). 0 unresolved review threads.
  • Frontend deep review: every blocking and should-fix finding fixed (accessible names, named props, poll error backoff). Locally: ChatsSidebar vitest 188 pass, biome and tsc --noEmit clean on the merged tree; disabling the family query fails the capacity test.
  • UI UAT PASS on 85b7598 (comment 6760895335): dev server, fork-nested-subagents on, GLM-5.3 Flash, organization limits concurrency 1 / live 2. A collapsed root sends no family request; an expanded root sends one, the waiting worker shows the hourglass, and the root shows the live 2/2 chip, which clears once a worker finishes. Changes after that head are review hardening: the chip uses the shared Badge, a waiting subtitle, owner-only and root-only polling (descendant rows read the root's cached query), a 30 s backoff after errors, and merges of main.

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