Repository navigation
feat(wsl): let a cached remote policy close the WSL hosts gate (kill switch, remote half 2/2) - #35529
Conversation
[Medium impact] The PR appears safe to merge with dependent PR #35543 included. SummaryApplies the cached WSL hosts policy at launch. A block stops new hosts and moves while saved hosts and move recovery stay available.
|
105eb70 to
6fe1411
Compare
|
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 2 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 |
…switch 2/2) A cached remote policy of "block" now closes an internal gate the launch environment opened, for the whole run. It reuses the closed-gate path that already exists: with saved hosts or moves the gate becomes serve-only, so moved projects keep working while nothing new is added or moved. With nothing saved it is closed. A missing, unreadable or "allow" policy changes nothing. Main stamps windows so preload agrees, the download runs only on Windows with the internal gate open, and telemetry reports the block. Co-Authored-By: Claude <[email protected]>
…under a block Telemetry reports the cached policy applied at launch as allow, block or missing (omitted when the internal gate left it unread). Tests pin that a block keeps Remove host, the way back and unfinished-move recovery, refuses new hosts and moves, and that a mid-run download applies only next launch. Co-Authored-By: Claude <[email protected]>
6fe1411 to
3fd1e58
Compare
Stacked on #35528 (base:
nwparker/wsl-hosts-remote-policy).ELI5
If we publish "block" in the WSL hosts policy, the next time Orca starts it acts as if the internal WSL-hosts switch were off. Projects that already moved onto a WSL host keep working, but nobody can add a host or move another project. If nothing is published, or the file can't be read, nothing changes.
What Changed
Gate (
src/main/wsl/wsl-host-gate.ts):configureWslHostsGatetakes a newpolicyBlocksfact. It is read only when the launch environment opened the internal gate; an unreadable policy counts as not blocking.wslHostsGateOpen()is now "internal gate open and no policy block". Every existing caller therefore sees a block as a closed gate.Shared and preload:
isWslHostsServing).--orca-wsl-hosts-policy-blockedinto every window on the shared preload, next to the existing serve-only stamp, so preload hides the API exactly when main does.Startup:
configureWslHostsGateFromDiskreads the cached policy for this build's channel.Telemetry:
wsl_usage_snapshotgains an optionalwsl_hosts_policyset toallow,blockormissing, the cached policy applied at launch. It is omitted when the internal gate is closed, because then no policy is read. It follows the pattern ofwsl_hosts_gate_stateand carries no identifiers.Ongoing work under a block:
Before and after, as the user sees it:
block:ORCA_INTERNAL_WSL_HOSTSunset.Why
I considered three options for already-moved projects:
Treating a block exactly like the unset environment variable means there's one well-tested stranded-state path instead of two. Applying the block only at the next launch avoids every mid-run transition hazard. The cost is that the switch takes effect when Orca next starts.
Mixed versions and SSH:
orcadDeployment.kind === 'wsl', and a test covers this.Flag-off: with
ORCA_INTERNAL_WSL_HOSTSunset nothing changes. The policy is never read or downloaded, and the gate behaves exactly as today.Status
Ready. Head
6fe1411a6b6. Checks run locally as listed under Testing. Reviews requested from fix-reviewer and e9-reviewer.Linked Issue
Internal: WSL-host kill switch (2/2). Builds on #34683 (gate states) and #35528 (policy download).
Visual Proof
N/A for this PR. The UI under a block is the existing serve-only and closed UI from #34683 with no new strings or layout. Nothing is published, so no user sees a change from this PR alone.
Testing
wsl-host-gate.test.ts: a block closes the gate for main and shared readers, keeps serving saved work as serve-only, and stamps both window arguments. It is never read behind a closed internal gate, an unreadable policy fails open to the internal gate, and SSH is untouched.wsl-host-gate-startup.test.ts, from disk:allow: openwsl-host-gate-startup.test.ts: a block cached mid-run applies only at the next launch.wsl-host-handlers-user-actions.test.ts: under a block, Add host is refused and Remove host still works.wsl-move-handlers.test.ts: under a block, the way back is not gated off, unfinished-move listing and pending rewrites still work, and a new move is refused.wsl-hosts-api.test.ts: preload hides the API on the blocked stamp unless serve-only is also stamped.wsl-usage-snapshot.test.ts:allow,blockandmissingeach validate, and the field is omitted when unread.pnpm tc,pnpm run typecheck:ci, each touched test file run on its own,check:code-quality:changed, anti-slop oxlint and ast-grep gates pass.main-window-updater-deferred-setup.test.ts(1) andmain-process-ready-*.test.ts(8) fail identically with these changes stashed, so they don't come from this PR. CI on this PR confirms whether they pass in CI.Review
Agent skill upstream boundary
Notes
Checklist
N/Afor visuals, with reasonpnpm tc:nodeand changed-code checks pass locally; CI covers the rest