Skip to content

perf(wsl-host): connect the hosts the saved session reopens as the app starts - #33111

Closed
nwparker wants to merge 1 commit into
mainfrom
nwparker/wsl-host-connect-at-launch
Closed

nwparker wants to merge 1 commit into
mainfrom
nwparker/wsl-host-connect-at-launch

Conversation

@nwparker

@nwparker nwparker commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​99 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​97
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​40 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​37

ELI5

Orca waited until its window had fully loaded before it started waking a WSL host. On a slow PC that's 3–4 seconds of doing nothing. Main now reads the saved session as soon as it starts. If the last session had a WSL-host project open, it starts connecting right away, while the window is still loading.

What Changed

  • Before: the WSL host connect (boot the distro, start Orca's server inside it, open the bridge) began only after the renderer had hydrated and reported "the user has open work on this host" through setVisibleWork.
  • After: at startup, once leftover distro holders are adopted, the WSL host service asks which hosts the saved session reopens with open work. That's the host of the active workspace, plus any host whose saved session partition still has a terminal tab. It marks those hosts as having open work, which starts their connect. When the renderer reports later, its set takes over, as before.
  • Mechanism:
    • New wslHostsWithReopenedWork() reads store.getWorkspaceSession().
    • New optional reopenedWork service dependency, wired in wsl-host-handlers.ts.
    • WslHostService.start() calls it after adoptHolders(), and only if the renderer hasn't reported a set yet.

Why

  • The renderer reports exactly this open work a few seconds later anyway. Starting from the saved session overlaps the distro boot and the server start with the app's own startup, rather than running after it.
  • It keeps the existing rule that only open work may boot a distro. A host with no open tabs and no active workspace is still never started.
  • Alternatives considered:
    • Start every recorded host at launch. That would boot distros the user isn't using.
    • Have the renderer report earlier. Its report needs the hydrated store, which is the slow part.

Measured on a low-spec Windows 11 box (i7-6700T, WSL 2.7.10), warm relaunch: the connect now starts at about 1.9 s after launch instead of 3.4–4.1 s, and the host is ready at about 5.0 s instead of 6–7.4 s.

Linked Issue

Internal: WSL via orcad, D3 startup gate (R35 / E17).

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, using hidden Electron builds driven over the Chrome DevTools Protocol, with startup milestones. The connect started from the saved session before the window hydrated.
  • Automated tests added/updated:
    • wsl-host-reopened-work.test.ts covers the active-host, open-tab and no-work cases.
    • wsl-host-service.test.ts checks that startup connects reopened hosts only after adopting holders, boots nothing without saved work, and keeps a set the renderer already reported.

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 code path, gated by ORCA_INTERNAL_WSL_HOSTS and the WSL hosts setting.
  • SSH is untouched, and there's no wire change.

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)

…p starts

The connect to a WSL host waited for the window to hydrate and report its open
work, several seconds into startup. Main now reads the same open work from the
saved session once holders are adopted, so the distro boot and orcad start overlap
the app's own startup.
@nwparker

Copy link
Copy Markdown
Contributor Author

Superseded by the E9 line (#33838/#33924).

@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