Skip to content

feat(site/src/pages/AgentsPage/components): show a waiting subagent in the chat top bar - #127

Merged
ibetitsmike merged 3 commits into
mainfrom
mike/nested-subagents-12-topbar-waiting
Nov 10, 2026
Merged

ibetitsmike merged 3 commits into
mainfrom
mike/nested-subagents-12-topbar-waiting

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: capacity states in the UI). It reads the family capacity endpoint from #109, as the sidebar markers in #116 do.

With fork-nested-subagents on, the top bar of a subagent's chat shows a "Waiting for a free subagent slot" badge with an hourglass while the subagent is running but waits for a concurrency slot. On narrow screens the badge shows only the hourglass and keeps the label for screen readers. The badge sits inside the title's role="status" region, so its appearance is announced.

Why. #116 marks a waiting subagent in the sidebar tree, but the sidebar can be collapsed, hidden on mobile, or show the root collapsed. A user who has the subagent's chat open saw a running chat that produced nothing, with no reason why.

Change.

  • components/ForkSubagentSlotBadge.tsx (fork file) asks GET /api/v2/chats/fork/{root}/family only when the chat is a subagent the user owns, its live status is running, and the experiment is on. It keys the query on the family root (root_chat_id, else the parent), because the endpoint rejects a child ID, and shares the cache entry with the sidebar.
  • The sidebar polls only while the root row is expanded, so the badge cannot rely on it. It uses the same query options, which poll every 5 seconds and back off to 30 seconds after a failed read. While the root row is also expanded, both observers poll the shared entry.
  • ChatTopBar.tsx gains one element after the agent type badge. ForkFamilyCapacity.tsx exports waitingForSlotStatus, so the icon, color and label match the sidebar, and getForkFamilyRootID, which both places use to pick the root.
  • Story WaitingForSubagentSlot covers the badge for the visual check.
Validation
  • New vitest ChatTopBar nested subagent slot: a running grandchild chat asks for the family of root_chat_id, not its own ID or its parent's. A negative control (query keyed on the chat's own ID) fails the test. The WaitingForSubagentSlot story covers the badge visually.
  • vitest on ChatTopBar.test.tsx and ChatsSidebar.test.tsx (100 tests), biome check on the touched files and tsc --noEmit pass.
  • UI UAT against a dev server built from this branch, driven with Playwright on desktop and phone: UAT comment.

…n the chat top bar

A running subagent that waits for a free concurrency slot shows a
"Waiting for a free subagent slot" badge in its chat top bar. It reads
GET /api/v2/chats/fork/{root}/family behind fork-nested-subagents and
polls on its own, because the sidebar polls only while the root row is
expanded.
@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-10T08:49:41.352009Z e6dbd96 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.

@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: ee2cc0a7f9

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

Copy link
Copy Markdown

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

Reviewed commit: e6dbd9609b

ℹ️ 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 e6dbd96 (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 to {} afterwards.

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

09:18:36 family={"live_subagents":2,"max_live_subagents":2,"waiting_for_capacity":["920ef051-..."]}  (worker-b)

Playwright (Chromium) opened worker-b's chat page with the root collapsed in the sidebar (aria-expanded=false), on desktop (1400x900) and phone (390x844):

[desktop/waiting] title-region text: "capacity-ui-root\nworker-b\nWaiting for a free subagent slot"
[desktop/waiting] badge count=1 visible=true
[desktop/waiting] family requests in ~12s: 3   (09:18:53, :58, 09:19:03, all /chats/fork/<root>/family)
[mobile/waiting]  title-region text: "capacity-ui-root\nworker-b\nWaiting for a free subagent slot"
[mobile/waiting]  family requests in ~12s: 3
  • The top bar showed the warning badge with the hourglass after the title. On the phone screenshot it is icon only, and the label stays in the role="status" region for screen readers.
  • With the sidebar root collapsed, the top bar was the only poller: one request every 5 seconds, each to the root's ID, never to the child's.

After worker-a finished (09:19:56 family={"live_subagents":1,"max_live_subagents":2,"waiting_for_capacity":[]}, worker-b running), fresh pages showed:

[desktop/freed] title-region text: "capacity-ui-root\nworker-b"
[desktop/freed] badge count=0
[mobile/freed]  badge count=0

Negative check: worker-a's page, with worker-a no longer running, sent 0 family requests in 12 s and showed no badge.

The only console errors were the dev setup's latency-check CORS failures. They come from reaching the dev server through a host port forward (origin localhost:18080, API 127.0.0.1:3000), and are unrelated to this change. Screenshots are kept locally (waiting-desktop.png, waiting-mobile.png, freed-*.png).

@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 (a9438bd7af) 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 (a9438bd7af), 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 7161027 into main Nov 10, 2026
21 of 28 checks passed
@ibetitsmike
ibetitsmike deleted the mike/nested-subagents-12-topbar-waiting branch November 10, 2026 10:00
@ibetitsmike

Copy link
Copy Markdown
Owner Author

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

Merge evidence for head e6dbd9609b70930688bc090c97ad72c988ada237:

  • fork-ci pull_request run 42792847844 passed; its build job checked out Merge e6dbd9609b into a9438bd7af (current main). All checks green. Run 42785355835 had also passed on this head. biome 2.5.10 on the 5 changed site files: no fixes.
  • Codex on this exact head: no major issues (comment 6763078658). Round 1's two P2s (phone-viewport story, JSDoc on the shared waitingForSlotStatus) were fixed. 0 unresolved review threads.
  • UI UAT PASS on a dev server built from this head with subagent limits 1/2 (comment 6763681656): with the root row collapsed the badge shows on desktop and icon-only on phone, with one family GET to the root every 5 s; the badge disappears once the slot frees; a non-running worker page sends no requests.

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