Repository navigation
perf(wsl-host): start booting only the focused WSL host early at launch (E9, replaces #33141) - #33924
Conversation
9bb7590 to
3cfcfdf
Compare
…, forgotten on Remove Review of #33924: the early wake runs before settings load, so it can't read the WSL hosts setting. Turning WSL hosts off now deletes the list synchronously (emptying it if the delete fails; a missing or unreadable list wakes nothing), and removing a host drops it from the list. There is no pendingStop field on host records yet (E11); the existing registered-host filter covers removed records until then. Co-Authored-By: Claude <[email protected]>
3cfcfdf to
0f1c930
Compare
|
No actionable comments were generated in the recent review.
|
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
33777556-f9af-4d14-91a4-aa4573cc6da0
Files selected for processing: 9-
src/main/index.tssrc/main/ipc/wsl-host-handlers.tssrc/main/wsl/wsl-host-early-wake.test.tssrc/main/wsl/wsl-host-early-wake.tssrc/main/wsl/wsl-host-service.test.tssrc/main/wsl/wsl-host-service.tssrc/preload/api/wsl-hosts-api.tssrc/renderer/src/hooks/ipc-events/wsl-host-ipc-bridge-focus.test.tssrc/renderer/src/hooks/ipc-events/wsl-host-ipc-bridge.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
-
| } catch (error) { | ||
| console.warn('[wsl-hosts] Could not save the distros to wake at next launch:', error) | ||
| } |
There was a problem hiding this comment.
Remove the stale wake list when saving a replacement fails.
If a valid wake list contains Ubuntu and a later focus update cannot write its replacement, this catch leaves Ubuntu in the file. On the next launch, wakeRememberedWslHosts can still boot Ubuntu, even after focus moved off WSL. Attempt to delete the old file when the replacement write fails, and report a failure if the old file cannot be removed.
…on as the app launches The WSL host connect can only start once the store has loaded, about 1.5-2 s into startup on a slow PC, and its first command then waits for the distro to boot. The service now remembers which distros had open work, and the next launch starts booting just those right after taking the single-instance lock.
…ces #33141's list) open work on, which conflicts with E9 (a launch boots only the focused host). Each focus entry now records just that host's distro for the next launch's early boot, and focusing a workspace off WSL (reported as a null focus entry), turning WSL hosts off, or a host that can't run clears it. Co-Authored-By: Claude <[email protected]>
…, forgotten on Remove Review of #33924: the early wake runs before settings load, so it can't read the WSL hosts setting. Turning WSL hosts off now deletes the list synchronously (emptying it if the delete fails; a missing or unreadable list wakes nothing), and removing a host drops it from the list. There is no pendingStop field on host records yet (E11); the existing registered-host filter covers removed records until then. Co-Authored-By: Claude <[email protected]>
0f1c930 to
63ff2d4
Compare
ELI5
After a reboot, the WSL distro you were working in is switched off, and switching it on takes a few seconds. Orca now remembers which WSL host you last had focused and starts switching that one distro on at the very beginning of the next launch, while the rest of the app loads. Other distros you had tabs in are never touched.
What Changed
This replaces #33141, which started booting every distro the last run had open work on. Its early-boot mechanism (
wsl-host-early-wake.ts, run fromsrc/main/index.ts) is kept unchanged. What changes is what gets remembered:focusHost({ environmentId: null })) clears it. So does turning WSL hosts off, or a host that can't run.wsl.exe -d <distro> --exec truestarts it booting in the background. The focus entry that follows does the real connect.Why
focusHostacceptingnullis desktop-only IPC between this app's own window and main.Linked Issue
WSL re-write, gate E9. Based on main (#33838 merged). Supersedes #33141 and #33111.
Visual Proof
N/A: no UI.
Testing
wsl-host-service.test.ts: open work alone isn't remembered; a focus entry remembers its host; a null focus and turning WSL hosts off clear it; removing the host forgets it, even if the distro is re-added.wsl-host-early-wake.test.ts: turning WSL hosts off deletes the file and the next launch wakes nothing; a removed host is forgotten even while its record is still on disk.wsl-host-ipc-bridge-focus.test.ts: the bridge sends a null focus entry when the user leaves WSL and the host again on return.wsl-host-early-wake.test.ts(from perf(wsl-host): start booting the distros the last run had open work on as the app launches #33141): only remembered, still-registered hosts are woken.pnpm tc:node,pnpm tc:web, the touched tests, andpnpm run check:code-quality:changed. The machine was too loaded for a full localpnpm lint, so CI runs it.Review
Self-reviewed. The early-wake mechanism itself was reviewed in #33141.
Agent skill upstream boundary
Notes
pendingStopfield on host records yet. Once E11 adds it, the wake should skip those records too; until then the registered-host filter covers removed records.Gated like the rest of the WSL host code (internal gate, Windows only).