Skip to content

feat(wsl-mover): hold the stale window's saves from commit and reload it, replacing the re-apply patches (restore redesign 2/3) - #32965

Closed
nwparker wants to merge 5 commits into
nwparker/wsl-mover-restore-pane-historyfrom
nwparker/wsl-mover-restore-hold-reload
Closed

nwparker wants to merge 5 commits into
nwparker/wsl-mover-restore-pane-historyfrom
nwparker/wsl-mover-restore-hold-reload

Conversation

@nwparker

@nwparker nwparker commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​331 $\color{#cf222e}{\Huge{\mathbf{−}}}$​519 $\color{#cf222e}{\Huge{\mathbf{−}}}$​188
Prod 25 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​239 $\color{#cf222e}{\Huge{\mathbf{−}}}$​415 $\color{#cf222e}{\Huge{\mathbf{−}}}$​176

ELI5

When you move a project to a WSL host, the Orca window that was open during the move still remembers the old layout. Every time it saved, it wrote that old layout back, and three separate patches kept re-fixing it afterwards. Now the window simply isn't allowed to save from the moment the move commits until Orca reloads it, and Orca reloads it itself. "Use on this computer again" uses the same path.

What Changed

  • Before: after a move, the open window kept saving its old session and UI state (including during the save behind "Reload now"). Main then re-applied the move's rewrite at every unload, at window navigation, and at every startup (wsl-move-echoed-browser-tabs, the seeded view state's redo, wsl-move-stale-window-reapply). Browser tabs, drafts and focus still went missing in real runs.
  • After: a new hold (wsl-move-window-write-hold.ts) drops the window's session saves, UI saves and unload-checkpoint staging:
    • from the commit request (the host may publish the moved projects from then on), and
    • whenever a rewrite store changes state the window also saves,
    • until the window's reloaded page has loaded.
  • Main reloads the window itself once the rewrite is on disk. The reload overrides an unsaved-file veto, because drafts were already saved with every save before the hold.
  • If the commit request fails, the hold is released without a reload.
  • "Use on this computer again" now uses the same hold and reload, replacing its per-project release hold.
  • Deleted: wsl-move-echoed-browser-tabs.ts, wsl-move-stale-window-reapply.ts (and its test), wsl-move-release-session-hold.ts, the afterUnloadStage hook, the startup focus re-apply, and the windowOpen registry input. The seeded view state now only runs on the first seed.

Why

Each re-apply patch added another writer for the same fields, which is what kept bringing the losses back. One rule (main writes, the stale window can't, then it reloads) gives each field a single writer. Forcing the reload, rather than waiting for the user to click "Reload now", closes the gap where a stale window keeps saving indefinitely. This also clears the inherited layout-writer ratchet failure, which came from the deleted echo file.

Linked Issue

Refs #32956 (restore redesign 1/3). Stacked on it.

Visual Proof

N/A: no new UI. The window reloads on its own after a move instead of waiting for "Reload now". An end-to-end run follows in 3/3.

Testing

  • Automated tests added/updated: hold unit tests; a driver test checking the window is held during the rewrite and reloaded once; a driver test checking a failed commit leaves the window unheld; checkpoint, undo handler and registry tests.
  • Manual: the packaged Windows/WSL run is still to come (verify-7, after 3/3).

Locally: node typecheck, 695 move/IPC tests, oxlint, the code-quality plugins and the layout-writer ratchet all pass.

Review

Self-reviewed (the author can't spawn a separate reviewer). Known edges:

  • Window edits made in the seconds between the commit and the reload are not saved.
  • A commit whose outcome is unknown ("waiting for host") releases the hold; the later rewrite pass holds the window and reloads it again.

Agent skill upstream boundary

  • Not applicable.

Notes

Gated behind the internal WSL hosts gate. SSH, mobile and folder workspaces are unaffected: the hold only applies while a WSL move or its undo is rewriting this desktop.

@nwparker
nwparker force-pushed the nwparker/wsl-mover-restore-pane-history branch from f055e2a to d42777c Compare October 24, 2026 01:02
@nwparker
nwparker force-pushed the nwparker/wsl-mover-restore-hold-reload branch from 98e3702 to ce77bdd Compare October 24, 2026 01:02
@nwparker
nwparker force-pushed the nwparker/wsl-mover-restore-pane-history branch from d42777c to f080760 Compare October 24, 2026 02:28
@nwparker
nwparker force-pushed the nwparker/wsl-mover-restore-hold-reload branch from ce77bdd to 4083c81 Compare October 24, 2026 02:29
@nwparker
nwparker force-pushed the nwparker/wsl-mover-restore-pane-history branch from f080760 to a775846 Compare October 24, 2026 02:35
@nwparker
nwparker force-pushed the nwparker/wsl-mover-restore-hold-reload branch 2 times, most recently from 9c76368 to f89d4cb Compare October 24, 2026 02:47
@nwparker
nwparker force-pushed the nwparker/wsl-mover-restore-pane-history branch from 3e5a2f4 to 5356b3e Compare October 24, 2026 03:17
@nwparker
nwparker force-pushed the nwparker/wsl-mover-restore-hold-reload branch from f89d4cb to 45c58fe Compare October 24, 2026 03:17
@nwparker
nwparker force-pushed the nwparker/wsl-mover-restore-hold-reload branch from 45c58fe to a524f62 Compare October 24, 2026 09:13
@nwparker
nwparker force-pushed the nwparker/wsl-mover-restore-pane-history branch from fcbb767 to 8c8347e Compare October 25, 2026 01:47
@nwparker
nwparker force-pushed the nwparker/wsl-mover-restore-hold-reload branch from 247dfe8 to 0797306 Compare October 25, 2026 01:47
@nwparker
nwparker force-pushed the nwparker/wsl-mover-restore-pane-history branch from 8c8347e to b99059c Compare October 25, 2026 02:21
@nwparker
nwparker force-pushed the nwparker/wsl-mover-restore-hold-reload branch 2 times, most recently from c67e00c to 46bc798 Compare October 25, 2026 06:31
@nwparker
nwparker force-pushed the nwparker/wsl-mover-restore-pane-history branch from b99059c to 37bf312 Compare October 25, 2026 06:31
@nwparker
nwparker force-pushed the nwparker/wsl-mover-restore-hold-reload branch from 46bc798 to ca0cf9b Compare October 25, 2026 08:24
@nwparker
nwparker force-pushed the nwparker/wsl-mover-restore-pane-history branch from 37bf312 to 1a9a420 Compare October 25, 2026 08:24
@nwparker
nwparker force-pushed the nwparker/wsl-mover-restore-hold-reload branch from ca0cf9b to e37bcce Compare October 25, 2026 10:17
@nwparker
nwparker force-pushed the nwparker/wsl-mover-restore-pane-history branch from 1a9a420 to 40e4d64 Compare October 25, 2026 10:17
@nwparker
nwparker force-pushed the nwparker/wsl-mover-restore-hold-reload branch from e37bcce to e8d20f8 Compare October 25, 2026 11:07
nwparker and others added 5 commits October 25, 2026 05:11
…ds it (restore redesign 2/3)

The window open across a move hydrated before the desktop rewrite, so every save it made
(session, UI, the unload checkpoint behind Reload now) wrote stale state back, and three files
re-applied the rewrite after it: echoed browser tabs, the seeded view state's redo and the
stale-window reapply. Now main holds that window's saves from the commit request until its
reloaded page has loaded, and reloads it itself once the rewrite is on disk. Use on this computer
again takes the same path, replacing its per-project release hold.

Co-Authored-By: Claude <[email protected]>
A rewrite pass that ends while a commit request is out (another move's retry) must not reload
the window early: the reloaded page could save its view of projects the host is publishing.

Co-Authored-By: Claude <[email protected]>
…sing

A workspace whose pane was still restoring, or had just spawned, could miss its final checkpoint
on the first Sleep and stay awake; the move then refused with "Orca could not pause the terminals"
although a second Sleep stopped it (awin verify-7, 6e). The pause now sleeps the failed workspaces
up to twice more, a second apart, and refuses only when they keep failing.

Co-Authored-By: Claude <[email protected]>
… of refusing at once

When one workspace of a move failed to pause, the move was refused right away with
host_terminal_stop_failed, and the retry added for awin verify-7 never ran (awin verify-8, 6e).
The window rolls a failed workspace's panes back and reports that rollback as an error. The
pause's persist step waited on every workspace and failed on that error, so the whole pause
call threw instead of returning the failed workspace. The retry only ran on a returned failure,
and the move's first pause had no retry at all.

The persist step now fails only on errors from workspaces main reported as slept; main already
reports the failed ones. Both of the move's pauses sleep a failed workspace up to twice more
before refusing. Each attempt is a fresh pause with its own id, so a re-sleep is not counted
as a duplicate.

Co-Authored-By: Claude <[email protected]>
@nwparker
nwparker force-pushed the nwparker/wsl-mover-restore-pane-history branch from 96acf50 to 46a13cd Compare October 25, 2026 12:15
@nwparker
nwparker force-pushed the nwparker/wsl-mover-restore-hold-reload branch from e8d20f8 to 88e80a7 Compare October 25, 2026 12:15
@nwparker

Copy link
Copy Markdown
Contributor Author

Contained in the dark landing PR #34059 (its head commit is an ancestor of the landing branch). Closing in favour of it; branch kept.

@nwparker nwparker closed this Oct 26, 2026
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.

1 participant