Repository navigation
fix(server): count deferred archive and switch supersession from request time - #233
Merged
Merged
Conversation
…art order Deferred archive and worktree switch compared run creation ordinals, so a queue reordered past an edit-held message cancelled requests wrongly or applied a switch while the older run was active. Runs now record a per-thread startSequence when they enter execution, requests record the latest one, and a sent message explicitly cancels a pending switch.
…tart stamps Review follow-up: any queued run cancels a pending switch (it would start in the old checkout's scope, and racing the scheduler otherwise), the boundary replaces per-run start sequences, and a prepared-run retry cancels a pending archive or switch.
pandec
marked this pull request as ready for review
October 7, 2026 08:02
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 53 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (8)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Deferred thread archive and deferred worktree switch decided "superseded by new work" by comparing run creation ordinals against the requesting run. Reordering the queue past an edit-held message runs messages out of creation order. An archive or switch requested by the older run was then cancelled because a newer-created run had already finished before the request. A switch requested by the newer run while the older one was held could also apply later, while the older run was active, detaching its provider session.
Fix:
latestRunOrdinal, the thread's highest run ordinal at request time (optional key in the threadpayload_json). Only runs created after it count as new work, so a later-created run that already ran before the request no longer cancels. Archive keeps its wake lineage, and requests from before this change fall back to the old comparison.runRanAfter), so neither depends on creation order.Tests: decider unit tests for reordered history, legacy requests, withdrawn-wake fallback and restart continuation. Orchestrator integration tests cover a reordered, edit-held queue (switch cancel and apply, archive apply), steering that cancels a switch, and a retry that cancels both.
Model: Claude Opus 5.5 (Claude Code via T3 Code)