Repository navigation
Description
What happened
A thread that is queued or waiting loses its detail stream while the composer still shows connecting/running with Stop. The web keep-alive check only treats preparing, starting, and running as active, so queued and waiting threads are considered done and their subscription is closed early. Updates then arrive late or not at all until the next refresh.
Diagnosis
Grounded in source at upstream/main@cfdff56f7b:
- apps/web/src/state/threads.ts:53-54 isRunning checks only preparing, starting, running.
- apps/web/src/state/threads.ts:61-67 isDetailDone and :92-96 runningThreadIdsAtom both use isRunning, so queued/waiting threads are excluded from keep-alive.
- packages/contracts/src/orchestrationV2.ts:446-456 RunStatus includes queued and waiting as live run states.
- packages/client-runtime/src/state/models.ts:78-85 threadRunStatusIsActive includes preparing, queued, starting, running, waiting.
- apps/web/src/session-logic.ts:1005-1013 derivePhase maps queued to connecting and waiting to running, so the UI shows a spinner and Stop while keep-alive has already closed the stream.
The narrower keep-alive predicate was introduced with the orchestrator V2 merge de34391.
Steps to reproduce
- Start a turn with queue mode so the follow-up run sits as queued, or reach a waiting run state.
- Observe the composer showing connecting/running with Stop available.
- The thread detail subscription is already treated as done, so live updates stop until a manual refresh or the next run transition.
Version
upstream/main@cfdff56f7b, post orchestrator V2 merge de34391; checked 2026-10-04.
Environment
Repo checkout on Windows x64, verified via git show upstream/main. Client-side defect affecting web and desktop.
Evidence
- apps/web/src/state/threads.ts:53-54,61-67,92-96
- packages/contracts/src/orchestrationV2.ts:446-456
- packages/client-runtime/src/state/models.ts:78-85
- apps/web/src/session-logic.ts:1005-1013
Verified via source reads only.
Related issues
- [BUG] V2 waiting run keeps showing Agent is working and offers Stop for finished work when checkpoint capture stalls #15124 V2 waiting run keeps showing working when checkpoint capture stalls - waiting-state presentation, not keep-alive subscription teardown. Not duplicate.
- Searched open issues for keep-alive, isRunning, queued waiting detail stream: no match.
Fix applied or workaround
None. Possible direction: include queued and waiting in the keep-alive active check to match threadRunStatusIsActive and derivePhase.
Activity
juliusmarminge commentedon Oct 3, 2026
Note
Grok responding on behalf of Julius.
Triage
Thanks @ANSHSINGH050404 for the detailed source walk-through. The predicate difference you found is real, but it's the desktop keep-alive's documented scope rather than the stream the composer reads.
What keep-alive does
RunningThreadKeepAliveis mounted only in the Electron shell (apps/web/src/routes/__root.tsx); web and mobile don't keep background threads subscribed. Its job (docs/internals/connection-runtime.md) is to keep threads whose session is starting or running mounted, so opening one doesn't replay.isRunninginapps/web/src/state/threads.tsis that set:preparing,starting,running.ChatViewmounts the detail atom itself throughuseThreadProjection,useThreadStatus, anduseThreadVisibleTurnItems, so keep-alive releasing a thread doesn't close the stream the composer is reading. Phase and Stop come over the shell stream either way.queuedandwaitinguse different predicates.derivePhasemapsqueuedto connecting andwaitingto running, and Stop stays available while an earlier run is still interruptible.waitingis the short post-success state until checkpoint capture commitscompleted(see [BUG] V2 waiting run keeps showing Agent is working and offers Stop for finished work when checkpoint capture stalls #15124), not a live provider session.threadRunStatusIsActiveis the sidebar/archive notion of "not settled", not the keep-alive set.A narrower case that could be a bug
Keep-alive keys off the shell's latest-run
status, notactivityRunStatus. These differ when a later run isqueuedwhile an earlier one is stillpreparing/starting/running. A desktop that connects in that state won't pre-mount the thread, so its first open loads a snapshot. A thread that was already running stays held until that activity run leaves those statuses.What would help
The report is based on reading
isRunningand doesn't yet show the open composer missing events. If you've seen a desktop thread that was actively streaming, with a queued follow-up, stall until a manual refresh, please add:statusandactivityRunStatuswhile it was stalledA maintainer will decide on the fix direction.
ANSHSINGH050404 commentedon Oct 3, 2026
Follow-up from the triage note, verified against upstream/main:
juliusmarminge commentedon Oct 12, 2026
Note
Grok responding on behalf of Julius.
Fixed by #15293, merged to
main. Desktop keep-alive now treats aqueuedshell run as active, so a thread with a follow-up queued behind an active run stays pre-mounted when the desktop connects. As agreed above,waitingstays out of the keep-alive set because it's the short post-success state before checkpoint capture commits. If you still see a live stall on the open thread, please open a new issue with the shellstatusandactivityRunStatus.