Repository navigation
perf(wsl-host): a call made while the host connects joins that connect - #33180
Conversation
…t, keeping no-boot semantics
09b4630 to
992a6d4
Compare
Walkthrough
Priority: Merge Risk:
|
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:
a5b65aa3-cb9f-41ae-b5bb-88bca0c8aa93
Files selected for processing: 2-
src/main/wsl/wsl-host-connector.test.tssrc/main/wsl/wsl-host-connector.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
-
…ew bridge while one is connecting
There was a problem hiding this comment.
Actionable comments posted: 2

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:
98baa479-8dd8-40bd-9d26-0e5011af18b1
Files selected for processing: 3-
src/main/wsl/wsl-host-connector.test.tssrc/main/wsl/wsl-host-connector.tssrc/main/wsl/wsl-orcad-connection.ts
Files skipped from review as they are similar to previous changes: 1-
- src/main/wsl/wsl-host-connector.test.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.
-
| // While the bridge connect runs, `get` names the server it replaces: wait for the new one. | ||
| return manager.isConnecting(distro) | ||
| ? manager.ensure(distro, options) | ||
| : Promise.resolve(manager.get(distro) ?? manager.ensure(distro, options)) |
There was a problem hiding this comment.
Recheck the distro before returning a bridge to a no-boot call.
If the distro stops after the service’s reachability check while liveness is still arming, this branch returns the existing bridge without invoking requireRunning. The subsequent runtime call can dial that bridge and spawn wsl.exe, booting the stopped distro. Preserve the no-boot running check before returning the bridge. (raw.githubusercontent.com)
Invalidate pending connects when supervision stops.
If disconnect occurs while the first connect awaits its identity read, livenessConnects still contains that connect. A reconnect can then call manager.ensure here after liveness.stop has removed the supervisor. The new bridge has no watch or heartbeat, because the old supervisor generation cannot arm it. Clear the pending entry on every stop path and route the reconnect through liveness. (raw.githubusercontent.com)
ELI5
When Orca starts and a WSL host is still connecting, a restored terminal asks the host to show it, and that request waits for the connection. It waited longer than needed: once the connection was up, the request also restarted the host's health monitor, which takes about a second on a slow PC. Now it waits only for the connection.
What Changed
connector.connect).session.tabs.activateresolved its host check 1.15 s after the host was ready.isConnecting),getcan name the server being replaced, so the joiner waits on the manager's connect (ensure) for the new bridge. Only once the bridge is up does it takeget's answer at once. That's the step that skips the ~1 s liveness re-arm.createWslHostConnector, recording whether each is no-boot.ORCA_INTERNAL_WSL_HOSTSgate.Why
The re-arm did nothing for the caller. The watch the first connect is arming is the same one, and repeating it churned the watch channel. Joining keeps one armed watch per connect and removes the wait. The join rule matches the connection manager's own: a no-boot connect may ride anything, and a booting one may not ride a no-boot one.
Linked Issue
Internal: WSL via orcad D3 startup gate (client-side activate gap); E9 connect policy (#33838, #34050, #34093).
Visual Proof
N/A. This is a startup timing change behind the internal
ORCA_INTERNAL_WSL_HOSTSgate, with no visual difference.Testing
wsl-host-connector.test.ts:src/main/wsltests pass. Two load-sensitive cost tests timed out under machine load and pass when run alone.pnpm tcandcheck:code-quality:changedpass.Review
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)