Repository navigation
feat(wsl): serve saved WSL work behind a closed hosts gate (gate states, kill switch 1/2) - #34683
Merged
Merged
Conversation
8 of 9 tasks
The WSL hosts gate gains three states. A closed gate with a saved WSL host or a committed move becomes serve-only: saved hosts stay listed and reachable, committed rewrites, retention, interrupted-move recovery and the way back keep running, and the preload API is exposed through a stamped window argument. Adding hosts and starting moves still need the open gate. With nothing saved the gate stays closed exactly as before.
…s too They load the same preload, so without the argument they hid saved WSL hosts' status and Connect in serve-only. One helper now supplies the argument for every window on the shared preload.
- Refuse wslHosts:add unless the internal gate is open here, so this PR is safe on its own. - Promote on any move journal entry, so recovery can reset an in-flight move whose host record is gone. - List unfinished moves in serve-only. - An unreadable WSL deployment store fails closed in serve-only too, through a shared serving flag main sets at startup. - Report the gate state in wsl_usage_snapshot as an optional field.
nwparker
force-pushed
the
nwparker/wsl-kill-switch-gate-states
branch
from
October 28, 2026 07:20
d5c4907 to
b4b8acf
Compare
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 6 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Oct 28, 2026
feat(wsl): let a cached remote policy close the WSL hosts gate (kill switch, remote half 2/2)
#35529
Merged
nwparker
added a commit
that referenced
this pull request
Nov 2, 2026
…only Settings (#37394) wsl-host-paired-phone asserted the pre-#36771 'isn't running' copy; it now asserts the stable remote_runtime_unavailable code and '<distro> is stopped'. wsl-move-dialog's gate-closed case seeds a saved host, which since #34683 puts the app in serve-only: the WSL hosts section still lists the host. Assert instead that Add is hidden and the host row's menu has no move entry. Co-authored-by: Claude <noreply@anthropic.com>
11 tasks done
nwparker
added a commit
that referenced
this pull request
Nov 6, 2026
…ery keeps Since #34683 a move journal promotes the WSL hosts gate to serve-only, so startup recovery now runs and undoes a move interrupted before blobs-transferred. The spec restarted at source-fenced and expected the fence to survive; assert the undo there, fence from blobs-transferred, and expect the committed refusal to name the host (#34880). Route fence and recovery sources to the spec. Co-Authored-By: Claude <noreply@anthropic.com>
nwparker
added a commit
that referenced
this pull request
Nov 6, 2026
…ery keeps (#39200) Since #34683 a move journal promotes the WSL hosts gate to serve-only, so startup recovery now runs and undoes a move interrupted before blobs-transferred. The spec restarted at source-fenced and expected the fence to survive; assert the undo there, fence from blobs-transferred, and expect the committed refusal to name the host (#34880). Route fence and recovery sources to the spec. Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
Today, if the internal WSL hosts switch is turned off, every WSL host and every project already moved onto one disappears, and those projects just break. This gives the switch a middle position. When it's off but you already have WSL hosts or moved projects, Orca keeps serving them (serve-only), while nothing new can be added or moved. With nothing saved, "off" behaves exactly as before.
What Changed
Gate states (
src/shared/wsl-host-internal-gate.ts,src/main/wsl/wsl-host-gate.ts):open:ORCA_INTERNAL_WSL_HOSTS=1, unchanged.serve-only: the gate is closed, but this profile has a saved WSL host (a record in the WSL host deployment store) or any entry in the WSL move journal, committed or not. Recovery can then still reset an in-flight move whose host record is already gone.closed: neither exists. This is today's closed gate.configureWslHostsGateFromDisk(newwsl-host-gate-startup.ts) reads those two facts once, early insrc/main/index.ts, before any gate check. The result is fixed for the run, since nothing can create a host or a move while the gate isn't open. Unreadable state counts as absent, which means closed.New helper and call sites:
wslHostsServing()(open or serve-only).isGatedOffWslHost, so runtime environments are listed, connected, removed and tunneled, and the session scanner sees saved hosts;wsl-host-handlers.ts): holders, reconnect and automation wake;wsl-move-use-locally,wslMove:useProjectHereAgain).wslMove:listUnfinished).wslHosts:addis refused (kind: 'disabled') unless the gate is open, here in this PR, so it's safe on its own. The renderer hiding comes in the next PR.noteWslHostsServeOnly), soreadWslHostDeploymentsForRegistryfails closed on an unreadable store in serve-only, as it does with the gate open.wsl_usage_snapshotgains an optionalwsl_hosts_gate_state(open/serve-only/closed). It's optional, so older payloads still validate.Preload: it can't read the disk, so every window on the shared preload (the main window, the dashboard popout and the Space window) gets
--orca-wsl-hosts-serve-onlyin itsadditionalArgumentswhen the state is serve-only, from one helper,wslHostsWindowArguments().getWslHostsApithen exposes the API, still only on Windows or under the e2e fake. Outside serve-only the popout and Space windows get noadditionalArgumentskey, as before.Flag-off: with no saved WSL host and no committed move, the state is
closed, and every gated path returns exactly what it does today.Why
The design (
wsl-kill-switch.md, section 3) chose "block new moves, keep serving moved projects" over auto-undo (it would end live orcad sessions) and over read-only (it breaks running agents for no safety gain). Saved WSL work, rather than a new setting, decides the promotion: a user who never used WSL hosts can't reach any of this.Linked Issue
N/A (WSL hosts kill switch, PR1 of the design).
Visual Proof
N/A: the screens are unchanged. Serve-only shows the saved host where an open gate would. The e2e saves
wsl-hosts-serve-only-settings.png.Testing
wsl-host-internal-gate.test.ts: state resolution and the argv flag.wsl-host-gate.test.ts:wsl-host-gate-startup.test.ts(real files): a profile that never had WSL work stays closed and creates nothing; a saved host promotes; a committed move promotes; an uncommitted move does not.wsl-hosts-api.test.ts: the stamped argv exposes the API, still Windows or fake only.dashboard-popout-window.test.tsand the newworkspace-space-window.test.ts: both windows carry the argument in serve-only. The popout carries none otherwise.wsl-host-gate.test.tschecks that the helper stamps only in serve-only.e2e
wsl-host-fake-transport.spec.ts, split the gate-closed case in two. Both pass locally, hidden (ORCA_BACKGROUND_LAUNCH=1).The 50 existing suites that import the touched modules pass (455 tests).
pnpm tc,typecheck:ci, oxlint, the anti-slop lint,ast-grep-gates.mjs,check:code-quality:changedandcheck:process-host-importspass.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
This widens what a closed gate reaches (risk: medium). Please review alongside the next PR, which closes add-host in serve-only.
Agent skill upstream boundary
Notes
orcadDeployment.kind === 'wsl'.wsl_hosts_gate_openstill reports the internal gate itself, andwsl_hosts_gate_stateadds the promoted state.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)