Repository navigation
fix(activity): close stuck flags from JSONL replay at bootstrap_complete - #53
Merged
Merged
Conversation
Diagnosed via debug bundles that 11 panes reported sessionStatus="running" after
restart despite having no live signal (processActive=false, streamPhase=idle,
activityStatus=null). Two distinct shapes:
- Claude: queue-op replay (enqueue → ... → remove pairs from old turns) sets
awaitingAssistant=true on enqueue but never clears it when the queue empties
via remove. Live operation gets a turn_completed semantic event that clears
via clearOptimisticAwaiting; replay does not, so the flag stays true.
- Codex: rollout-sourced turn_started opens semantic.currentTurn but the
matching turn_completed/turn_stopped never fires during replay, so
isSemanticTurnRunning stays true and deriveSessionStatus returns 'running'.
Reconcile both at the bootstrap_complete callback (after the 150ms quiet
window, i.e. when replay has finished). Only acts when there's no live signal.
This was referenced Sep 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root cause for panes reporting
sessionStatus="running"after restart despite no live activity (sometimes for days):turn_startedopenssemantic.currentTurnduring replay, but the matchingturn_completed/turn_stoppednever fires, soisSemanticTurnRunningstays true →sessionStatus = 'running'permanently.awaitingAssistant = trueon enqueue but never clears it on remove. Live ops clear viaclearOptimisticAwaiting; replay does not.Reconcile both at the
bootstrap_completecallback (after the 150ms JSONL-quiet window, i.e. replay is done). Only acts when there is no live signal (processActivefalse,streamPhaseidle).Verified against this user's debug bundles: today's app run has 22 sessions with unmatched
turn_startedevents — 21 from Codex rollout, 1 from Claude proxy.Verification
🤖 Generated with Claude Code