Skip to content

perf(wsl-host): start booting the distros the last run had open work on as the app launches - #33141

Closed
nwparker wants to merge 1 commit into
mainfrom
nwparker/wsl-host-early-wake
Closed

nwparker wants to merge 1 commit into
mainfrom
nwparker/wsl-host-early-wake

Conversation

@nwparker

@nwparker nwparker commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​65 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​65
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​117 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​117

ELI5

When Orca restarts after a reboot, the WSL distro your project lives in is switched off, and switching it on takes several seconds. Orca only asked for it once the app had loaded far enough to know your project was in it. Orca now writes down which distros you had open, and on the next launch it starts switching those on first thing, while the rest of the app loads. A distro you didn't have open is never touched.

What Changed

  • Before: the first command that booted a WSL host's distro ran only once the store had loaded and the WSL host service had started, about 1.5–2 s into launch on a slow PC. It then waited the whole boot: about 4 s for a systemd distro on an idle i7-6700T, longer while the app is busy starting.
  • After:
    • Whenever the set of WSL hosts with open work changes, the service saves their distro names to orca-wsl-host-wake.json in userData.
    • Right after the next launch takes the single-instance lock, main runs wsl.exe -d <distro> --exec true for each saved distro that is still a registered WSL host. This is fire and forget; the normal connect does the real work.
  • Mechanism:
    • New wsl-host-early-wake.ts with rememberWslHostsToWake and wakeRememberedWslHosts.
    • WslHostService saves the list from setVisibleWork, and clears it when the hosts can't run (setting off, gate closed, no server files) or a host is removed.
    • The launch call is in src/main/index.ts, Windows only, behind ORCA_INTERNAL_WSL_HOSTS.
    • The command is built with buildWslExecArgs and spawned through @orca/process-host.

Why

  • Never wake a distro the user didn't open: the list is exactly the open work the last run reported. It empties when that work closes or the experiment is turned off, so nothing else is ever booted.
  • Why a plain boot command and not the full connect: the connect needs the store, the holders adopted and the session read, which is what made it late. A no-op command only starts the boot, and the connect that follows finds the distro already coming up.
  • Alternative considered: start the connect itself earlier. It can't start before the store loads, and --exec true holds nothing open: no holder and no server start.

Linked Issue

Internal: WSL via orcad, D3 startup gate (R35 / E17; E9 never-wake rule).

Visual Proof

N/A. This is a startup timing change behind the internal ORCA_INTERNAL_WSL_HOSTS gate, with no visual difference.

Testing

  • I manually tested these changes locally on a Windows box with a test distro: the file is written once open work is reported, and the next launch starts the boot. Timing results are in the D3 startup report.
  • Automated tests added/updated:
    • wsl-host-early-wake.test.ts: only remembered distros that are still hosts are woken; an empty or unreadable list wakes nothing.
    • wsl-host-service.test.ts: the list follows the open work and empties when the hosts are turned off.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Windows only, gated. SSH is untouched, and there's no wire change.
  • The file holds distro names only.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…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.
@nwparker

Copy link
Copy Markdown
Contributor Author

Superseded by #33924.

@nwparker nwparker closed this Oct 26, 2026
nwparker added a commit that referenced this pull request Oct 26, 2026
…ces #33141's list)

#33141 booted, at the very start of the next launch, every distro the last run had
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]>
nwparker added a commit that referenced this pull request Oct 26, 2026
…ces #33141's list)

#33141 booted, at the very start of the next launch, every distro the last run had
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]>
nwparker added a commit that referenced this pull request Oct 26, 2026
…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]>
nwparker added a commit that referenced this pull request Oct 26, 2026
…ch (E9, replaces #33141) (#33924)

* perf(wsl-host): start booting the distros the last run had open work 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.

* perf(wsl-host): wake only the focused WSL host early at launch (replaces #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]>

* fix(wsl-host): the early-wake list is authoritative: deleted when off, 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]>

---------

Co-authored-by: Claude <[email protected]>
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