Repository navigation
feat(wsl-mover): rewrite the desktop's routing and seed the host's session after a move (D1b-7c) - #29652
feat(wsl-mover): rewrite the desktop's routing and seed the host's session after a move (D1b-7c)#29652nwparker wants to merge 2 commits into
Conversation
d9a6f2f to
1a052ad
Compare
4c4b533 to
5a9576a
Compare
|
CI note: the only failure on this head (5a9576a) is the real WSL terminal lane's |
1a052ad to
5d9dcb2
Compare
5a9576a to
bcc1373
Compare
|
CI result on bcc1373, which includes #29633: the real WSL terminal lane still fails |
5d9dcb2 to
fa92dab
Compare
bcc1373 to
8d312b4
Compare
fa92dab to
76f3e02
Compare
574e5f0 to
dd04a70
Compare
76f3e02 to
c035565
Compare
…ssion after a move (D1b-7c) Registers the main-side desktop rewrite stores ui-routing, session-globals and host-session-seed. Adds a +2 main layout-writer baseline line for wsl-move-main-rewrite-stores.ts: these are one-shot, ledgered move rewrites, and no LayoutCommand can set focus or seed a runtime host's partition.
… one copy of each moved tab, and copy instead of move (D1b-7c)
c035565 to
ed9c23a
Compare
dd04a70 to
0a93bdd
Compare
|
Contained in the dark landing PR #34059 (its head commit is an ancestor of the landing branch). Closing in favour of it; branch kept. |
Shared paths this PR touches
findCrossHostPaneTabIds: skips the retained local copy of a moved workspace.uiand session globals: rewritten only for moved projects, through copy rather than move (see below).config/main-layout-writer-baseline.txtgets +2 for two one-time, ledgered session writes inwsl-move-main-rewrite-stores.ts. One sets the local focus; the other seeds the WSL host's partition. No layout command can set focus or seed a runtime host's partition (runtime-layout-applyrefuses runtime hosts), and the agent reports the coordinator approved the bump. Please confirm.ELI5
After a WSL project's move commits, this computer's own saved state still points at the old Windows path: the last opened worktree, per-worktree settings, sidebar host filters, and saved tabs. This PR rewrites that state to point at the WSL host's copy. It also prefills the host's saved session so the first screen after a move shows every tab. Nothing writes a move yet, and everything is behind the internal WSL host gate, so nothing changes for anyone today.
What Changed
This is step D1b-7c of the lossless WSL project mover. It registers three main-side stores in the ledgered rewrite stage from #29597:
ui-routing(moved repos and folders only):lastActiveWorktreeId, the keys ofshowDotfilesByWorktreeandexplorerDisplayRootByWorktree: Linux worktree ids. Folder roots are mapped in place.manualRepoOrder: WSL-host forms are added beside the local ones, which are kept.localin the visible-host lists and inworkspaceHostOrder.workspaceHostScopeandautomationHostFilterhold a single value, so they are left alone. A legacylocalscope gets the host throughvisibleWorkspaceHostIds, which takes precedence.session-globals: if the local focus is on a moved workspace, focus moves to the Linux id on the WSL host.host-session-seed: fills the WSL host's saved session from the move manifest, but only for moved workspaces the host doesn't already have. Chat tabs (they stay local) and PTY bindings are excluded. The seeded workspace ids are recorded on the move record asseededHostWorkspaceIds(optional, grow-only), so a retry never brings back tabs the user has since closed.flushPendingOrThrowAsync().Why
Copy instead of move: an older build after a downgrade still finds its preferences.
Prefilling the host's session: first paint reads
workspaceSessionsByHostId, notremoteLayoutSnapshots, which has no renderer reader.One copy of each tab: the retained local rows stay on disk for downgrade, so the window drops them before merging, and a tab never resolves to the fenced local copy. Tabs keep their ids because restore hints and scrollback refs depend on them.
Finishing before the window loads: the window's whole-session save would otherwise undo the rewrite.
Linked Issue
N/A (maintainer; tracked in the WSL-via-orcad implementation tracker, step D1b-7).
Visual Proof
N/A: no visible UI change, and nothing writes a move yet.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Per-store rewrites, run against the mixed Windows/WSL fixture profile:
\\wsl$and lowercase-distro spellings;activeWorkspaceKey;Host seed: excludes chat tabs and PTY ids, never overwrites the host, and is never re-seeded after the user closes tabs (covered by a flush-timeout, close, re-run test).
Hydration: both partitions holding
tab-1end with only the host's copy. The local chat tab stays, andfindCrossHostPaneTabIdsreports nothing for it.Startup ordering: tested.
Real-store driver test: a committed journal runs all three stores in order and stays
destination-committed, since the registry isn't complete until 7f. A re-run after a lost ledger entry is covered.Checks:
pnpm tc:node,pnpm tc:web, both ratchets, both oxlint configs, and the changed-code quality gate against feat(wsl-mover): a moved project's existing chats stay listed and resumable on this computer (D1b-7a) #29550 pass. 4001 test files pass.Adversarial review: it found two MEDIUM issues (a startup race with the window; duplicate tab ids across partitions) and three LOW ones (folder explorer root, copy vs move, re-seeding closed tabs), plus test gaps. All are fixed here.
AI Disclosure
Review
Agent skill upstream boundary
Notes
The rewrite hook after a move commits has no caller yet. A comment there says it must run with no window open, or alongside the renderer stores in 7d. 7d also covers the renderer pruning a host-form dismissal before the host's repo list loads.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)