Skip to content

fix(wsl): a missing host gh or glab never boots a stopped default distro - #35709

Merged
nwparker merged 1 commit into
mainfrom
nwparker/gh-glab-wsl-fallback-gate
Oct 29, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/gh-glab-wsl-fallback-gate

Conversation

@nwparker

@nwparker nwparker commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

On Windows, if GitHub's gh or GitLab's glab isn'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

  • Before: on Windows, a gh/glab call with no working folder whose Windows CLI was missing ran wsl.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.
  • After:
    • Stopped default distro: no WSL process starts. The call fails with the existing "WSL distro '' is not running. Open a terminal in it to start it." error, not a misleading "not installed".
    • Running default distro: unchanged.
    • Inside a user act for that distro (runAsWslExecUserAct): the call still falls back, and may start the distro.

Mechanism: both fallbacks, the gh one in gh-exec-file.ts and the glab one in glab-exec-file.ts, now go through resolveDefaultWslCliFallback. It resolves the default distro, then asks blockedWslDistroForExec. That's the existing background exec gate: a settled, cached running-state read, with user acts exempt. A stopped distro throws WslDistroStoppedError, using the variant that doesn't promise a retry will start it, because a background retry won't. An unverifiable distro throws WslDistroUnverifiableError.

Why

This reuses the gate every other background wsl.exe path 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

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

New default-wsl-cli-fallback-gate.test.ts, run for both gh and glab:

  • Stopped: no wsl.exe spawn. The error is WslDistroStoppedError, with no ENOENT or "not found" text. Fails without the fix.
  • Unverifiable: no spawn, and WslDistroUnverifiableError. Fails without the fix.
  • Running: falls back to wsl.exe -d Ubuntu as before. Fails if the gate always blocks (mutation).
  • User act while stopped: still falls back. Fails if the gate ignores user acts (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.integration times out on main too.
  • worktree-create-preparation-real-git failed 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

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Cross-platform: Windows only. On macOS and Linux the fallback never runs.
  • Providers: GitHub and GitLab alike.
  • SSH: unaffected; SSH remotes don't use this host fallback.
  • Performance: one cached running-state read per fallback.

Flag-off: no flag. This changes behavior for every Windows user whose gh or glab exists 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

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

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.
@nwparker

Copy link
Copy Markdown
Contributor Author

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.

@coderabbitai

coderabbitai Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

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: 5c572625-45fc-426b-a630-413474f78e24
Commits

Reviewing files that changed from the base of the PR and between bb20daf and 6b4428b.

Files selected for processing: 7
  • src/main/git/command-runner/default-wsl-cli-fallback.ts
  • src/main/git/command-runner/gh-exec-file.ts
  • src/main/git/command-runner/glab-exec-file.ts
  • src/main/git/default-wsl-cli-fallback-gate.test.ts
  • src/main/git/runner-wsl-gh-fallback.test.ts
  • src/main/github/client/check/check-job-log-routing.test.ts
  • src/main/gitlab/gitlab-known-host-probe-wsl-fallback.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Routes Windows default-distro fallbacks for gh and glab through the existing WSL background gate.

  • Background calls check the default WSL distro before using its GitHub or GitLab CLI.

nwparker explicitly describes the cached running-state read as intentional. The existing gate’s cache window is not a separate finding.

Reviews (1) · Last reviewed commit: "fix(wsl): a missing host gh or glab neve..." · Reviewed by Greptile

@nwparker
nwparker merged commit b999675 into main Oct 29, 2026
42 checks passed
nwparker added a commit that referenced this pull request Oct 30, 2026
…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.
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