You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(sidebar): recover a queued workspace drag after the PC's server restarts - #4696
A restart roster could arrive before a move receipt, then a later step failed. The following queued drag waited for a roster from the old boot, while the verification that could release it was deferred until all drags settled. If a proof was available, the retry could also take the wrong snapshot, and another drag could abort the only check before it sent a move.
Fix
Check the restart roster when a failed batch leaves the next drag waiting, preserving the existing admission rules. A later queued drag cannot cancel the check it also depends on. Use the freshest snapshot from the proven boot, not an older verification response or an old-boot event; following drags use the recovered workspace set. If the verification supplies no usable order, refuse the waiting drag instead of sending moves with an unconfirmed base.
Validation
bun test ./src/lib/workspaceOrder.test.ts: 49 passed after the follow-up; on main the new restart test had zero verification requests and the mid-batch proof test showed the old order.
Final head 0151b05e: CI=1 UNIT_TEST_WORKERS=6 bun run check fast passed on the isolated runner: 28,034 unit tests passed, 153 skipped; typecheck and build passed.
bun scripts/workspace-touch-reorder-demo-regression.ts passed in the CI runner image on the final head. The separate partial-failure/restart demo sent the queued move only after the fix on both screen widths.
Not run: check full or native QA.
Review notes
Codex ran once on 28b46293 and produced executable examples, but its session ended before a final review, so this is not a clearance. The single fix round covered an old-boot roster racing verification and a third drag using a workspace that had since closed. Those cases now pass in focused tests.
Holding for the owner to see the before/after captures at 1280 px desktop and 390 px phone, in Korean light mode. The authenticated attachment browser was unavailable; the four isolated demo captures are saved with the batch reports (evidence/E2-misc/order-*.png). Codex produced reproduction evidence for the follow-up but did not complete a final review.
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
Bug Fixes
Workspace order now recovers more reliably when a queued drag follows a failed move and the PC restarts. Subsequent workspace reordering can continue using the recovered order, rather than being blocked by stale ordering information.
ReorderCoordinator now retains restart-era roster evidence during pending moves, verifies and reconciles candidate snapshots, and uses a qualified recovered order to replay queued drags after a move batch fails. Regression tests cover old-boot reads, newer proofs, additional queued drags, and workspace closure.
Changes: Queued reorder recovery
Layer / File(s)
Summary
Roster and restart evidence src/lib/workspaceOrder.ts
OrderRead and hold state track accepted reads, in-flight evidence, and eligible restart reads. Older same-epoch reads are discarded, and rechecks consider retained restart evidence.
Verification and proof reconciliation src/lib/workspaceOrder.ts
Verification candidates can incorporate newer qualifying reads. Successful proofs reconcile the selected snapshot with protected epochs and waiting reorder operations.
Queued replay and regression coverage src/lib/workspaceOrder.ts, src/lib/workspaceOrder.test.ts, changelog.d/queued-workspace-recovery.md
Queued reorders use a qualified base and rebase their target after failures. Settlement clears recovery state. Tests cover restart reads, failed moves, and workspace closure; the changelog records the recovery fix.
devswha/ovis#4315: Handles restarted-PC roster reads that arrive before a move receipt, a scenario also covered by this reorder recovery change.
Merge Risk: Minimal · up to 11916
This change lets a workspace drag queued behind a failed move recover after a server restart, and refuses the move instead of sending it from an unconfirmed order. No concrete defect was established in the reviewed code. The one remaining concern is a narrow, unproven timing race, so merge risk is minimal.
Pre-merge checks: 3 · 1
Failed checks: 1 inconclusive
Check name
Status
Explanation
Resolution
Linked Issues check
Issue #4336 is the only directly linked issue. Its requirements are: C2 (restart roster before a receipt, then a failed step, must trigger recovery), R2a (retry base must come from the newest proven o…
Confirm that the reported checks ran at reviewed head 11916d4, or report results for that head. Confirm that the workspaceOrder.test.ts suite passes at 11916d4, including the issue's C2, R2a, R2b, and R3 schedules (the issue repro or equi…
Passed checks: 3 passed
Check name
Status
Explanation
Description check
The description follows the template's two required sections. The Change section (titled 'What broke' and 'Fix') explains the problem and the resulting behavior. The Validation section lists the comma…
Out of Scope Changes check
The reviewed diff changes three paths: changelog.d/queued-workspace-recovery.md (changelog entry), src/lib/workspaceOrder.test.ts (regression tests for queued drags after restart and failed batches), …
Title check
The title "fix(sidebar): recover a queued workspace drag after the PC's server restarts" matches the main change. The changeset adds ReorderCoordinator logic that recovers queued workspace drags after…
Full details: Description check
Explanation
The description follows the template's two required sections. The Change section (titled 'What broke' and 'Fix') explains the problem and the resulting behavior. The Validation section lists the commands run, their results, and the checks not run (check full, native QA). The template asks for a linked issue for features, and this PR is a fix. It links issue #4336 via 'Closes #4336'. The description uses headings that differ from the template's exact names ('Change' and 'Validation' are not used verbatim), but the content maps onto both required sections. The description also does not mention HTTP/WS contract-test coverage, which the template asks for when HTTP or WS changes are made. The raw summary does not show any HTTP/WS changes, so this gap is minor.
Full details: Out of Scope Changes check
Explanation
The reviewed diff changes three paths: changelog.d/queued-workspace-recovery.md (changelog entry), src/lib/workspaceOrder.test.ts (regression tests for queued drags after restart and failed batches), and src/lib/workspaceOrder.ts (ReorderCoordinator recovery logic). All changes relate to the queued-drag recovery in #4336. The test additions and the changelog entry support the same objective. No unrelated change was found in the inspected diffs. The file list was truncated, so the absence of other changed paths rests on the PR summary, which lists these three files only.
Full details: Title check
Explanation
The title "fix(sidebar): recover a queued workspace drag after the PC's server restarts" matches the main change. The changeset adds ReorderCoordinator logic that recovers queued workspace drags after a server restart during a failed batch, and the changelog entry describes the same fix. The title is specific and concise, and it follows a conventional commit format.
Full details: Linked Issues check
Explanation
Issue #4336 is the only directly linked issue. Its requirements are: C2 (restart roster before a receipt, then a failed step, must trigger recovery), R2a (retry base must come from the newest proven or qualified snapshot), R2b (an older proof must not override a newer same-boot read), R3 (a third drag must not cancel the second drag's only recovery check), and no verification spent on a pre-move roster read (R1). The diff of src/lib/workspaceOrder.ts adds the mechanisms: OrderRead storage, a restart read kept on Hold, a recheck in settle() and qualifiedBase(), waiters held until proof, a rebased target, and proved() choosing the newest same-boot snapshot. The diff of src/lib/workspaceOrder.test.ts adds four tests. Two test names match R2a and the restart case (the newer proven snapshot and the old-boot read before verification). The added tests do not reproduce the issue's C2, R2b, or R3 schedules as written; the R3 test uses a third drag but is a different schedule. I could not run the tests. The PR description reports final head 0151b05, but the reviewed head is 11916d4. The reported test results therefore may not apply to the reviewed head. Whether recheck() avoids spending the per-PC interval before a move in every path is not established by the diff.
Resolution
Confirm that the reported checks ran at reviewed head 11916d4, or report results for that head. Confirm that the workspaceOrder.test.ts suite passes at 11916d4, including the issue's C2, R2a, R2b, and R3 schedules (the issue repro or equivalent tests). Show that a pre-move roster read does not call verify() and spend the PC verification interval (R1).
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Reviewing files that changed from the base of the PR and between b0f20e7 and 11916d4.
Files selected for processing: 3
changelog.d/queued-workspace-recovery.md
src/lib/workspaceOrder.test.ts
src/lib/workspaceOrder.ts
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 0 remain after this review.
Removing the screenshot hold: the gate review confirmed no new controls or layout. The only visible fallback is the existing “Reorder failed” notice. Both pre-verification races failed before the fix and now pass; all 51 focused tests, check fast, and the isolated touch-reorder browser regression passed.
devswha
changed the title
Recover queued workspace drags after a server restart
fix(sidebar): recover a queued workspace drag after the PC's server restarts
Nov 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
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.
What broke
A restart roster could arrive before a move receipt, then a later step failed. The following queued drag waited for a roster from the old boot, while the verification that could release it was deferred until all drags settled. If a proof was available, the retry could also take the wrong snapshot, and another drag could abort the only check before it sent a move.
Fix
Check the restart roster when a failed batch leaves the next drag waiting, preserving the existing admission rules. A later queued drag cannot cancel the check it also depends on. Use the freshest snapshot from the proven boot, not an older verification response or an old-boot event; following drags use the recovered workspace set. If the verification supplies no usable order, refuse the waiting drag instead of sending moves with an unconfirmed base.
Validation
bun test ./src/lib/workspaceOrder.test.ts: 49 passed after the follow-up; on main the new restart test had zero verification requests and the mid-batch proof test showed the old order.0151b05e:CI=1 UNIT_TEST_WORKERS=6 bun run check fastpassed on the isolated runner: 28,034 unit tests passed, 153 skipped; typecheck and build passed.bun scripts/workspace-touch-reorder-demo-regression.tspassed in the CI runner image on the final head. The separate partial-failure/restart demo sent the queued move only after the fix on both screen widths.check fullor native QA.Review notes
Codex ran once on
28b46293and produced executable examples, but its session ended before a final review, so this is not a clearance. The single fix round covered an old-boot roster racing verification and a third drag using a workspace that had since closed. Those cases now pass in focused tests.Closes #4336