Skip to content

fix(wsl-host): a runtime-call reconnect never boots a distro that stopped meanwhile (E9 follow-up) - #34050

Merged
nwparker merged 3 commits into
mainfrom
nwparker/wsl-host-no-boot-reconnect
Oct 26, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/wsl-host-no-boot-reconnect

Conversation

@nwparker

@nwparker nwparker commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

#33838 makes background requests (git status, PR badges and so on) reconnect to a WSL host only when its distro is confirmed running, so they never switch a distro on. There was still a tiny gap: the distro could stop between that check and the reconnect, and the reconnect would then switch it back on. This closes the gap.

What Changed

  • New option. A runtime-call reconnect now asks for noBoot (WslHostService.ensureForRuntimeCall).
    • The connector turns that into a running-list check (requireRunning).
    • The connection manager runs the check right before anything spawns in the distro, as the first step of the connect (assertWslDistroMayStart).
    • If the distro isn't confirmed running, the connect fails with WslDistroNotRunningError and starts nothing.
  • Superseding still works. The manager reads its generation before that await, so a close during the check still supersedes the connect. An existing test caught the ordering.
  • User connects are unchanged. Explicit Connect, focus entries and the automation wake still connect normally and may boot.
  • Review fixes:
    • A connect that may boot (a focus entry or Connect) no longer joins an in-flight no-boot connect, which would have handed it a refusal. It waits for that connect and then runs its own.
    • A no-boot refusal publishes no failed status. The supervisor, whose connect had already disarmed the entry, re-verifies: liveness gives the verdict and parks a stopped distro. It doesn't arm the old connection, because that would dial into the distro.
    • The generation is checked right after the running-list read, so a close during the read supersedes the connect before anything deploys.
  • One cleanup. The transport target literal in wsl-orcad-connection.ts, and the supervisor's entry creation, were each folded onto fewer lines so both files stay within their line limits.

Why

Linked Issue

WSL re-write, gate E9. Based on main (#33838 merged).

Visual Proof

N/A: no UI.

Testing

  • wsl-orcad-connection.test.ts:
    • a no-boot connect to a distro that isn't confirmed running rejects and spawns nothing; once it's confirmed running, it connects;
    • a focus connect started during a no-boot connect runs its own deploy;
    • a refusal reports no failed;
    • a close during the running-list read supersedes the connect with no deploy.
  • wsl-orcad-liveness-supervisor.test.ts: after a no-boot refusal, the supervisor re-verifies and publishes distro-stopped.
  • wsl-host-service.test.ts: a runtime-call reconnect asks for noBoot.
  • All of src/main/wsl passes. pnpm tc:node and check:code-quality:changed pass; CI runs the full lint (the machine is too loaded to run it locally).

Review

Self-reviewed.

Agent skill upstream boundary

  • Not applicable.

Notes

Gated like all WSL host code. No wire change.

nwparker and others added 3 commits October 26, 2026 13:13
…pped meanwhile (E9)

ensureForRuntimeCall reconnects only to a distro confirmed running, but the distro
could stop between that read and the reconnect, which would then boot it. A runtime
call now asks for a no-boot connect: the connector supplies a running-list check that
the connection manager runs right before anything spawns in the distro, refusing
with WslDistroNotRunningError (and starting nothing) when the distro isn't confirmed
running. The generation is read before that await, so a close during it still
supersedes the connect.

Co-Authored-By: Claude <[email protected]>
… failure, re-verify (E9 review)

Review of #34050:
- A connect that may boot (focus, Connect) joined an in-flight no-boot connect and so
  inherited its refusal. It now waits for that one and runs its own.
- A no-boot refusal published 'failed'. It now publishes nothing from the manager;
  the supervisor, whose connect had already disarmed the entry, re-verifies instead of
  arming the incumbent (which would dial into the distro), so liveness gives the
  verdict and parks a stopped distro.
- The generation is checked right after the running-list read, so a close during it
  supersedes the connect before anything deploys.

Co-Authored-By: Claude <[email protected]>
@nwparker
nwparker force-pushed the nwparker/wsl-host-no-boot-reconnect branch from 3789b44 to 5c23ffb Compare October 26, 2026 20:24
@nwparker
nwparker changed the base branch from nwparker/wsl-host-visible-work-policy to main October 26, 2026 20:24
@nwparker
nwparker merged commit e63b8f4 into main Oct 26, 2026
1 check passed
nwparker added a commit that referenced this pull request Oct 26, 2026
…er boots (E9 follow-up)

Two lows from the #34050 review:
- A no-boot connect published "Connecting" before its running-list read, and a quiet
  refusal then left the row on "Connecting". It no longer publishes the pending state.
- Liveness recovery reconnects only after confirming the distro runs, but that read
  could go stale before the reconnect spawned anything. Recovery now passes the same
  running check to the connection manager, which re-reads it right before spawning.

Co-Authored-By: Claude <[email protected]>
nwparker added a commit that referenced this pull request Oct 26, 2026
…er boots (E9 follow-up) (#34093)

* fix(wsl-host): no-boot connects stay quiet, and liveness recovery never boots (E9 follow-up)

Two lows from the #34050 review:
- A no-boot connect published "Connecting" before its running-list read, and a quiet
  refusal then left the row on "Connecting". It no longer publishes the pending state.
- Liveness recovery reconnects only after confirming the distro runs, but that read
  could go stale before the reconnect spawned anything. Recovery now passes the same
  running check to the connection manager, which re-reads it right before spawning.

Co-Authored-By: Claude <[email protected]>

* fix(wsl-host): a no-boot recovery connect still publishes its own pending status

Only the default "Connecting" is skipped for a no-boot connect; an explicit status
(liveness recovery's "retrying now") is still published.

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