Repository navigation
fix(wsl): a missing host gh or glab never boots a stopped default distro - #35709
Conversation
Cwd-less gh/glab calls whose host CLI is missing fell back to the default WSL distro with no running check, so background work (rate limits, auth status, Settings, task-source probes) booted a stopped distro. The fallback now asks the background exec gate first: stopped or unverifiable refuses with the distro-stopped error, running and user acts fall back as before.
|
STATUS: ready for review at 6b4428b. E9 gate for the default-WSL gh/glab fallback. 8 new tests: the stopped and unverifiable cases fail without the fix, and the running and user-act cases fail under mutation. Local gates pass. |
|
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 9 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 |
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryRoutes Windows default-distro fallbacks for
Reviews (1) · Last reviewed commit: "fix(wsl): a missing host gh or glab neve..." · Reviewed by Greptile |
…stro (#36230) * fix(wsl): user clicks on cwd-less gh may start the stopped default distro #35709 stopped background gh/glab from booting a stopped default distro, which also refused explicit clicks for users whose gh lives only in WSL. Starring Orca, the auth diagnosis, the project picker, opening a work item and board edits now run as a user act on the distro the fallback uses; the board table reload, which also runs unprompted, stays gated. The GitHub and GitLab rate-limit cards keep their last snapshot on the not-running refusal instead of flipping to unavailable. * fix(wsl): only an explicit click may start the stopped distro for project gh calls Wrapping the project-view and auth-diagnosis IPC handlers as user acts also let mount effects (useProjectViewTable listing a restored board's views, GhAuthErrorHelp's diagnosis) start a stopped default distro. The handlers now wake only when the renderer passes wakeWslDistro, which the picker browse/select, opening an item and every edit set; mount effects leave it unset, and the auth diagnosis never wakes.
ELI5
On Windows, if GitHub's
ghor GitLab'sglabisn't installed on Windows itself, Orca tries the copy in the default WSL distro. It did that even when the distro was stopped, and running anything in a stopped distro starts it. So background work could silently boot WSL, for example rate-limit checks, account lookups, and task-source probes. Now Orca only uses the WSL copy when the distro is already running, or when the user's own action asks for it. Otherwise it reports that the distro isn't running.What Changed
gh/glabcall with no working folder whose Windows CLI was missing ranwsl.exe -d <default>, which started the distro if it was stopped. For example, GitLab's rate-limit check (glab api user) booted WSL in the background.runAsWslExecUserAct): the call still falls back, and may start the distro.Mechanism: both fallbacks, the
ghone ingh-exec-file.tsand theglabone inglab-exec-file.ts, now go throughresolveDefaultWslCliFallback. It resolves the default distro, then asksblockedWslDistroForExec. That's the existing background exec gate: a settled, cached running-state read, with user acts exempt. A stopped distro throwsWslDistroStoppedError, using the variant that doesn't promise a retry will start it, because a background retry won't. An unverifiable distro throwsWslDistroUnverifiableError.Why
This reuses the gate every other background
wsl.exepath already uses (E9), so this fallback follows the same rule as the rest of WSL: background work never starts a distro, and user acts may. Reusing the distro-stopped errors gives callers an honest error, and the text doesn't match the "not installed" patterns, so a CLI that's only in a stopped distro isn't reported as missing. Pollers that recognize the not-running refusal keep their last data. This PR does not change the Settings → Integrations rows: the host-only GitLab auth diagnostic already opts out of this fallback. GitHub and GitLab share one helper, so both behave the same way.Linked Issue
N/A (found by the WSL E9 preflight lane, run 40819948053).
Visual Proof
N/A: no UI change. A background call returns the existing distro-stopped error instead of starting WSL.
Testing
New
default-wsl-cli-fallback-gate.test.ts, run for bothghandglab:wsl.exespawn. The error isWslDistroStoppedError, with no ENOENT or "not found" text. Fails without the fix.WslDistroUnverifiableError. Fails without the fix.wsl.exe -d Ubuntuas before. Fails if the gate always blocks (mutation).The three existing default-distro fallback test files now mock the running state as
running, since the fallback consults it. All 377 test files that touch the gh/glab runners pass, apart from two failures elsewhere:plugin-marketplace-fetch.integrationtimes out on main too.worktree-create-preparation-real-gitfailed once under load and then passed 3 of 3 on both this branch and main.pnpm tc,pnpm run typecheck:ci,check:code-quality:changed, the anti-slop oxlint, and ast-grep pass. Run on macOS with the Windows platform simulated; the gate is a Windows-only path.AI Disclosure
Review
Agent skill upstream boundary
Notes
Flag-off: no flag. This changes behavior for every Windows user whose
ghorglabexists only in WSL: background calls no longer start a stopped default distro.User-risk: low. While the distro is stopped, background GitHub/GitLab status checks report it as not running instead of starting it. They work again once the user opens a terminal in that distro, or it's otherwise running.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)