Repository navigation
fix(dashboard): derive the queued subagent count from slot state - #16348
Conversation
|
Maintainer ruling on the critique A1(ii) deviation: accepted. A session shows Working while its parent turn is busy or while a child it started is actually running, because that is real work in progress. A child that is only queued never makes the session Working; it shows the separate Waiting for memory badge instead. The symptom this fixes is the queued-only case. |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Before merge, check that a slots push for an evicted or forgotten parent cannot set a correct non-zero client count to 0 while that parent's children are still queued. [DESIGN-REVIEWED] 1e0ef69 Description read[DESCRIPTION-READ] 122146b41ccee1146f7bf25e5390acb55882eb3b819ea80d901c85a8f250e70e That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
UX Review (Opus 5.5) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS Sessions whose agents are only queued now show in the IDLE column, and the blind reader read "queued" as lined-up work, not idleness. Watch
Suggestions
[UX-REVIEWED] 1e0ef69 Description read[DESCRIPTION-READ] 7a7269412dab4f854e21bab6ac33719e3c1a7b592ddbd3dfc8af5ae02557dc05 That sha256 names everything this verdict read: the PR description, plus the 7 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The lifecycle-edge "heal" read patches an unnamed pop path that never emits, instead of making that path emit; it also adds Not justified as shipped
What this change shipsInventory (9 items) — 8 justifiedIntent: stop showing sessions whose sub-agents are only queued as Working, and let a missed queued-count frame heal on its own. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 1e0ef69 Description read[DESCRIPTION-READ] 2a47dadd30908ba31d263b0441f29931bccafbdca60ed7e165582633fcf9a5e2 That sha256 names the PR description this verdict read. Recompute it with |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
499853b to
1cb15aa
Compare
|
Superseded by the per-finding disposition records on head 7c1b250 (one comment per finding). UX review dispositions (carried from 499853b to 1cb15aa)
Design review disposition: the BLOCK is the same missing rendered evidence. It is owed before this PR leaves draft (see above), not disputed. |
|
Rebased onto main (now including #16191), pushed 1cb15aa as one commit. Authorship and the Co-authored-by trailer are unchanged.
Still a draft: #13881 has not merged, and the screenshots are still owed. |
1cb15aa to
f1eb3eb
Compare
|
Superseded by the per-finding disposition records on head 7c1b250 (one comment per finding). Design review dispositions (findings on 1cb15aa, carried to f1eb3eb)
UX review dispositions (carried from 1cb15aa)
First-principles disposition: item 3, "the Waiting for memory relabel is oversized" (CONCERNS, advisory). Kept. The relabel is in scope. The unit's own heading (G8) names "a separate 'Waiting for memory' badge". The maintainer ruling on this PR (the first comment) says a queued-only child "shows the separate Waiting for memory badge instead". So the Goal this lane measured against was narrower than the ruling. On a low-memory host, the wait's cause is what the user needs from the row. The count stays on the progress bar and in the tooltip, and a cap wait keeps "N agents queued". |
|
Rebased onto main (114 commits, now including #16395 and #16390) and pushed f1eb3eb as one commit. Authorship and the Co-authored-by trailer are unchanged.
Still a draft, because #13881 has not merged. The screenshots are owed before it leaves draft. |
0a97005 to
7c1b250
Compare
Disposition: rebutted
|
Disposition: rebutted
|
Disposition: rebutted
|
Disposition: rebutted
|
Disposition: rebutted
|
Disposition: rebutted
|
Disposition: rebutted
|
Disposition: rebutted
|
Disposition: rebutted
|
Disposition: rebutted
|
Disposition: fixed
|
|
Disposition: rebutted: PASS note, a gateway restart while queued store rows remain.
|
2c70c1b to
1e0ef69
Compare
Disposition: rebutted
|
Disposition: rebutted
|
Disposition: rebutted
|
Disposition: rebutted
|
Disposition: rebutted
|
|
Disposition: rebutted: PASS note, a slots push for an evicted or forgotten parent while its children are still queued.
|
mainline-plan U7 (G8: Working lane from parent-turn state plus a separate 'Waiting for free RAM' badge, F5 test, ghost reconcile). The reconcile tests are ported from #13921 by @kyleseaman, credited as Co-authored-by on the commit.
Problem / Motivation
Goal: a session whose sub-agents are only queued no longer sits in the board's Working lane, and a stale "N queued" count that a client holds because it missed or misapplied a frame is corrected by the next slots push, on any session. A server-side ghost (a published depth with no emit and no child start or end after it) is out of scope here; see judgement call 2.
Two symptoms, both from the ghost-queue reports (mainline plan unit U7 / gap G8, critique amendment A1(ii), acceptance F5):
subagents.tsselectSidebarSubagentCounts→board.ts→sessionLane.ts). A parent whose turn had ended, with children only waiting for memory, showed as Working while nothing ran.subagent_queuedframes. A client that missed or misapplied the 0 frame kept "1 queued" (and Working) until a reload.Why it matters
On a low-memory host, children wait for memory by design. Showing those sessions as Working, with a running pulse, says work is happening when it is not. A ghost count that never clears makes the dashboard untrustworthy, and every affected user can only fix it by reloading.
Not a goal
_fire_event, so the published table records it.What changed (motivation → approach → change)
Working never comes from the queued count (F5).
selectSidebarStartedSubagentCountscounts running, tool and pending children, never queued ones.selectSidebarSubagentCountsis now started plus queued, built on it.board.tsuseColumnMatches, threaded throughfilters.tsxandChatSidebar.tsx), the row'sliveWorkSupersedesInterruption, and the close-chat lane all read the started count. The close-chat gate still confirms when queued children exist, on its own term.low_memory/memory_pressurewaits (isMemoryWait; fix(subagent): queue every capacity verdict and read memory off the loop #16355 retiredposture_criticalas a spawn wait, so it is no longer listed) and "N agents queued" otherwise, with the wait sentence as the tooltip. New i18n keypages.chatSidebar.waiting_for_memoryin every catalog.The slot list carries the queued depth, so a missed frame heals.
subagent_manager/published_depth.pyPublishedQueueDepths: the last published depth per parent. It is recorded in_fire_eventbeforeon_eventruns. 0 is not stored,cancel_for_teardownforgets the parent, and the table is capped at 1024 (oldest dropped). The slot list reads it with no store read on the loop.subagent_spawn/subagent_done),_fire_eventasks the parent's depth burst (fix(subagent): keep the queued count exact and cheap #16191) for a heal read, which publishes only a depth that differs from the held entry. A path that pops or ends a row without its own emit therefore publishes the real count at the next lifecycle edge, and a path that already emitted is not answered with the same frame twice. Without this, the table would keep re-sending a count, including on a reload's firstslotsframe.serialize_slotsaddssubagents_queuedper row, routed the way the frames are: each entry lands onsubagent_event_slot(parent), and entries for the same tab sum. A cron tab (cron-<job>) therefore reports the runs that publish undercron:<job>:<run>orcron:<job>:<agent>, not 0 from its linkedcron:<job>key.slack/gateway.pyschedules the debounced slots push onsubagent_queuedas well as on spawn/done.subagent_queuedframe carries its tab's sum: this parent's depth plus every other parent's published depth on the same tab. The client sets the tab count from each frame, so frames and the slots push now agree on a multi-parent cron tab instead of flipping between the last frame and the sum.hooks/websocket/slotList.tsdispatchesreconcileSubagentQueuedFromSlotson every WSslotsframe. It runs before the identical-frame skip, so a push equal to the previous one still clears a count that a frame moved in between. It never runs on thefetchSlotsGET, whose answer can land after a newer frame. A row without the field leaves its count alone. The wait label is kept while the count is above 0 and cleared at 0.#13921's seq / REST-poll design was replaced by the slots push. That push is ordered with
subagent_queuedon the same socket, so a sequence number is not needed. Its reconcile tests are ported.Spec:
docs/system-specs/modules/subagent.md(thesubagent_queuedparagraph).Judgement calls
spawn_asyncrun to Idle, which is a wider product change than F5 asks for. This is an explicit deviation, recorded for kirocrew-ef.serialize_slotsruns on the loop for every tab, and the store half of the depth is a SQLite count. A ghost with no lifecycle edge after it (no start and no end of any child of that parent) still waits for the next real emit. The remaining no-emit paths were G7's (fix(subagent): stop counting resume entries and orphaned overflow as queued #16395, merged).adaptive_cap_zeroandconcurrency_limitkeep "N agents queued", with the same static non-Working badge.Backwards compatibility
Compatible:
subagents_queuedis a new additive field on slot rows. A client that ignores it is unaffected, and a row without it leaves the client's count alone.Removes nothing: no field, key, row or public function is removed.
selectSidebarSubagentCountskeeps its name and meaning (started plus queued).Tests
test/test_published_queue_depth.py:on_event_emit_queue_depthpath records 1 then 0test/test_queue_depth_reconcile.py::test_a_lifecycle_edge_that_agrees_with_the_published_depth_sends_nothing: a heal whose read matches the held depth publishes nothing (and fix(subagent): keep the queued count exact and cheap #16191'stest_stopping_a_row_held_only_by_the_store_publishes_the_depthstays at one frame).cron:job7:run1pluscron:job7:writer, which gives 3)test/test_slack_gateway.py::TestInitSubagents::test_subagent_queued_pushes_slots_debounced.test/test_slack_gateway.py::TestInitSubagents::test_queued_frame_carries_its_tabs_sum_across_parents: two parents on one cron tab; each frame carries the tab sum thatserialize_slotsreports, including after one publishes 0 (fails without the fix).website/src/test/ChatSidebar.boardStateLanes.test.tsx(queued children):memory_pressurehold also reads Waiting for free RAMwebsite/src/test/useWebSocket.queuedReconcile.test.ts, through the real socket path:website/src/test/useKeyboardShortcuts.test.tsx: Ctrl+W confirms for a session whose children are only queued.website/src/test/SubagentProgressBar.test.tsx: the fix(subagents): clear a stale queued count on the wave chip #13921 tests, ported (stale 1 clears and the chip unmounts, a missing field leaves the count, a cron-born tab keeps its count, the label is kept while waiting).chatSlice.publicSurface,chatSlice.ownership, anduseWebSocket.frameTrace. The reconcile now leads each slots frame, and a repeated frame dispatches only the reconcile.Manual verification
Not run against a live gateway. The isolated-gateway recipe needs a memory-starved host to queue children. The socket path is covered end to end by the
useWebSockettests, and the backend routing by a realDashboardStatewith a realSubagentManager.Screenshots / video
Rendered from this head after the rebase onto main (built
website/dist, every/api/**call and the/api/wssocket stubbed by Playwright, state pushed as realsubagent_queued/subagent_spawn/subagent_toolWS frames). Four sessions: a memory wait (low_memory, 3 queued), a cap wait (concurrency_limit, 2 queued), one with a started child, and an idle one.Sidebar: the memory wait reads "Waiting for free RAM" and the cap wait keeps "2 agents queued". Both are static (Hourglass icon, no pulse), next to the running child's "1 agent running" row. The memory row's tooltip is the wait sentence ("waiting to start — needs 3GB of free memory, 1.4GB free now; free up memory to continue").
Board with the four state lanes: the two queued-only sessions are filed under Idle, not Working. Only the session with a started child is in Working.
The UX lane's label suggestion is applied:
pages.chatSidebar.waiting_for_memorynow reads "Waiting for free RAM" (every catalog), so the badge no longer reads as agent memory.Related Issues
Part of #16480
Implements mainline plan unit U7 (G8: WP6 + critique A1(ii) + F5).
Related, not a dependency:
SubagentProgressBar.tsx/subagents.tsneighbours) is still open. This PR uses none of its code: it builds and its tests pass on main without it, and its hunks stay clear of fix(dashboard): retire a gone spawn approval everywhere #13881's. Whichever lands second rebases._fire_event, so the table composes with its coalescing, and the edge heal joins its per-parent burst.Supersedes #13921 (Kyle Seaman's draft). Its tests are ported here with credit (Co-authored-by), and it is closed with a credit comment.
Pattern harvest
Rule candidate: review-prompt
Pattern: "a per-row lookup keyed by the row's own session key, for a value whose producer is routed by
subagent_event_slot, disagrees on cron / channel tabs; route both through the same mapping"Checklist
Contribution License Agreement