fix(queue): preserve new user work across turn shutdown - #3212
Merged
Merged
Conversation
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.
Desktop Stop preserves a recoverable interruption, but the host-owned queue rejected the next prompt with
Queue is blocked by interrupted turn recovery. New work could also be accepted after a turn settled and then incorrectly parked by that turn's delayed interrupted/failed outcome.User submissions now supersede interruption through the existing admission path. Admission records which terminal turn preceded new work, so that turn's delayed cleanup cannot consume it. Held older messages stay intact for explicit retry/removal and no longer deadlock new user work; background work remains held. The host takes queue and receipt locks separately when selecting protected work.
“Send now” on a stopped session can explicitly start the chosen message. Failed admission preserves both the message and the interrupted turn's recovery state, and repeated operation IDs cannot execute twice. Desktop also provides a local copy-to-composer action for an unresolved draft after an owner restart, preserving attachments and context without sending, cancelling, or discarding its receipt.
Validation:
Scope and limits: Desktop and CLI peer adapters and the mobile relay handler were reviewed; they all delegate to the same host queue owner. Runtime tests use real scheduler/persistence with a model fixture, and browser tests simulate host RPC. No packaged desktop, physical phone, live SSH workspace, peer-device or detached-dispatch end-to-end run was performed. Wire and persisted shapes are unchanged; the admission bookkeeping is host-local.