Ticket #76 — state truth: stale working, streaming ghosts, queued user color, delegation order
Root causes and fixes
- Grey user messages. Queued user bubbles (mostly DMs while an agent is busy) used
colors.mutedfor the edge/header, so they read grey. They now usecolors.warn(amber) for edge/header while queued, withcolors.good(green) once sent; body stays readable. The user bubble now reads as colored rather than muted. - Stuck
working…. A parent leftawaitingChildrenafter all real children were terminal was never reconciled, and automatic completion-delivery hops were counted as synthesis children, so a fast child/auto-hop could leave a parentworkingwith no live run. AddedreconcileWaitingWork()and called it on snapshot, diagnostic, and pump paths: it clearsawaitingChildrenwith no live children, synthesizes/finalizes parents, re-queues staleworkingrows with no run/claim, and excludeshandoff.completionhops from synthesis children.maybeSynthesizeexcludes completion deliveries too. - Streaming ghost.
finalizeStreamepoch guards returned before clearing/persistingstreaming, leaving orphaned live rows until the 120 s age filter. Finalization now settles (clears streaming, persists) on both epoch paths and returnsundefinedonly as the staleness signal. AddedsettleTerminalStreams()on snapshot/diagnostic reads to settle any streaming message whose task is missing or terminal (interrupted only on failure/cancellation). The live activity partition also ignores streaming rows whose task is terminal. - Delegation order. Sequential user tasks and a delegated child+later-user-task now settle in order; red/green tests prove no stuck work. Empty/whitespace assistant replies are retried then fail visibly instead of finalizing as success or creating a completion handoff.
Verification
Environment: Node v26.12.1, host OpenCode v2.2.5 vs pinned types 2.2.1, Linux/tmux.
| Command | Result |
|---|---|
npm run check | exit 0 |
npm test | 374 passed, 0 failed |
npm run test:live:fake | passed (3 consecutive runs) |
npm run test:live:fake:empty | passed |
npm run test:live | passed |
No skips. Remaining uncertainty: user-bubble hue is visual (text capture cannot verify color); stale-run detection uses the in-process run map (single-process deployment); no macOS run; the queued-line count race is deterministic after the composer-cleared gate but relies on the harness settle.