Skip to content

fix(sidebar): recover a queued workspace drag after the PC's server restarts - #4696

Closed
devswha wants to merge 3 commits into
mainfrom
fix/queued-workspace-recovery
Closed

devswha wants to merge 3 commits into
mainfrom
fix/queued-workspace-recovery

Conversation

@devswha

@devswha devswha commented Nov 25, 2026

Copy link
Copy Markdown
Owner

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.
  • 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.

Closes #4336

@devswha devswha added the hold Not merged until the owner says so label Nov 25, 2026
@devswha

devswha commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

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.

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Explain Change →

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.

Estimated code review effort: 4 (Complex) | ~40 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related PRs

  • 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: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive 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 Passed checks: 3 passed

Check name Status Explanation
Description check Passed 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 Passed 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 Passed 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.

Share

Recent review info

Run configuration

Commits

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.

@devswha

devswha commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

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 devswha removed the hold Not merged until the owner says so label Nov 25, 2026
@devswha 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
@devswha

devswha commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #4724

@devswha devswha closed this Nov 25, 2026
devswha added a commit that referenced this pull request Nov 25, 2026
…nd phone history (#4724)

## Source changes

### [#4682](#4682)

- **Fix:** Test only: hold the demo opening turn and unquarantine the
touch-reorder regression.
- **Reproduction:** On a pinned-row drag, firing the opening-turn finish
between arming the touch probe and pressing put the finish droplet under
the finger; no row lifted.
- **Review:** CodeRabbit reviewed `f14029ee`; it skipped the later
merge-only head because automatic incremental reviews are disabled. No
Codex review for this test-only change.

Closes #4343

### [#4696](#4696)

- **Fix:** Recover a queued workspace drag against the newest proven
order after a PC restart.
- **Reproduction:** A restart roster arrived ahead of the move receipt,
then a later step failed. The next drag stayed parked without a
verification request; other schedules showed the old workspace order.
- **Review:** Codex supplied executable cases on `28b46293` but did not
finish its review. The gate review cleared the follow-up and CodeRabbit
reviewed `11916d42`.

Closes #4336

### [#4705](#4705)

- **Fix:** Prioritize small retries for omitted inbox summaries without
shrinking fresh batches.
- **Reproduction:** A deterministic 24-row batch on main ended with 23
summaries because rows at the tail spent retries before reads began. The
limited-budget browser fixture reproduced missing summaries.
- **Review:** Codex reviewed `67abacb86`, and the gate review cleared
`d1384ffd`. CodeRabbit was rate-limited.

Refs #3817 (fixes its first item; the deferred follow-ups stay open
there)

### [#4695](#4695)

- **Fix:** Cancel a stale question push or queued webhook when a moved
pane is already working; keep tracked or still-blocked questions.
- **Reproduction:** The hub test received a pending question for the new
pane ID after the move had already reported working.
- **Review:** Codex reviewed `0f1e19ac2`; its tracked-agent and webhook
findings were fixed. The gate review identified the pre-existing
event-order issue tracked in #4709. CodeRabbit was rate-limited.

Closes #4239

### [#4708](#4708)

- **Fix:** Keep pane, sheet and Settings history on the entries they
own.
- **Reproduction:** Isolated Chromium cases covered a refused Back whose
return did not land, a silent Back commit that left a later sheet
stranded, and widening Settings over the Devices confirmation.
- **Review:** Codex reviewed `5bde4bd4`; three reproduced findings were
fixed and rechecked. The gate review confirmed no control, copy, styling
or layout change. CodeRabbit was rate-limited.

Refs #4400 (partly: a remaining case is on the issue)
Refs #4393 (partly: a remaining case is on the issue)
Closes #4391

The phone-history change follows the original comparison with [T3 Code’s
separate Devices
route](https://github.com/pingdotgg/t3code/blob/main/apps/web/src/routes/_chat.settings.devices.tsx):
Ovis keeps Settings as an overlay but preserves its separate history
entries.

Supersedes #4682 #4696 #4705 #4695 #4708

## Phone history: before and after

Korean light-mode captures from the original phone-history PR.

| Scenario | Before | After |
| --- | --- | --- |
| Settings, desktop 1280 | <img width="420" alt="Settings resets to
Appearance"
src="https://raw.githubusercontent.com/devswha/ovis/aa9ec2028f15be01c944fd4d06c513398addf318/4391-before/settings-confirmation-1280.png">
| <img width="420" alt="Devices and confirmation stay open"
src="https://raw.githubusercontent.com/devswha/ovis/aa9ec2028f15be01c944fd4d06c513398addf318/4391-after/settings-confirmation-1280.png">
|
| Settings, phone 390 | <img width="230" alt="Settings returns to its
list"
src="https://raw.githubusercontent.com/devswha/ovis/aa9ec2028f15be01c944fd4d06c513398addf318/4391-before/settings-confirmation-390.png">
| <img width="230" alt="Devices and confirmation stay open"
src="https://raw.githubusercontent.com/devswha/ovis/aa9ec2028f15be01c944fd4d06c513398addf318/4391-after/settings-confirmation-390.png">
|
| Back after closing a sheet, desktop 1280 | <img width="420" alt="Back
stays in Ovis"
src="https://raw.githubusercontent.com/devswha/ovis/aa9ec2028f15be01c944fd4d06c513398addf318/4393-before/sheet-back-1280.png">
| <img width="420" alt="Back reaches the previous page"
src="https://raw.githubusercontent.com/devswha/ovis/aa9ec2028f15be01c944fd4d06c513398addf318/4393-after/sheet-back-1280.png">
|
| Back after closing a sheet, phone 390 | <img width="230" alt="Back
stays in Ovis"
src="https://raw.githubusercontent.com/devswha/ovis/aa9ec2028f15be01c944fd4d06c513398addf318/4393-before/sheet-back-390.png">
| <img width="230" alt="Back reaches the previous page"
src="https://raw.githubusercontent.com/devswha/ovis/aa9ec2028f15be01c944fd4d06c513398addf318/4393-after/sheet-back-390.png">
|

## Validation

- Focused suites: workspace order **51**, inbox **127**, moved-pane
alerts **198**, and phone history **143** passed (519 total).
- `bun run typecheck` passed.
- `git diff --check` passed; all ten non-merge commits match their
original stable patch IDs.
- In `herdr-ci-runner:local`, the build and all four demo browser
regressions passed: `workspace-touch-reorder`, `inbox-mode`,
`phone-back`, and `settings-pages`.
- Three additional CI-image browser regressions passed:
`inbox-mode-panes`, `inbox-mode-rail`, and `sheet-outside-tap`.
- `CI=1 UNIT_TEST_WORKERS=6 bun run check fast`: workflow syntax,
generated types/themes, typecheck and build passed; unit tests reported
**27,979 pass, 2 fail, 247 skip**. Both failures
(`server/ssh-account-add.test.ts`: confirmed host key;
`scripts/plugin-tui.test.ts`: fallback `HOME`) reproduce on unchanged
`main` (`b0f20e7bc`) with the same long `TMPDIR`. With a short real
`TMPDIR`, the same two cases pass on both `main` and the bundle (2/2
each). No full rerun with the shorter path.
- `check full`, full integration, and native-device QA were not run.

---------

Co-authored-by: sisyphus-dev-ai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workspace reorder: a drag queued behind a partly failed batch stalls or falsely succeeds after the PC's server restarts

1 participant