Skip to content

fix(wsl): GitHub, GitLab and Git follower polls never start a stopped WSL distro (E9) - #35429

Closed
nwparker wants to merge 1 commit into
mainfrom
nwparker/e9-gh-git-readers
Closed

nwparker wants to merge 1 commit into
mainfrom
nwparker/e9-gh-git-readers

Conversation

@nwparker

@nwparker nwparker commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​347 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​342
Prod 46 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​515 $\color{#cf222e}{\Huge{\mathbf{−}}}$​256 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​259

ELI5

When a WSL distro is stopped, Orca must not start it unless you ask for it. The GitHub, GitLab and Git readers in the sidebar, the checks panel and some pages kept re-reading it on a timer, and every read woke the distro back up. Now those timers skip a stopped distro and keep showing what they already had. Clicking something (opening a diff, pressing Refresh) still starts it.

What Changed

Before: with a repo in WSL and the distro stopped (for example wsl --terminate), the distro came back within minutes without the user doing anything. Each of these ran gh, glab or git through wsl.exe -d <distro>, or touched \\wsl.localhost\<distro>:

  • the sidebar's linked-issue poll (gh:issue, 5 min per card) and hosted-review card poll (hostedReview:forBranch, all providers, including GitLab)
  • the checks panel: gh:prChecks every 60–120 s, and GitLab MR details (gitlab:workItemDetails) from the same timer
  • Git status followers: git:history, git:submoduleStatus, git:checkIgnored, git:findHugeFoldersToIgnore, and diff reloads (git:diff, git:branchDiff, git:commitDiff)
  • page-open fan-outs: the Tasks list and counts (gh:listWorkItems, gh:countWorkItems), the Settings and Automations orca.yaml checks, the composer's open-time hook check, and the speculative create-base prefetch (composer and palette)

After: each one asks the existing settled "is this distro running" check first. That is the same check the desktop git:status handler already uses (assertWslUncPathRunning / blockedWslDistroForPath, through guardWslUncPathAccess). If the distro is stopped, or WSL doesn't answer, the read is refused, or skipped in the prefetch's case, before anything runs in the distro. On the renderer side, pollers treat that refusal as "keep the last data":

  • a card keeps its issue
  • the checks panel keeps its list and stops logging
  • an open diff keeps its content
  • loaded submodule children stay

What still counts as a user act and may start the distro:

  • showing a diff tab, or its Retry (both already sent wakeWslDistro and now reach the diff handlers)
  • the checks Refresh button, rerunning checks, and linking or creating a PR
  • the Commits panel Refresh button
  • Create in the composer, and saving an automation (their hook checks no longer reuse the open-time refusal)

The refusal text lives in src/shared/wsl-distro-not-running-refusal.ts, so the renderer can recognise it after IPC wraps it.

Why

This copies the pattern already used for git:status: gate by default, and let a wakeWslDistro flag mark a user act. New background callers are safe without anyone having to remember a flag. I used a background flag instead (the hooks:check pattern) only where most callers are explicit opens: gitlab:workItemDetails (dialogs) and the hook checks. Gating in main, not only in the renderer, also covers the web client and any future caller.

Linked Issue

N/A (internal WSL E9 audit, PR 3 of the plan: items G1, G2, G4–G6).

Visual Proof

N/A. With the distro running nothing changes on screen. With it stopped, the visible difference is that panels keep their last data instead of the distro booting. This needs a Windows machine with WSL and can't be shown from the macOS dev box this was built on.

Testing

  • New github-wsl-stopped-distro-reads.test.ts: gh:issue, gh:prChecks, gh:listWorkItems and gh:countWorkItems refuse without running gh; a checks Refresh starts the distro but the next poll doesn't; running and Windows-host repos behave as before.

  • filesystem-wsl-stopped-distro-git.test.ts: the seven follower channels refuse before path resolution or Git; showing a diff tab may start the distro but a reload may not.

  • hosted-review.test.ts, gitlab.test.ts, worktree-create-base-prefetch.test.ts: the card poll, the GitLab checks poll and the prefetch skip a stopped distro; an explicit GitLab open still reads.

  • wsl-stopped-distro-poll-refusal.test.ts (renderer): a refused issue poll keeps the cached issue and doesn't log; refused checks are served from cache quietly; Refresh sends the wake flag and doesn't join an in-flight poll.

  • wsl-unc-access-gate.test.ts: the refusal is recognised in process, over IPC and over RPC.

  • Every new test fails with the fix reverted (16 main and 3 renderer cases).

  • pnpm tc, pnpm run typecheck:ci, pnpm run check:code-quality:changed, the anti-slop oxlint and ast-grep pass on the changed files.

  • The suites related to the changed files pass, except 9 files that fail identically without this change (real-Git, real-watcher and cross-version-wire suites in this environment).

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Review

Flag-off: these paths do not check ORCA_INTERNAL_WSL_HOSTS, so the change ships to everyone with WSL-runtime repos. Behaviour with a running distro is unchanged, apart from at most one extra wsl --list --running per minute, shared with the existing status gate.

User-risk:

  • With a stopped distro, the Tasks page, Settings and Automations hook display, and the history and diff readers show their last data or a "WSL distro 'X' is not running" message instead of starting the distro.
  • On the Tasks page there's no in-page wake: the fan-out spans every repo, so it is never treated as a user act. Opening a terminal in the distro, or Refresh in the checks or Commits panels, starts it.
  • If WSL doesn't answer the running check, the composer's open-time hook result is still committed as "no orca.yaml hooks" (as before) rather than re-checked at Create. It's a rare edge, noted for reviewers.
  • Not changed here: the renderer's hosted-review catch still logs the refusal with console.error, because adding the filter would push hosted-review.ts over the 300-line limit. The cached review is still preserved.

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

  • SSH: the gate only applies to a UNC path or a local repo whose project runtime is WSL. SSH and remote-runtime repos never ask it.
  • Folder workspaces: they don't use these Git or gh readers, so they're unaffected.
  • Remote wire: no RPC change. The web client strips the local-only wakeWslDistro and background hints before calling a host.

Status

Ready for review. Not merged.

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)

… WSL distro (E9)

gh, glab and git run for a WSL repo go through wsl.exe in its distro, so
any background read boots a stopped one. These polls ran ungated:

- the sidebar's linked-issue (gh:issue) and hosted-review card polls
- the checks panel (gh:prChecks, GitLab MR details) every 60-120 s
- git status followers: history, submodule status, ignored paths, the
  huge-folder probe and diff reloads
- page-open fan-outs: Tasks list/count, Settings and Automations orca.yaml
  checks, the composer's hook check and speculative create prefetch

Each now asks the settled running gate first and refuses (or skips) while
the distro is stopped. Pollers keep the data they already show. User acts
still start the distro: showing a diff tab or its Retry, the checks and
Commits Refresh buttons, a check action, and creating the workspace or
saving the automation.
@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect background reads across several WSL-backed repository views and tasks.

The PR appears safe to merge, with a non-blocking gap when reopening an already-active diff.

Findings

  1. P2 Reopening keeps an old diff ▶

Summary

Adds main-process guards so Git and forge followers leave stopped WSL distros alone.

  • Background Git reads leave stopped WSL distributions asleep.
  • GitHub issue and check reads leave stopped WSL distributions asleep.
  • Hosted-review cards and GitLab checks skip reads that could wake WSL.
  • Page-open hook checks and worktree prefetches leave stopped WSL distributions asleep.

Acknowledged by nwparker:

  • Tasks has no in-page wake action because it reads across repositories.
  • An unverifiable composer hook check may still be committed as no hooks.
  • Hosted-review refusals still log through console.error; filtering was deferred to avoid exceeding the file-length limit.

Reviews (1) · Last reviewed commit: "fix(wsl): GitHub, GitLab and Git followe..." · Reviewed by Greptile

Comment on lines 160 to +161
} else if (isReloadableSingleFileDiffTab(fileToLoad) && needsDiffRead(fileToLoad.id)) {
void loadDiffContent(fileToLoad)
void loadDiffContent(fileToLoad, load)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Reopening keeps an old diff

Clicking a source-control file whose diff is already active does not refresh it when WSL is stopped. openDiff keeps the tab ID and bumps diffContentReloadNonce, but that reload sends only force: true. The new gate refuses the read, and the catch silently keeps the old diff.

Pass wakeWslDistro: true through this explicit reopen path while keeping automatic reloads non-waking.

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The change adds WSL distro checks around local Git, GitHub, GitLab, and hosted-review reads. Selected Git and GitHub requests can pass a wake flag, while background requests can refuse stopped distros. Renderer paths forward these options and preserve selected cached or loaded data after stopped-distro refusals. Runtime-hook checks and worktree-base prefetch also check distro state.

Priority: Normal

Merge Risk: Moderate · up to 61f68

WSL users may find that Refresh cannot retrieve a hosted review, or that an unavailable distro check clears displayed hook information or skips a setup choice. Resolve these paths before merging.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: background GitHub, GitLab, and Git reads no longer start stopped WSL distros.
Description check Passed The description is detailed and covers the change, rationale, testing, linked-issue context, visual proof, risks, and compatibility considerations. The AI Disclosure heading is omitted, but this is no…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is detailed and covers the change, rationale, testing, linked-issue context, visual proof, risks, and compatibility considerations. The AI Disclosure heading is omitted, but this is non-critical because the description otherwise follows the template closely.

Full details: Docstring Coverage

Explanation

Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 24 functions across 50 files. (5 skipped: 5 over the file limit.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3


Review info
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: 3652df56-b970-4963-a03e-569be8f48008
Commits

Reviewing files that changed from the base of the PR and between 3f56b8f and 61f68ac.

Files selected for processing: 55
  • src/main/ipc/filesystem/filesystem-git-diff-handlers.ts
  • src/main/ipc/filesystem/filesystem-git-status-handlers.ts
  • src/main/ipc/filesystem/filesystem-wsl-stopped-distro-git.test.ts
  • src/main/ipc/filesystem/wsl-gated-worktree-git-read.ts
  • src/main/ipc/github-pr-read-handlers.ts
  • src/main/ipc/github-repo-routing.ts
  • src/main/ipc/github-work-item-handlers.ts
  • src/main/ipc/github-wsl-runtime-routing.test.ts
  • src/main/ipc/github-wsl-stopped-distro-reads.test.ts
  • src/main/ipc/gitlab-work-item-handlers.ts
  • src/main/ipc/gitlab.test.ts
  • src/main/ipc/hosted-review.test.ts
  • src/main/ipc/hosted-review.ts
  • src/main/worktree-create-base-prefetch.test.ts
  • src/main/worktree-create-base-prefetch.ts
  • src/main/wsl/wsl-unc-access-gate.test.ts
  • src/main/wsl/wsl-unc-access-gate.ts
  • src/preload/api/gh-bridge-pull-requests-and-work-items.ts
  • src/preload/api/git-bridge.ts
  • src/preload/api/git-inspection-api.ts
  • src/preload/api/github-pull-request-api.ts
  • src/preload/api/gitlab-api.ts
  • src/preload/gitlab.ts
  • src/renderer/src/components/automations/use-automation-draft-effects.ts
  • src/renderer/src/components/automations/use-automations-page-setup-state.ts
  • src/renderer/src/components/editor/useEditorPanelActiveTabContentLoad.ts
  • src/renderer/src/components/editor/useEditorPanelContentState.test.tsx
  • src/renderer/src/components/editor/useEditorPanelContentState.ts
  • src/renderer/src/components/editor/useEditorPanelDiffContentLoader.ts
  • src/renderer/src/components/github-item-dialog/inspect-pull-request/checks-tab-actions.ts
  • src/renderer/src/components/pull-request-page/checks/refresh.ts
  • src/renderer/src/components/right-sidebar/checks-panel/gitlab-review-client.ts
  • src/renderer/src/components/right-sidebar/checks-panel/use-checks-detail-timer.ts
  • src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-check-and-review-actions.tsx
  • src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-entry-refresh-and-title-actions.tsx
  • src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-manual-refresh.tsx
  • src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-polling.tsx
  • src/renderer/src/components/right-sidebar/source-control/listing/use-submodule-status.ts
  • src/renderer/src/components/right-sidebar/source-control/panel/panel-content.tsx
  • src/renderer/src/components/right-sidebar/source-control/sync/use-git-history.ts
  • src/renderer/src/components/right-sidebar/source-control/sync/use-status-refresh.ts
  • src/renderer/src/components/settings/use-settings-repo-scroll-effects.ts
  • src/renderer/src/hooks/composer-state/host-runtime-effects.ts
  • src/renderer/src/hooks/composer-state/provider-runtime-sync.ts
  • src/renderer/src/hooks/composer-state/provider-sync-model.ts
  • src/renderer/src/runtime/runtime-git-diff-client.ts
  • src/renderer/src/runtime/runtime-git-status-client.ts
  • src/renderer/src/runtime/runtime-gitlab-api.ts
  • src/renderer/src/store/github/check-actions.ts
  • src/renderer/src/store/github/issue-actions.ts
  • src/renderer/src/store/github/request-coordination.ts
  • src/renderer/src/store/github/slice-types.ts
  • src/renderer/src/store/github/wsl-stopped-distro-poll-refusal.test.ts
  • src/renderer/src/web/preload-api/web-github-api.ts
  • src/shared/wsl-distro-not-running-refusal.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

localGitExecOptions: localGitOptions
})
// Sidebar cards and the checks panel poll this for every provider; gh/glab in WSL boot it (E9).
const review = await guardWslUncPathAccess(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major · Functional Correctness · Quick win

Allow explicit hosted-review refreshes to wake WSL.

If the preceding Git-status read is skipped or fails, a checks-panel Refresh reaches this gate with admissionTier: 'interactive' while the distro is still stopped. The gate has no wake option here, so it rejects before getHostedReviewForBranch runs. Pass wake for the explicit interactive request; keep automatic lookups non-waking. (raw.githubusercontent.com)

Proposed change
-      { wslDistro: localGitOptions.wslDistro }
+      {
+        wslDistro: localGitOptions.wslDistro,
+        wake: localGitOptions.admissionTier === 'interactive'
+      }

if (!liveRepoHostIdentities.has(repoHostIdentity)) {
return previous
}
if (result.unavailable === 'wsl-distro-stopped' && previous[repoHostIdentity]) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Quick win

Preserve existing hooks for unverifiable WSL checks.

When WSL cannot report the distro state, the handler returns status: 'error' without unavailable. This condition then allows the error result to replace existing hooks with hasHooks: false. Preserve the existing entry for error results as well.

void loadHookCheckForRepo(repoId, { background: true })
.then((result) => {
if (!cancelled) {
if (!cancelled && result.unavailable !== 'wsl-distro-stopped') {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major · Functional Correctness · Quick win

Do not mark failed hook checks as complete.

When the WSL running check is unverifiable, the handler returns an error without the stopped marker. This condition commits null and marks the context as checked. For an ask policy with YAML-only setup, quick submission then skips its foreground check and proceeds without showing the setup choice. Ignore error results so submission can retry the check. (raw.githubusercontent.com)

@nwparker

Copy link
Copy Markdown
Contributor Author

STATUS: folded into #35410 (head f8eddc3), which is now the single PR for E9 G1–G6/G8. Closing this duplicate.

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