Repository navigation
fix(claude-queue): settle proven queue debt at bootstrap-complete (#677) - #1396
Draft
Juliusolsson05 wants to merge 6 commits into
Draft
Juliusolsson05 wants to merge 6 commits into
Juliusolsson05 wants to merge 6 commits into
Conversation
…ure from disk (#677) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n debt covers every live item (#1396 review a) Idleness is not proof the queue drained: between turns, or on a resumed pane's first replay-quiet tick, a genuinely queued item was marked stale. The two new sites now settle only when logged departures account for every live pending item. The semantic site keeps its existing guard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…livery residual (#1396 review a round 2) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s-idle site (#1396, manager option B) A redelivered dequeue can make the debt cover a genuinely queued prompt; at a live process-idle flip that hides a real queued user prompt. The process-state handler is back to main's; a removed-site test pins it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Sep 27, 2026
Owner
Author
Review disposition (head cb17181). HELD under q101, parked behind #1402Status: this PR does not merge in its current form.
Why parked, not narrowed further: nothing observable at bootstrap distinguishes the recorded fixture from redelivery. Queue-operation records carry no uuid (corpus: 606 transcripts, 2,391 dequeues, 99 genuine same-millisecond repeats). #1402 proposes counting departures once (retire only items enqueued before the current process started, a provable departure). If B6 accepts that direction, this PR closes in its favour, or is rebuilt on top of it. Never: retire a real queued prompt to make the chip state tidier (B6, option B). |
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.
HELD behind #1402 (manager q101). Refs #677.
The bootstrap guard
debt >= pendingcan still retire a genuinely queued prompt when adequeueis redelivered. The counterexample is committed as anit.failstest, 'does not retire a still-queued prompt at bootstrap when a dequeue is redelivered (#1402)'. Nothing observable at bootstrap distinguishes it from the recorded fixture, so this PR cannot merge until #1402 makes each departure countable once. Then the test flips toitand must pass.Plan:
docs/plans/2026-09-27-claude-queue-idle-settlement.md.Problem
markStaleWhenIdleis how Claude queue debt settles and how unattributed survivors are marked stale. Its only live call site was a semantic event arriving while the session was already idle. Production bootstrap receives no replayed semantic events, so a replay that ended with open debt kept its chips indefinitely. The recordedexact-remove-after-open-dequeue-debtrun ends with 3 pending items anddebt.count = 3.What merges
settleClaudeQueueIfIdle, but only when (a) there is no live signal (!processActive && streamPhase === 'idle') AND (b) the open departure debt (debt.count + removeDebt.count) is at least the number of pending items, stale ones included (debtCoversPending). Each debt unit is a departure Claude logged whose item was not identified, so every pending item has left and nothing is left to stale-mark. The result is committed toclaudeQueueBySessionaftersetRuntimesreturns.dequeuedouble-counts debt. Queue-operation records have no uuid, and the local corpus has genuine same-millisecond repeats, so there is no key-based guard. At a live flip, a phantom unit could hide a genuinely queued user prompt. That half of bug(claude-queue): idle debt settlement is only reachable from a semantic event #677 is blocked on bug(claude-queue): a redelivered dequeue/remove double-counts queue debt #1402.Review history
Tests
claudeQueueIdleSettlement.renderer.test.tsxdrives the realuseIpcSubscriptionsthrough the fake session feed:userentry must not bring an item back);Fail-first and mutations, each killed:
85f7ee0c);Blocker: the redelivery double-count (#1402) also retires a queued prompt at bootstrap (pinned
it.fails). It still affects the existing semantic site and committed-userinference, as it does on main.Gates:
npx tsc -b+src/renderer/src/workspace/hook/ipc+src/renderer/src/session-runtime/claudeQueueon543e1412(14 files, 145 tests).🤖 Generated with Claude Code