Skip to content

feat(wsl-mover): "Use on this computer again" brings a moved project back as it was before the move - #29833

Closed
nwparker wants to merge 1 commit into
nwparker/wsl-mover-d1b-10-hooksfrom
nwparker/wsl-move-use-locally-again
Closed

nwparker wants to merge 1 commit into
nwparker/wsl-mover-d1b-10-hooksfrom
nwparker/wsl-move-use-locally-again

Conversation

@nwparker

@nwparker nwparker commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 70 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​9952 $\color{#cf222e}{\Huge{\mathbf{−}}}$​29 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​9923
Prod 152 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​8332 $\color{#cf222e}{\Huge{\mathbf{−}}}$​259 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​8073

Stacked for owner review, do not merge. Now part of the linear WSL mover chain, as a leaf on #32001 (D1b-10). It was previously a side branch on #29550 (D1b-7a). The next internal build includes it. It touches shared paths: the sidebar's moved-project entry, the preload bridge, the web preload stub, the session freeze check in the WSL move scope guard, and a window reload after the action. Every main-side path answers only when ORCA_INTERNAL_WSL_HOSTS is set.

Summary

A project that was moved to its WSL host can be brought back to this computer: "Use on this computer again" on its sidebar entry. This is the safety net in place of a reverse mover (owner decision).

Before / after

  • Before: once a project moved, there was no way back except the narrow "undo if unchanged". If the WSL host broke, the project's Orca state, meaning its tabs, session and settings, was only reachable through the host.

  • After: the moved project's entry has an undo-arrow button. A plain confirmation says:

    • your code is not affected, because it never moved;
    • changes made on the host since the move stay there;
    • projects moved with it come back too;
    • the project stays on the host until you remove it there;
    • the window reloads.

    On confirm, the project's pre-move rows and session are listed here again, including its slept terminal tab and its chats.

confirm
after

Mechanism

  • Release: bringWslMovedProjectBack finds the newest committed move that took the project, using its distro's journal chain, and removes that record (removeCommittedWslMoveCutover). The retained source rows, never rewritten since the move, stop being hidden.
    • Nothing is copied back from the host.
    • A move that a later move of the same distro builds on is refused ("bring that one back first").
  • Session: while moved, the renderer holds only the project's chats, so a save from that page would overwrite the session the freeze preserved. Main therefore keeps an in-memory hold on the session freeze (wsl-move-release-session-hold.ts) and reloads the window. The hold lifts once the new page has loaded, and that page hydrates the full pre-move session from disk.
  • Not restored: desktop UI state that 7c–7f rewrote to host ids (layouts, UI routing, localStorage keys). The project's UI state starts fresh. The 7d trust-prune guard keys on the moved-projects list, which the reload refetches, so it lets go.

Fitting it into the chain (restacked onto #32001)

  • IPC: wslMove:useProjectHereAgain sits beside the driver's preview, start, cancel and listUnfinished channels. Like them, it checks the gate first, so with the gate closed nothing is read. It also answers only the main window. Telemetry is unchanged.
  • Journal: there is a single "only the newest move of a distro can be removed" check, removeNewestInChain. removeCommittedWslMoveCutover now just checks that the move committed and then calls it, the same way removeUncommittedWslMoveCutover does. The duplicate chain check is gone.
  • Retained marks (D1b-8): releasing a move removes its record. The journal-change reconcile then drops the orcadRetained marks, because no committed move explains them anymore. The retention test now runs the real release instead of removing the record by hand.
  • Stale-window re-apply (D1b-7f-2): it only re-applies for committed records, so it stops once the record is deleted. A new test pins this: after a release, neither the unload nor the startup re-apply moves focus back to the host.
  • Running moves: a move still running in this process (including its desktop rewrite after the commit) refuses the release with "still running, try again once it ends". The driver's run map moved into wsl-move-running-moves.ts so both sides can read it.
  • D1b-9 result dialog: the dialog tells the user to find the "Moved to … host" entry in the sidebar and choose "Use on this computer again". Before this change, the sidebar skipped moved projects that had no chats on this computer, so that instruction could lead nowhere. Now every moved project is listed. A happy-dom test reads the two labels the dialog quotes, finds them in the real sidebar section, clicks the action, and checks that it calls wslMove.useProjectHereAgain.

Why this approach

The owner decided against a reverse mover. Because the repository files never move, the only thing at risk is Orca's own state, and the retained rows exist exactly for this. Reloading the window is the one way to rehydrate the session without a second, partial hydration path.

Testing

  • Unit tests:
    • wsl-move-use-locally.test.ts: release, a committed move with an unfinished rewrite, not-moved, superseded, gate closed;
    • wsl-move-handlers.test.ts: input validation, then the hold staying until the reloaded page loads;
    • wsl-moved-project-use-here.test.ts: the confirmation copy and refusals;
    • WslMovedProjectsSection.test.tsx: the button is present.
  • e2e tests/e2e/wsl-move-moved-project-chats.spec.ts: a new case brings a retained move back headless. It checks that the row lists again, the entry goes away, and the persisted session still holds [terminal, chat]. Both cases pass locally (screenshots above come from that hidden window).
  • Typecheck (node and web), oxlint, the changed-code gate and the locale catalog checks pass.

@nwparker

Copy link
Copy Markdown
Contributor Author

CI: green except one known Windows Arm flake that isn't caused by this PR.

  • palette-match-performance.test.ts (222 ms against its 180 ms budget) failed on the first run and passed on re-run; this PR doesn't touch it.
  • persistence (windows-11-arm) failed twice, in orcad-serve-parity.integration.test.ts, with EBUSY: resource busy or locked, rmdir …orcad-serve-parity-*. That is the test-cleanup race test(orcad): wait for an idle-retiring daemon before deleting the serve-parity profile #29669 targeted. In the last hour the same job also failed on three unrelated branches (e1c-2-pane-trees-from-frames, nwparker/orcad-update-terminal-fence, brennanb2025/agy-chat-8-antigravity-row). This PR changes nothing in orcad serve.
  • Everything else passed: the mover suites, the new escape-hatch tests, static analysis, the e2e jobs and the real-WSL terminal lane.

@nwparker
nwparker force-pushed the nwparker/wsl-mover-d1b-7a-moved-project-chats branch from 5d9dcb2 to fa92dab Compare October 20, 2026 21:06
@nwparker
nwparker force-pushed the nwparker/wsl-move-use-locally-again branch from 7731883 to e548ed1 Compare October 20, 2026 21:06
@nwparker
nwparker force-pushed the nwparker/wsl-mover-d1b-7a-moved-project-chats branch from fa92dab to 76f3e02 Compare October 20, 2026 23:16
@nwparker
nwparker force-pushed the nwparker/wsl-move-use-locally-again branch from e548ed1 to bbfbd37 Compare October 20, 2026 23:16
@nwparker
nwparker force-pushed the nwparker/wsl-mover-d1b-7a-moved-project-chats branch from 76f3e02 to c035565 Compare October 21, 2026 00:46
@nwparker
nwparker force-pushed the nwparker/wsl-move-use-locally-again branch from bbfbd37 to 56aafa7 Compare October 21, 2026 00:47
@nwparker
nwparker force-pushed the nwparker/wsl-mover-d1b-7a-moved-project-chats branch from c035565 to ed9c23a Compare October 21, 2026 05:16
@nwparker
nwparker force-pushed the nwparker/wsl-move-use-locally-again branch from 56aafa7 to fe605f7 Compare October 21, 2026 05:17
@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