Skip to content

fix(dashboard): derive the queued subagent count from slot state - #16348

Merged
chenmingwei23 merged 2 commits into
mainfrom
fix/dashboard-queued-from-slot-state
Oct 5, 2026
Merged

chenmingwei23 merged 2 commits into
mainfrom
fix/dashboard-queued-from-slot-state

Conversation

@bolichen97

@bolichen97 bolichen97 commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

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):

  • The board's Working lane read a per-slot count that folds in the queued depth (subagents.ts selectSidebarSubagentCounts → board.ts → sessionLane.ts). A parent whose turn had ended, with children only waiting for memory, showed as Working while nothing ran.
  • The queued depth reached the client only through subagent_queued frames. 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

What changed (motivation → approach → change)

Working never comes from the queued count (F5).

  • New selectSidebarStartedSubagentCounts counts running, tool and pending children, never queued ones. selectSidebarSubagentCounts is now started plus queued, built on it.
  • The board lanes (board.ts useColumnMatches, threaded through filters.tsx and ChatSidebar.tsx), the row's liveWorkSupersedesInterruption, and the close-chat lane all read the started count. The close-chat gate still confirms when queued children exist, on its own term.
  • When every child is still queued, the row shows a static Hourglass badge with no pulse. It reads "Waiting for free RAM" for low_memory / memory_pressure waits (isMemoryWait; fix(subagent): queue every capacity verdict and read memory off the loop #16355 retired posture_critical as a spawn wait, so it is no longer listed) and "N agents queued" otherwise, with the wait sentence as the tooltip. New i18n key pages.chatSidebar.waiting_for_memory in every catalog.

The slot list carries the queued depth, so a missed frame heals.

  • subagent_manager/published_depth.py PublishedQueueDepths: the last published depth per parent. It is recorded in _fire_event before on_event runs. 0 is not stored, cancel_for_teardown forgets the parent, and the table is capped at 1024 (oldest dropped). The slot list reads it with no store read on the loop.
  • A held entry is re-derived from state. When a child of a parent with a non-zero entry starts or ends (subagent_spawn / subagent_done), _fire_event asks 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 first slots frame.
  • serialize_slots adds subagents_queued per row, routed the way the frames are: each entry lands on subagent_event_slot(parent), and entries for the same tab sum. A cron tab (cron-<job>) therefore reports the runs that publish under cron:<job>:<run> or cron:<job>:<agent>, not 0 from its linked cron:<job> key.
  • slack/gateway.py schedules the debounced slots push on subagent_queued as well as on spawn/done.
  • A subagent_queued frame 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.ts dispatches reconcileSubagentQueuedFromSlots on every WS slots frame. 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 the fetchSlots GET, 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_queued on the same socket, so a sequence number is not needed. Its reconcile tests are ported.

Spec: docs/system-specs/modules/subagent.md (the subagent_queued paragraph).

Judgement calls

  1. Started children still mean Working. Critique A1(ii) says "the Working lane comes from parent-turn state". This PR removes only the queued count from Working. A started child holds a live process and makes progress. Reading A1(ii) strictly would move every background spawn_async run to Idle, which is a wider product change than F5 asks for. This is an explicit deviation, recorded for kirocrew-ef.
  2. A published value, re-derived at lifecycle edges, rather than a fresh count per row. serialize_slots runs 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).
  3. "Waiting for free RAM" is shown only for memory waits. adaptive_cap_zero and concurrency_limit keep "N agents queued", with the same static non-Working badge.

Backwards compatibility

Compatible: subagents_queued is 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. selectSidebarSubagentCounts keeps its name and meaning (started plus queued).

Tests

  • test/test_published_queue_depth.py:
    • the table (records, clears at 0, ignores malformed values, bounded)
    • the depth is recorded before on_event
    • the real _emit_queue_depth path records 1 then 0
    • a parent end forgets its entry
    • a child start re-derives a depth that no path cleared (the insider.1 shape), and an empty parent is not re-counted
  • test/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's test_stopping_a_row_held_only_by_the_store_publishes_the_depth stays at one frame).
    • the row carries the depth routed to its tab, and a cron tab sums its run keys (cron:job7:run1 plus cron:job7:writer, which gives 3)
    • no manager serializes 0
  • 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 that serialize_slots reports, including after one publishes 0 (fails without the fix).
  • website/src/test/ChatSidebar.boardStateLanes.test.tsx (queued children):
    • F5: never Working on the queued count alone (fails on main)
    • the Waiting for free RAM badge without the pulse
    • the macOS memory_pressure hold also reads Waiting for free RAM
    • a cap wait keeps its count
    • a blocked parent turn stays Working
    • a started child stays Working
    • an interrupted turn with only queued children keeps its Resume handoff
    • a ghost count on a background session clears on a push
  • website/src/test/useWebSocket.queuedReconcile.test.ts, through the real socket path:
    • a background session clears
    • a byte-identical repeat push still clears a count moved in between
    • a row without the field leaves the count alone
    • a newer frame after the push wins
  • 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).
  • The pinned surfaces are updated: chatSlice.publicSurface, chatSlice.ownership, and useWebSocket.frameTrace. The reconcile now leads each slots frame, and a repeated frame dispatches only the reconcile.
  • Each new test was checked by reverting its fix: every one fails without it.

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 useWebSocket tests, and the backend routing by a real DashboardState with a real SubagentManager.

Screenshots / video

Rendered from this head after the rebase onto main (built website/dist, every /api/** call and the /api/ws socket stubbed by Playwright, state pushed as real subagent_queued / subagent_spawn / subagent_tool WS 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").

Sidebar, dark: Waiting for free RAM, 2 agents queued, 1 agent running

Sidebar, light: the same four rows

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.

Board, dark: queued-only sessions in Idle, the started child in Working

Board, light: the same lanes

The UX lane's label suggestion is applied: pages.chatSidebar.waiting_for_memory now 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:

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

  • At most two commits (one is the norm), with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

@bolichen97

Copy link
Copy Markdown
Contributor Author

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.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 3, 2026
@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 1e0ef695255a308da0dc99e0bc75da13b878f258 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — 🟡 CONCERNS

UX-level review of 1e0ef695255a308da0dc99e0bc75da13b878f258 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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

  • Queued sessions look misfiled under IDLE. The board now files a queued-only session by subagentStartedCounts, so on shots 03/04 the "Waiting for free RAM" and "2 agents queued" cards sit under IDLE. The blind reader said: "waiting or queued doesn't sound idle; it sounds like work is lined up. I'd expect them under 'Working' or in a column of their own." Users on low-memory hosts will see this every time and may think the work was dropped. This is friction, and it persists. Smallest fix: say outright on the IDLE card that the work will start on its own (see Suggestions).
  • "Waiting" now means two different things on one board. The new "Waiting for free RAM" sits beside the "Waiting on you" lane. The reader said: "Same word, different person responsible." They also asked whether they had to act: "I don't know if I'm supposed to do something about it, like close other programs." The answer, the shortfall and whether the work resumes by itself, is only in the title tooltip (queuedWaitText). A tooltip is hover-only and keyboard users never see it.

Suggestions

  • Rename pages.chatSidebar.waiting_for_memory to something like "Starts when RAM frees up". It says the system will act and it drops the overloaded word "Waiting".
  • Use a different icon for the cap wait ("N agents queued") than for the memory wait, or a different label. The reader couldn't tell whether the two hourglasses were "the same kind of wait, or which one is more stuck."

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — 🟡 CONCERNS

Premise-level review of 1e0ef695255a308da0dc99e0bc75da13b878f258 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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 must_publish and owed-retry state to the depth burst.

Not justified as shipped

  • Item 6 — symptom-level: the diff's own test says the heal exists because "A row popped with no emit of its own (the insider.1 ghost) must not stay in the table". The description says "The remaining no-emit paths were G7's (fix(subagent): stop counting resume entries and orphaned overflow as queued #16395, merged)". So either a no-emit pop path still exists, and the cause is that path, or none exists and the heal costs something for nothing. Neither the description nor the diff names the path.
    Subtraction: make the insider.1 pop path emit through _emit_queue_depth. Then delete the heal= parameter, _PendingDepthEmit.must_publish, the owed-retry branch in _queue_depth_burst, and the subagent_spawn/subagent_done re-read in _fire_event_impl.
    Clears when: the pop path behind insider.1 is named and emits, or a test on base shows a pop path that cannot emit.

What this change ships

Inventory (9 items) — 8 justified

Intent: 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.

  1. A session with only queued children leaves the board's Working lane and loses the live-work checks — justified
  2. Rows with only queued children show a static Hourglass badge: "Waiting for free RAM" for memory waits, "N agents queued" otherwise — justified
  3. Slot rows carry a new subagents_queued field, summed per tab — justified
  4. A queued-depth frame now triggers the debounced slots push — justified
  5. The client resets its queued counts from every WS slots push — justified
  6. A child start or end re-reads and republishes a parent's held depth — symptom-level, cause path unnamed
  7. A subagent_queued frame carries its tab's sum, not just its own parent's depth — justified
  8. ⌘W close still asks for confirmation when only queued children exist — justified
  9. The published-depth table is capped at 1024 parents and forgotten on teardown — justified

[FIRST-PRINCIPLES-REVIEWED] 1e0ef69

Description read

[DESCRIPTION-READ] 2a47dadd30908ba31d263b0441f29931bccafbdca60ed7e165582633fcf9a5e2

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 1e0ef695255a308da0dc99e0bc75da13b878f258 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 1e0ef69

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 1e0ef695255a308da0dc99e0bc75da13b878f258: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 3, 2026
@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 1e0ef695255a308da0dc99e0bc75da13b878f258 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 1e0ef69

Verdict parsed from the review's SHA-scoped output markers for commit 1e0ef695255a308da0dc99e0bc75da13b878f258.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 1e0ef695255a308da0dc99e0bc75da13b878f258: <one-sentence reason>

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 3, 2026
@bolichen97
bolichen97 force-pushed the fix/dashboard-queued-from-slot-state branch from 499853b to 1cb15aa Compare October 3, 2026 16:14
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 3, 2026
@bolichen97

bolichen97 commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Superseded by the per-finding disposition records on head 7c1b250 (one comment per finding).

UX review dispositions (carried from 499853b to 1cb15aa)

  • BLOCK, evidence gaps (badge memory-wait state, cap-wait state, queued-only board lane). Owed, not disputed. This PR stays in draft until fix(dashboard): retire a gone spawn approval everywhere #13881 merges, and the screenshots get captured through the screenshot-evidence flow before it leaves draft. This push changes no rendering beyond what the reviewed head had: memory_pressure now also counts as a memory wait.
  • Watch: "Waiting for memory" could be read as the Memory feature. Kept as is. The maintainer ruling on this PR names the badge "Waiting for memory". The tooltip on the badge is the gate's own sentence, which names free host memory in GB, and the row shows no Memory-feature icon or link. If the screenshots show the confusion in practice, the label is one i18n key (pages.chatSidebar.waiting_for_memory) to rename.
  • Watch: a memory wait drops N from the row. Deliberate. The count stays on the sub-agent progress bar and in the tooltip. A cap wait keeps "N agents queued" because the count is the information there, while for a memory wait the cause is. Revisit together with the screenshots.

Design review disposition: the BLOCK is the same missing rendered evidence. It is owed before this PR leaves draft (see above), not disputed.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased onto main (now including #16191), pushed 1cb15aa as one commit. Authorship and the Co-authored-by trailer are unchanged.

  • Conflicts resolved in subagent.md, dashboard/state.py, ChatSidebar.tsx and subagentQueuedReason.ts. Both sides were kept.
  • Semantic merge with fix(subagent): veto macOS starts under kernel memory pressure #15876: isMemoryWait now includes the new memory_pressure kind (macOS kernel hold), with a board test that fails without it.
  • Semantic merge with fix(subagent): keep the queued count exact and cheap #16191: the lifecycle-edge re-derive used to send a second, identical depth frame after a stop that had already emitted, which failed test_stopping_a_row_held_only_by_the_store_publishes_the_depth[on-loop] ([1, 1] == [1]). The edge now asks the per-parent burst for a heal read, which publishes only a changed depth. New witness: test_a_lifecycle_edge_that_agrees_with_the_published_depth_sends_nothing. Spec and module docstring are updated.
  • Local gate: black, subprocess-encoding, isort, flake8, full mypy, docs-lint and harness-parity all pass. Targeted backend tests pass (4098, across every test file that touches the queue depth, serialize_slots or _fire_event). Targeted frontend tests pass (2306) and tsc passes.

Still a draft: #13881 has not merged, and the screenshots are still owed.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 3, 2026
@bolichen97
bolichen97 force-pushed the fix/dashboard-queued-from-slot-state branch from 1cb15aa to f1eb3eb Compare October 4, 2026 10:09
@bolichen97

bolichen97 commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Superseded by the per-finding disposition records on head 7c1b250 (one comment per finding).

Design review dispositions (findings on 1cb15aa, carried to f1eb3eb)

  • BLOCK: no rendered evidence of the Hourglass badge or the board lane. Owed, not disputed. fix(dashboard): retire a gone spawn approval everywhere #13881 has not merged, so this PR stays a draft. The screenshots (memory wait and cap wait, light and dark, and a queued-only session filed outside Working) get captured through the screenshot-evidence flow before it leaves draft. This push is a rebase only and changes no rendering.
  • Watch: the Goal claimed a stale count on any session heals, while judgement call 2 says a server-side ghost with no lifecycle edge does not. Fixed in the description. The Goal now scopes the heal to a count the client holds because it missed or misapplied a frame. It names a server-side ghost (a published depth with no emit and no child start or end after it) as out of scope and points to judgement call 2. Most of those no-emit paths are now closed by fix(subagent): stop counting resume entries and orphaned overflow as queued #16395 (G7 / U6), which this branch is rebased on. Its resume-grant re-publish goes through _fire_event (run.py _queue_depth_burst), so the published table records it.

UX review dispositions (carried from 1cb15aa)

  • BLOCK: evidence gaps. Owed before this PR leaves draft, as above.
  • Watch: "Waiting for memory" could be read as the Memory feature. Kept, for the reasons in the 1cb15aa disposition: it is the maintainer-ruled label, and the tooltip is the gate's own free-RAM sentence. The screenshots are where to check it. The rename is one i18n key if they show the confusion.

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

@bolichen97

Copy link
Copy Markdown
Contributor Author

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.

  • One conflict, in subagent.py cancel_for_teardown. Both sides are kept: the published-depth forget runs first, then fix(subagent): stop counting resume entries and orphaned overflow as queued #16395's teardown fence wraps the cancel.
  • Description: the Goal now scopes the heal to client-missed frames (the design review's Watch), and "Not a goal" notes that G7 / U6 merged as fix(subagent): stop counting resume entries and orphaned overflow as queued #16395.
  • Local gate: black, isort and flake8 on the touched files; the black and subprocess-encoding gates; full mypy; docs-lint; harness-parity; and tsc all pass. Targeted backend tests pass (1064: queue depth, published depth, reconcile, slots, gateway, stop/cancel, admission). Targeted frontend tests pass (2531: ChatSidebar, the useWebSocket reconcile, keyboard shortcuts, chatSlice, the chat and sidebar modules).

Still a draft, because #13881 has not merged. The screenshots are owed before it leaves draft.

@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 4, 2026
@bolichen97
bolichen97 force-pushed the fix/dashboard-queued-from-slot-state branch 2 times, most recently from 0a97005 to 7c1b250 Compare October 4, 2026 23:12
@bolichen97

bolichen97 commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=38b73ef0c2a3 memory-specific label rides along.

Disposition: rebutted

The label is in the goal, not beside it: mainline-plan U7 / gap G8 is titled "Working lane from parent-turn state plus a separate 'Waiting for memory' badge", and both earlier UX rounds on this PR judged the badge's wording. isMemoryWait is the one predicate that picks that label; a cap wait keeps the existing "N agents queued" text.

@bolichen97

bolichen97 commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=556a79e54f26 Waiting session filed under IDLE.

Disposition: rebutted

This is the goal of the PR (acceptance F5): a session whose children are only queued has nothing running, so it must not sit in Working. IDLE is the derived lane for "no live work"; the row keeps its static Hourglass badge so the reason travels with the card, and the full wait sentence is its tooltip. The truncation in shot-03 is the board column's existing card width, the same clipping every status line gets there; widening board cards is out of this PR's scope.

@bolichen97

bolichen97 commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=b418d8246ab3 Badge offers no next step.

Disposition: rebutted

The badge is a one-line status in a dense sidebar row; the next step already exists one click away: the session's progress strip says "free up memory to continue" and offers Stop all, and the badge's tooltip carries the same sentence. Putting remediation copy on the row itself is new surface beyond this fix's goal (stop mis-filing queued sessions as Working).

@bolichen97

bolichen97 commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=c8e29db13d40 Wait sentence after a child starts.

Disposition: rebutted

shot-04's sentence comes from the capture harness, not the product: the harness pushed a synthetic subagent_queued frame with available_gb: 4 to stage the "child started" state. The real gateway attaches the reason measured by the admission gate that is still holding the remaining rows. Keeping the label while the queued count is above 0 is existing behaviour (ported from #13921), and this PR does not change the strip.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • span=004bbb40fd4d The Idle lane contradicts its own cards.

Disposition: rebutted

Moving these sessions out of Working is the point of this PR (acceptance F5). A maintainer ruled on it in this PR's first comment: a session whose children are only queued is not Working. The board has four derived lanes, and Idle is the one for "nothing is running". The card keeps its static Hourglass badge, so the reason a session is waiting travels with the card. A lane hint or a new sort order inside Idle would change the board's lane model, which is outside this fix.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • span=94c556b9290a "Waiting for free RAM" doesn't tell the user what to do.

Disposition: rebutted

The badge is a one-line status in a dense row. The tooltip is not the only place the explanation lives. Opening the session (click, tap or keyboard) shows the progress strip, which spells out the full sentence ("needs 3GB of free memory, 1.4GB free now; free up memory to continue") and offers Stop all. That strip is existing copy this PR does not change. Adding remediation text to the row itself would be new surface, beyond this fix.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • span=ae1fb4e37973 Rename the label to "Starts when memory frees up".

Disposition: rebutted

Two earlier UX rounds on this PR already shaped this label: "Waiting for memory" read as the agent's memories, so it became "Waiting for free RAM". "Waiting" already says the system holds the start and will resume it without the user. A third rewording across all 13 catalogs would trade one reader's preference against the earlier rounds without closing a defect.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • span=4f921b232116 Give the memory wait its own icon.

Disposition: rebutted

The icon encodes the row's STATE: children accepted but not started, no pulse. Both waits are that state. The cause is carried by the text, which differs ("Waiting for free RAM" against "2 agents queued"), and by the tooltip. A second icon would make the icon mean the cause on this one row type and the state on every other status line in the sidebar.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • span=747de8198a74 The memory-specific label is oversized.

Disposition: rebutted

The label is part of the goal: mainline-plan unit U7 / gap G8 is titled "Working lane from parent-turn state plus a separate 'Waiting for memory' badge". The maintainer ruling in this PR's first comment names the badge too ("it shows the separate Waiting for memory badge instead"). isMemoryWait is the one predicate that picks that label, and a cap wait keeps the existing "N agents queued" text.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • span=afa9faa72828 The MAX_PUBLISHED_PARENTS cap guards a hypothetical.

Disposition: rebutted

Here is a path that leaks past both teardown and the heal. When a parent's final depth read hits an unreadable store, _arm_queue_depth_retry retries a bounded number of times, then logs "its card keeps its last count" and stops, so the non-zero entry stays. The heal fires only on a LATER child edge of that same parent. Cron runs publish under per-run keys (cron:<job>:<run>), and a finished run never gets another edge, so each such entry stays for the life of the gateway, and a new key is minted on every firing. The cap turns that into a bounded table on a long-running gateway. It costs one length check per non-zero record.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • span=01601ed122ca A heal burst disarms an armed retry without publishing.

Disposition: fixed

Confirmed. _queue_depth_burst now checks for an armed re-read before it disarms one. If a re-read is armed, the burst merges that re-read's batch_ids into the waves it answers and publishes, so a new wait label at an unchanged count still reaches the card. New test: test_queue_depth_reconcile.py::test_a_heal_that_answers_an_armed_retry_still_publishes_the_frame_it_owed. Without the fix it fails on both pump modes ([] == [{'queued': 2, 'reason': 'adaptive_cap_zero'}]). The spec paragraph in subagent.md is updated. The fix is committed locally and goes out with the next push.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Disposition: rebutted: PASS note, a gateway restart while queued store rows remain.

After a restart, the slot list reports what THIS gateway has published, so a live client and a reloaded client agree. Before this PR, a reloaded client also showed 0 until the next emit, so this is no regression against a reload. The count returns with the next real emit for that parent: an admission, a pump pop, or a child start or end through the heal.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 5, 2026
@bolichen97
bolichen97 force-pushed the fix/dashboard-queued-from-slot-state branch from 2c70c1b to 1e0ef69 Compare October 5, 2026 11:31
@bolichen97

bolichen97 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=85733ff93f32 Queued sessions look misfiled under IDLE. (repeats a finding on the previous head)

Disposition: rebutted

Moving these sessions out of Working is the point of this PR (acceptance F5). A maintainer ruled on it in this PR's first comment: a session whose children are only queued is not Working. The board has four derived lanes, and Idle is the one for "nothing is running". The card keeps its static Hourglass badge, so the reason a session is waiting travels with the card. A lane hint, a fifth column or a new sort order inside Idle would change the board's lane model, which is outside this fix.

@bolichen97

bolichen97 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=ce8bba00cc17 "Waiting" now means two different things on one board. (repeats a finding on the previous head)

Disposition: rebutted

The two strings name their subject: "Waiting on you" is a lane heading about the user, "Waiting for free RAM" is a row badge about the host. The badge is a one-line status in a dense row, and the tooltip is not the only place the explanation lives. Opening the session (click, tap or keyboard) shows the progress strip, which spells out the full sentence ("needs 3GB of free memory, 1.4GB free now; free up memory to continue") and offers Stop all. That strip is existing copy this PR does not change. Adding remediation text to the row itself would be new surface, beyond this fix.

@bolichen97

bolichen97 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=c53aea1871f5 Rename the label to "Starts when RAM frees up". (repeats a finding on the previous head)

Disposition: rebutted

Two earlier UX rounds on this PR already shaped this label: "Waiting for memory" read as the agent's memories, so it became "Waiting for free RAM". "Waiting" already says the system holds the start and will resume it without the user. A third rewording across all 13 catalogs would trade one reader's preference against the earlier rounds without closing a defect.

@bolichen97

bolichen97 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=ab01d10a6abe Use a different icon for the cap wait than for the memory wait. (repeats a finding on the previous head)

Disposition: rebutted

The icon encodes the row's STATE: children accepted but not started, no pulse. Both waits are that state. The cause is carried by the text, which already differs ("Waiting for free RAM" against "2 agents queued"), and by the tooltip. A second icon would make the icon mean the cause on this one row type and the state on every other status line in the sidebar.

@bolichen97

bolichen97 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=67dd1ada1eca The lifecycle-edge heal patches an unnamed no-emit path. (repeats a finding on the previous head)

Disposition: rebutted

The path is named, it is on base, and it cannot be made to emit. When the store cannot be read, _arm_queue_depth_retry re-reads a bounded number of times and then gives up with "queue depth for %s unreadable after %d retries; its card keeps its last count" (run.py on main). Base pins this in test_queue_depth_reconcile.py::test_a_store_that_stays_unreadable_gets_a_bounded_number_of_retries, which asserts that no depth frame is sent. Rows the lock hid can be stopped or popped while the store is unreadable. No emit at that moment can carry a correct count, and once the retries stop, nothing asks again. Before this PR the stale count lived in one client until a reconnect. Now the slot list re-sends the published entry on every slots push, including a reload's first frame, so the stale count would be re-asserted for the life of the gateway. The heal is that missing re-ask: one read at the parent's next child start or end, only while its entry is non-zero, and it publishes only when the count changed. must_publish is what keeps a heal that agrees with the held entry silent (test_a_lifecycle_edge_that_agrees_with_the_published_depth_sends_nothing). The owed-retry branch fixes the Opus finding 01601ed122ca on 2c70c1b: a heal that disarmed an armed re-read must send the frame that re-read owed (test_a_heal_that_answers_an_armed_retry_still_publishes_the_frame_it_owed, which fails without it). Removing all three would bring back the stale count this PR's table would otherwise make permanent.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Disposition: rebutted: PASS note, a slots push for an evicted or forgotten parent while its children are still queued.

Forgotten: cancel_for_teardown forgets the entry because the parent ended, and the same call stops that parent's queued runs and the store rows accepted before its snapshot. So 0 is the count the teardown is converging to. A row a successor queues during the teardown's awaits is spared, and its admission publishes a frame through _fire_event, which records the entry again. Evicted: this happens only once more than MAX_PUBLISHED_PARENTS (1024) parents hold queued spawns at the same moment. In that case the oldest entry reads as 0 until that parent's next frame (an admission or a pump pop), as the published_depth.py docstring and subagent.md state. The cap is what keeps the table bounded under the retry-exhaustion path named in the first-principles disposition. Before this PR a reloaded client showed 0 for every parent until its next emit, so this is no regression against a reload.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention labels Oct 5, 2026
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.

2 participants