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(wsl-mover): settle an interrupted move automatically, and hold the host's server update during a move - #34823
Two fixes for a WSL project move that gets interrupted, found in the audit behind #34813:
If Orca is quit, crashes or updates at one specific moment of a move (after the copy is sent, before the WSL host confirms it), the projects stay read-only after restart. Orca's automatic mover kept retrying without ever fixing it; only starting the move again by hand did. Now the automatic mover checks with the host and either puts the earlier move back (the projects come back right away) or, when the host already has it, records that so the next start finishes it before any window opens.
Updating the WSL host's server in the middle of a move cut the move off. Now, while a move is underway, the host keeps its running server, and the update waits until the move finishes.
What Changed
Interrupted commit, before:
A blobs-transferred record (copy sent; the commit may or may not have reached the host) can't be resolved at startup, which has no host to ask, so the projects stay fenced.
The automatic mover's step always previews first. The preview refuses an in-flight move (wsl_move_already_in_flight), and the orchestrator retries that as an uncounted transient forever, never reaching the start that would settle it.
Interrupted commit, after:
previewWslMove takes { settleInterrupted: true }, which only the automatic mover's wiring passes. It runs the same settle step a move start runs (settleInterruptedWslMove): it asks the host, then rolls back to zero, or rolls forward when the host committed.
An automatic forward settle records the commit (destination-committed) but doesn't run the desktop rewrite. That rewrite reloads the window past its unload veto, so it would mean an unprompted reload mid-session. The next start's rewrite pass finishes it before any window opens. Meanwhile the distro parks (finish-pending) instead of retrying, and the next start puts it back to pending. The user can finish it in-session: their Move (or the status line's Retry) finds the committed head and finishes it on the desktop immediately ('finish-now'), with the existing "finished an earlier move" result.
While settling, it claims the distro's move run, so it can never race a move the user starts. If one is already running, it answers wsl_move_already_running and leaves the record to that move.
The dialog's preview stays read-only.
The preview moved to wsl-move-driver-preview.ts; wsl-move-driver.ts re-exports it.
Host server update mid-move, before:deployAndLaunchWslOrcad had no move check. A Settings Update or Force, or a reconnect, could replace the destination's server under a running move. Recovery made that safe, but the move was lost.
Host server update mid-move, after:
isWslMoveUnderwayOnHost(userDataPath, distro) is true while this process runs a move of the distro that has journaled its own cutover. A run that only settles an earlier record never counts; otherwise an outdated server would be held and the settle would retry forever.
When it's true, admitWslOrcadUpdate keeps the running server for any version-changing plan, including Force. It reports a non-forceable deferred update with the new code orcad_update_wsl_move_running, which Settings shows as "Not done: a project is moving onto this server. Orca updates it once the move finishes."
The move's own first connect, before it journals, can still update an outdated server, as it did before.
Why
Settling. I considered three options:
always settling in the preview: that would make the dialog's preview write the journal behind the user's back;
having the orchestrator start on an in-flight refusal: that would start a whole move just to settle;
settling only in the automatic path, under the same run claim a move uses (chosen).
It reuses the existing settle step, so the outcomes match a user-started move exactly.
The server hold mirrors how SSH hosts already skip auto-updates while a migration is unfinished. It keys on a journaled, running move, so a crash-left record (no run) never holds updates, and the move's pre-journal connect can still bring an old server up to date.
Linked Issue
N/A (internal).
Visual Proof
N/A: one new Settings status string in an internal, gated flow; the localization checks cover it.
Testing
wsl-move-driver-preview-settle.test.ts:
the read-only preview leaves the record;
the automatic preview resets a commit the host never made, lifts the fence and previews the move;
for a commit the host made, it records the commit without holding or reloading the window, and the next start's pass finishes it;
after an automatic settle records the commit, the user's Move finishes it with one desktop finish;
it defers to a move already running.
wsl-orcad-update-admission-move-hold.test.ts: connect, update and force all keep the running server with the waiting code while a move is underway, and the update deploys again once no move runs.
wsl-move-running-moves.test.ts: underway only between the run journaling its own cutover and the run's end, case-insensitive on the distro, never for a crash-left record, and never for a settle-only run over an earlier record.
The orchestrator wiring test pins that the automatic preview asks to settle.
pnpm tc, check:code-quality:changed, the localization checks, and the max-lines, test-runner, flaky-test and layout-writer checks pass. The mover, WSL orcad, move IPC and managed-server settings suites (89 files) pass. The full lint and test suites run in CI.
Review
Self-reviewed.
Agent skill upstream boundary
Not applicable.
Notes
Everything here runs only with the internal WSL hosts gate, since moves need it. SSH and paired hosts are untouched.
…er holds its own host update
Review of #34823:
- A settle that finds the host committed ran the desktop rewrite, which reloads the window past
its unload veto. From the automatic mover it now records the commit only (the projects stay
fenced), and the next start's rewrite pass finishes it before any window opens. A move the user
starts still finishes at once.
- The server hold counted any unfinished record of the distro, so an automatic settle of an old
record with an outdated server was held, refused for an update, and retried the same way. The
hold now counts only the cutover the running move journaled itself.
…er holds its own host update
Review of #34823:
- A settle that finds the host committed ran the desktop rewrite, which reloads the window past
its unload veto. From the automatic mover it now records the commit only (the projects stay
fenced), and the next start's rewrite pass finishes it before any window opens. A move the user
starts still finishes at once.
- The server hold counted any unfinished record of the distro, so an automatic settle of an old
record with an outdated server was held, refused for an update, and retried the same way. The
hold now counts only the cutover the running move journaled itself.
The move driver now supports separate settlement behavior for user-requested and automatic previews. The orchestrator tracks host-committed moves that still need desktop completion as finish-pending. Active host moves are also detected during Orcad update admission, where updates can be deferred until the move finishes. Tests cover settlement, orchestrator triggers, move detection, and update admission.
Priority: Normal
Estimated code review effort:
Merge Risk: Moderate · up to c2c85
Version-changing WSL server updates are meant to be deferred while a project move is running, but one fallback path can still deploy a new server version during the move. Decide how that path should behave before merging, taking care not to block the move's own connection.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 17.65% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title clearly summarizes both primary changes: automatic settlement of interrupted WSL moves and deferral of host server updates during moves.
Description check
The description is mostly complete. It explains the user impact, implementation, rationale, testing, visual proof, scope, and review status. The linked issue is marked N/A for an internal change, and …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Description check
Explanation
The description is mostly complete. It explains the user impact, implementation, rationale, testing, visual proof, scope, and review status. The linked issue is marked N/A for an internal change, and the omitted checklist does not prevent understanding or review.
Full details: Docstring Coverage
Explanation
Docstring coverage is 17.65% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 17 functions across 26 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches: 💡 1
📝 Generate docstrings: 💡
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.
…e host's server update during a move
An app update or crash between sending a move's copy and the host's commit leaves a
`blobs-transferred` record. Startup recovery has no host to ask, so the projects stay fenced, and
the automatic mover only previewed, which refuses an in-flight move, retrying forever. The
projects stayed read-only until the user started the move from the dialog. The automatic mover's
preview now settles that record first (through the host: back to zero, or forward when the host
committed), holding the distro's run while it does so it never races a move the user starts. The
dialog's preview stays read-only. The preview moves to its own module.
A Settings Update or Force, or any reconnect, could also redeploy the host's server in the middle
of a move, cutting it off (safe, but the move is lost). Once a running move has journaled, a
version-changing redeploy now keeps the running server and reports the update as waiting for the
move, mirroring the SSH path's skip while migrating. The move's own first connect, before it
journals, can still update an outdated server.
…er holds its own host update
Review of #34823:
- A settle that finds the host committed ran the desktop rewrite, which reloads the window past
its unload veto. From the automatic mover it now records the commit only (the projects stay
fenced), and the next start's rewrite pass finishes it before any window opens. A move the user
starts still finishes at once.
- The server hold counted any unfinished record of the distro, so an automatic settle of an old
record with an outdated server was held, refused for an update, and retried the same way. The
hold now counts only the cutover the running move journaled itself.
… the automatic mover meanwhile
After an automatic settle records a commit for the next start, nothing could finish it in-session:
the user's Move refused as already in flight and the orchestrator retried for nothing.
- A settle that finds the head committed but not yet rewritten on this desktop finishes it now when
the user asked (their Move, or the status line's Retry), returning the existing "finished an
earlier move" answer; the automatic mover still leaves it for the next start.
- The automatic refusal carries detail `finish-pending`, which parks the distro (new reason
`finish-pending`) instead of retrying; the next start, whose rewrite pass finishes the move before
any window opens, puts it back to pending.
- The park rules move to wsl-move-orchestrator-park.ts.
Main's move status line (#34676) names every park reason; the finish-pending reason this PR adds
needs one: the earlier move is done on the host, and finishes here at restart or with Check again.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
When moveRunning is true and the plan is update, the !adopted branch returns action: 'deploy' on the re-read record. It does not check heldForMove, which is applied only to the serve result. The deploy can then activate candidateVersion while the move runs. The PR's stated contract defers version-changing WSL server updates while a running move is in progress, so this path can violate that contract.
The correction needs a decision in the !adopted branch. A deferral that keeps the incumbent version does not apply when no server runs. Keep the move's own connection able to reach a server, or the move can stall. Limit any deferral to version-changing updates.
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.
ELI5
Two fixes for a WSL project move that gets interrupted, found in the audit behind #34813:
What Changed
blobs-transferredrecord (copy sent; the commit may or may not have reached the host) can't be resolved at startup, which has no host to ask, so the projects stay fenced.wsl_move_already_in_flight), and the orchestrator retries that as an uncounted transient forever, never reaching the start that would settle it.previewWslMovetakes{ settleInterrupted: true }, which only the automatic mover's wiring passes. It runs the same settle step a move start runs (settleInterruptedWslMove): it asks the host, then rolls back to zero, or rolls forward when the host committed.destination-committed) but doesn't run the desktop rewrite. That rewrite reloads the window past its unload veto, so it would mean an unprompted reload mid-session. The next start's rewrite pass finishes it before any window opens. Meanwhile the distro parks (finish-pending) instead of retrying, and the next start puts it back to pending. The user can finish it in-session: their Move (or the status line's Retry) finds the committed head and finishes it on the desktop immediately ('finish-now'), with the existing "finished an earlier move" result.wsl_move_already_runningand leaves the record to that move.wsl-move-driver-preview.ts;wsl-move-driver.tsre-exports it.deployAndLaunchWslOrcadhad no move check. A Settings Update or Force, or a reconnect, could replace the destination's server under a running move. Recovery made that safe, but the move was lost.isWslMoveUnderwayOnHost(userDataPath, distro)is true while this process runs a move of the distro that has journaled its own cutover. A run that only settles an earlier record never counts; otherwise an outdated server would be held and the settle would retry forever.admitWslOrcadUpdatekeeps the running server for any version-changing plan, including Force. It reports a non-forceable deferred update with the new codeorcad_update_wsl_move_running, which Settings shows as "Not done: a project is moving onto this server. Orca updates it once the move finishes."Why
Settling. I considered three options:
It reuses the existing settle step, so the outcomes match a user-started move exactly.
The server hold mirrors how SSH hosts already skip auto-updates while a migration is unfinished. It keys on a journaled, running move, so a crash-left record (no run) never holds updates, and the move's pre-journal connect can still bring an old server up to date.
Linked Issue
N/A (internal).
Visual Proof
N/A: one new Settings status string in an internal, gated flow; the localization checks cover it.
Testing
wsl-move-driver-preview-settle.test.ts:wsl-orcad-update-admission-move-hold.test.ts: connect, update and force all keep the running server with the waiting code while a move is underway, and the update deploys again once no move runs.wsl-move-running-moves.test.ts: underway only between the run journaling its own cutover and the run's end, case-insensitive on the distro, never for a crash-left record, and never for a settle-only run over an earlier record.pnpm tc,check:code-quality:changed, the localization checks, and the max-lines, test-runner, flaky-test and layout-writer checks pass. The mover, WSL orcad, move IPC and managed-server settings suites (89 files) pass. The full lint and test suites run in CI.Review
Self-reviewed.
Agent skill upstream boundary
Notes