Skip to content

fix(wsl): background Git, GitHub and GitLab reads never start a stopped distro; explicit opens may (E9) - #35410

Merged
nwparker merged 7 commits into
mainfrom
nwparker/wsl-e9-git-readers
Oct 29, 2026
Merged

nwparker merged 7 commits into
mainfrom
nwparker/wsl-e9-git-readers

Conversation

@nwparker

@nwparker nwparker commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 20 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​855 $\color{#cf222e}{\Huge{\mathbf{−}}}$​24 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​831
Prod 64 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​829 $\color{#cf222e}{\Huge{\mathbf{−}}}$​370 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​459

ELI5

If you stop a WSL distro, Orca should leave it stopped until you do something in it. Several background readers kept starting it again on their own: the Git and GitHub/GitLab polls, and checks that run when a page opens. Now they wait. Opening something yourself (a diff, the Commits list, the checks panel) still starts the distro, because that's you asking for it.

What Changed

Before: after wsl --terminate, these reads could start the distro again within seconds, with no click:

  • Git followers: history, diff, branch and commit diffs, submodule status, ignore checks, the huge-folder scan;
  • the 5-minute issue poll on sidebar cards, the hosted-review card poll (every provider, GitLab included), the Tasks list and count, and the checks panel poll (GitHub and GitLab);
  • the speculative create-base prefetch when the composer opens;
  • the worktree-root setup that runs for every repo after a workspace-folder settings edit;
  • the orca.yaml check behind the Settings project page, the Automations create dialog, and the composer.

After: each read checks the existing settled gate first (assertWslUncPathRunning / blockedWslDistroForPath, with a 60 s lease), and covers the project's distro, not only \\wsl.localhost paths. What happens next depends on who asked.

Background reads are refused while the distro is stopped. These are polls, timers, refreshes after a Git action, prefetches and fan-outs.

  • Git and GitHub reads refuse with the existing "WSL distro is not running" error.
  • Prefetch and root setup skip the repo.
  • Settings, Automations and the composer ask in background mode. A repo whose distro refused, or didn't answer, stays "checking" rather than "no orca.yaml", and Settings re-asks on window focus, on visibility and every 10 s until it answers.
  • The sidebar issue poll says "Open a terminal in it to start it", because its own retry is background too. Tasks and the checks panel keep "Retry", since their Refresh/Retry are user acts.
  • gh:prForBranch (the card fallback when the refresh coordinator is absent) is gated like the other card polls.
  • On a refusal, pollers keep what they already show: a card's issue, the checks list, an open diff, loaded submodule children. They also stop logging it.

Explicit opens are user acts and may boot the distro. Each one runs under runAsWslUserAct for that distro, via a wakeWslDistro flag on git:diff, git:branchDiff, git:commitDiff, git:history and gh:prChecks:

  • showing a diff tab, or its Retry;
  • showing Commits (expanding it, or switching to a workspace with it open), or its Refresh button;
  • opening the checks panel or entering its tab (the first read after open), checks Refresh, a check action, and linking or creating a PR;
  • Create in the composer and saving an automation, which re-check orca.yaml in the foreground and never reuse a refused background check;
  • a Tasks Refresh, Retry or search, or Tasks opened on a single repo (gh:listWorkItems / gh:countWorkItems; a multi-repo open stays background);
  • an explicit review-status refresh (hostedReview:forBranch with wakeWslDistro, set by the checks panel's manual Refresh and by the refresh that follows a review the user created, linked or edited), so GitLab, Bitbucket, Azure DevOps and Gitea reviews with nothing cached can load. admissionTier stays priority only: the visible scheduler sends 'interactive' for the selected card on a timer, and that poll is refused;
  • a manual PR lookup through gh:prForBranch.

User acts that already started a distro are unchanged: opening a terminal, the active workspace's first status read, expanding the explorer, creating a worktree, and fetching.

Why

This is the GitHub and Git reader group (G1, G2, G4–G6, G8) from the E9 background-boot audit. Link existence checks (G3) are in #35412, which throws a refusal instead of answering "missing".

Gating in the main-process handler covers every caller, including renderer retries, timers and the web client. It copies the git:status pattern: gated by default, with a wake flag only where the user explicitly opened the thing. A new caller is safe without having to remember a flag.

  • Settings could store the refused result, but that would show "missing orca.yaml" and offer "Use local commands", which is wrong for a distro that's only stopped.
  • GitLab MR details use a background flag instead of a wake flag because most callers are explicit dialog opens.

Linked Issue

N/A (internal WSL rewrite, E9 audit follow-up)

Visual Proof

N/A: no new UI. A stopped distro now shows the last data, the existing stopped-distro error, or the existing "checking" state, instead of booting.

Testing

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

New tests, each confirmed to fail with its source change reverted:

  • filesystem-wsl-stopped-distro-git.test.ts:
    • 7 Git channels refuse before resolving the path or running Git;
    • showing a diff or Commits may start the distro, but a reload or post-action refresh may not.
  • github-wsl-stopped-distro.test.ts:
    • gh:issue, gh:listWorkItems, gh:countWorkItems and gh:prChecks refuse without running gh;
    • for gh:prChecks, gh:listWorkItems, gh:countWorkItems and gh:prForBranch, a user act may start the distro but the next poll may not;
    • a Windows-host repo never asks WSL.
  • hosted-review.test.ts and gitlab.test.ts: the card poll, the interactive-priority scheduler poll and the GitLab checks poll refuse; an explicit review Refresh and an explicit GitLab open read.
  • visible-hosted-review-refresh-targets.test.ts: the scheduler's refresh of the selected card sends no wake; a card refresh does.
  • use-checks-panel-polling.test.tsx: the read that opens the panel wakes, later polls don't, and reopening wakes again (GitHub and GitLab).
  • use-git-history-wsl-wake.test.tsx: showing Commits and its Refresh wake; a ref-driven refresh doesn't.
  • wsl-stopped-distro-poll-refusal.test.ts:
    • a refused issue poll keeps the cached issue and doesn't log;
    • refused checks are served from cache quietly;
    • Refresh doesn't join an in-flight poll;
    • a Tasks user act sends the wake while a fan-out doesn't;
    • only a manual PR lookup fallback sends it.
  • worktrees-wsl-runtime-routing.test.ts, worktree-root-preparation.test.ts, use-automations-page-setup-state.test.tsx: prefetch, G8, and the Automations background/foreground split.
  • use-settings-repo-scroll-effects.test.tsx: Settings asks in the background, stays "checking" for a stopped or unverifiable distro, and records it once a focus or the 10 s retry finds it running.
  • worktree-hook-check-background-gate.test.ts: an unverifiable distro is marked unread.
  • github-wsl-stopped-distro.test.ts also checks the refusal wording per surface.
  • wsl-unc-access-gate.test.ts: the refusal is recognised in-process, over IPC and over RPC.

Also run: pnpm tc, pnpm run typecheck:ci, pnpm run check:code-quality:changed, the anti-slop lint, ast-grep, and the suites related to the changed files. Not run on Windows.

Flag-off: these paths don't check the WSL hosts flag, so the gate applies flag-off too. That's the point: the boots happened flag-off. With a running distro, behaviour is unchanged, apart from at most one shared wsl --list --running per minute.

User-risk: low. Background panels keep their last data while the distro is stopped, and anything the user opens explicitly starts it as before.

  • Opening Tasks on several repos never starts their distros; it shows cached items and a failure count until a Refresh or Retry.
  • If WSL doesn't answer the running check, the composer's open-time result still counts as "no orca.yaml hooks". This is a rare edge.
  • The renderer's hosted-review catch still logs a refusal with console.error. A filter would push hosted-review.ts over the 300-line limit. The cached review is kept.

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

  • SSH and remote: unaffected. The gate only names a distro on Windows, for WSL paths or projects.
  • Folder workspaces: the root fan-out already skips folder repos.
  • Wire: no RPC change. The web client strips the local-only wakeWslDistro and background hints. IPC args gain optional fields only.
  • Not in this PR: the runtime RPC twins (G7, fix(wsl): runtime RPC background reads never start a stopped WSL distro (E9) #35430) and the flag-on settle work (L1/L2).

Status

Ready for review. This folds in the parallel #35429, which will be closed. 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)

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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: f4a4a299-563e-44a2-af11-fb0af72f8c1e
Commits

Reviewing files that changed from the base of the PR and between 8859b31 and 8db6a06.

Files selected for processing: 84
  • 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-pr-refresh-handlers.ts
  • src/main/ipc/github-repo-access-guards.test.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.test.ts
  • src/main/ipc/gitlab-work-item-handlers.ts
  • src/main/ipc/gitlab.test.ts
  • src/main/ipc/hooks/register-worktree-hook-check-handler.ts
  • src/main/ipc/hooks/worktree-hook-check-background-gate.test.ts
  • src/main/ipc/hosted-review.test.ts
  • src/main/ipc/hosted-review.ts
  • src/main/ipc/worktrees-wsl-runtime-routing.test.ts
  • src/main/ipc/worktrees/create/register-worktree-prefetch-handler.ts
  • src/main/worktree-root-preparation.test.ts
  • src/main/worktree-root-preparation.ts
  • src/main/wsl/wsl-unc-access-gate.test.ts
  • src/main/wsl/wsl-unc-access-gate.ts
  • src/preload/api/agent-hook-api.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/github-work-item-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.test.tsx
  • 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.test.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-wsl-wake.test.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/right-sidebar/use-source-control-git-history.test.tsx
  • src/renderer/src/components/settings/use-settings-repo-scroll-effects.test.tsx
  • src/renderer/src/components/settings/use-settings-repo-scroll-effects.ts
  • src/renderer/src/components/task-page/github/task-page-github-landing-refresh-run.tsx
  • 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/runtime/runtime-hooks-client.ts
  • src/renderer/src/store/github/cache-model.ts
  • src/renderer/src/store/github/check-actions.ts
  • src/renderer/src/store/github/issue-actions.ts
  • src/renderer/src/store/github/pr-for-branch-ipc-fallback.ts
  • src/renderer/src/store/github/pull-request-execution.ts
  • src/renderer/src/store/github/request-coordination.ts
  • src/renderer/src/store/github/slice-types.ts
  • src/renderer/src/store/github/visible-hosted-review-refresh-targets.test.ts
  • src/renderer/src/store/github/work-item-aggregate-actions.ts
  • src/renderer/src/store/github/work-item-fetch-actions.ts
  • src/renderer/src/store/github/work-item-routing.ts
  • src/renderer/src/store/github/wsl-stopped-distro-poll-refusal.test.ts
  • src/renderer/src/store/slices/hosted-review-cache-state.ts
  • src/renderer/src/store/slices/hosted-review-card-refresh.ts
  • src/renderer/src/store/slices/hosted-review-request-lifetime.test.ts
  • src/renderer/src/store/slices/hosted-review-request-state.ts
  • src/renderer/src/store/slices/hosted-review.test.ts
  • src/renderer/src/store/slices/hosted-review.ts
  • src/renderer/src/web/preload-api/web-github-api.ts
  • src/shared/hosted-review.ts
  • src/shared/wsl-distro-not-running-refusal.ts
Walkthrough

The changes add WSL distro checks to selected main-process Git and provider reads. They add optional wake flags to local Git and GitHub requests, and distinguish user-visible reads from background polls in review and hook-check flows. Stopped or unverifiable distro refusals can preserve cached or displayed state. Settings hook checks retry after a timer or window focus or visibility event. Worktree preparation and speculative prefetch skip blocked distros.

Priority: Normal

Merge Risk: Moderate · previous review 8859b

A delayed checks poll can wake a stopped distro, and expected refusals produce repeated error logs. Fix these before merging. Existing worktree-root wake paths also remain.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 31.82% 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 summarizes the main change: background Git, GitHub, and GitLab reads no longer start stopped WSL distros, while explicit opens may do so.
Description check Passed The description is detailed and covers the required explanation, changes, rationale, testing, visual proof, scope, compatibility notes, and checklist. The Linked Issue section uses N/A instead of an i…
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 required explanation, changes, rationale, testing, visual proof, scope, compatibility notes, and checklist. The Linked Issue section uses N/A instead of an issue link, but the description references related tracked work and is otherwise substantially complete.

Full details: Docstring Coverage

Explanation

Docstring coverage is 31.82% 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 22 functions across 58 files.

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.

@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 0/5

[Medium impact] The change reaches automatic reads across several Windows WSL workflows.

The PR needs fixes before merging because automatic reads can still restart stopped distros, and typed multi-repo Tasks searches miss wake permission.

Findings

  1. P1 Commits restarts stopped distros ▶
  2. P1 Typed searches cannot start distros ▶
  3. P1 Stopped destination distros still start ▶
  4. P1 Background updates restart stopped distros ▶

Summary

The PR adds stopped-distro guards to background Git and hosted-review reads, while passing wake permission for explicit user actions.

  • Git reads check WSL before touching a stopped distro.
  • GitHub polls leave stopped WSL distros alone.
  • Hosted-review and GitLab polls leave stopped WSL distros alone.
  • Automatic setup checks wait instead of waking stopped WSL distros.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Read requested] --> B{Explicit user action?}
  B -->|Yes| C[Pass wake permission]
  C --> D[Read may start distro]
  B -->|No| E[Check whether distro runs]
  E -->|Running| F[Perform read]
  E -->|Stopped or unknown| G[Refuse or skip]
  G --> H[Keep cached data or retry later]
Loading

Reviews (5) · Last reviewed commit: "fix(wsl): an explicit review Refresh nev..." · Reviewed by Greptile

await Promise.all(store.getRepos().map((repo) => prepareLocalWorktreeRootForRepo(store, repo)))
await Promise.all(
store.getRepos().map(async (repo) => {
if (await blockedWslDistroForPath(repo.path, getWorktreeMirrorDistro(store, repo))) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Stopped destination distros still start

The new gate checks the repo path, not the configured worktree folder. If C:\repo has workspaceDir or worktreeBasePath set to \\wsl.localhost\Ubuntu\workspaces, this check passes without checking Ubuntu. computeWorkspaceRootAsync preserves that absolute path, and mkdir starts the stopped distro during the settings fan-out. Also check the destination before touching it, while keeping the existing gate before any WSL home probe.

@nwparker
nwparker force-pushed the nwparker/wsl-e9-git-readers branch from f9eca0a to f8eddc3 Compare October 28, 2026 23:12
@nwparker nwparker changed the title fix(wsl): keep background git and GitHub reads from booting a stopped distro fix(wsl): background Git, GitHub and GitLab reads never start a stopped distro; explicit opens may (E9) Oct 28, 2026
@nwparker

Copy link
Copy Markdown
Contributor Author

STATUS: adopted by wsl-e9-git. Head f8eddc3. Folded #35429 in: explicit opens (diff tab/Retry, Commits shown/Refresh, checks panel open/tab entry/Refresh/actions) now run under runAsWslUserAct; polls, timers, post-action refreshes, prefetches and fan-outs stay refused. Added the hosted-review card poll, the GitLab checks poll, the composer hook check, and renderer keep-last-data on refusal. Checks: tc, typecheck:ci, check:code-quality:changed, anti-slop, ast-grep and related suites all pass; the remaining failures (real-git, real-watcher, cross-version-wire, electron-serve) also fail on main.

lastAttemptAtRef.current = -Infinity
nextAttemptAtRef.current = -Infinity
forceNextFetchRef.current = false
wakeNextReadRef.current = true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Background updates restart stopped distros

wakeNextReadRef resets whenever requestIdentity changes, including when a background review poll returns a new headSha. If that response arrives after the user stops the distro, the next checks read sends wakeWslDistro: true for GitHub or omits background for GitLab. That starts the distro again without another click.

Keep resetting the request state when the head changes, but grant wake permission only when the user opens the panel, switches workspaces, or explicitly refreshes it.

Comment thread src/main/ipc/hosted-review.ts Resolved
Comment on lines +174 to +177
const wake =
(forceRefresh && taskRefreshNonce > 0) || selectedRepos.length === 1
? { wakeWslDistro: true }
: {}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Tasks refreshes restart stopped distros

With one selected repo, every run of this effect sends wakeWslDistro: true, not just opening Tasks. The effect also runs when the global workItemsInvalidationNonce changes, including when another repo's cached items are removed. That refresh can start the selected repo's stopped distro through the list or count request.

Track the opening action separately and leave later automatic refreshes background-only.

@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: e24937fa-1d0a-47a6-905c-5729b8d27184
Commits

Reviewing files that changed from the base of the PR and between 86def97 and de2f9db.

Files selected for processing: 77
  • 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-pr-refresh-handlers.ts
  • src/main/ipc/github-repo-access-guards.test.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.test.ts
  • src/main/ipc/gitlab-work-item-handlers.ts
  • src/main/ipc/gitlab.test.ts
  • src/main/ipc/hooks/register-worktree-hook-check-handler.ts
  • src/main/ipc/hooks/worktree-hook-check-background-gate.test.ts
  • src/main/ipc/hosted-review.test.ts
  • src/main/ipc/hosted-review.ts
  • src/main/ipc/worktrees-wsl-runtime-routing.test.ts
  • src/main/ipc/worktrees/create/register-worktree-prefetch-handler.ts
  • src/main/worktree-root-preparation.test.ts
  • src/main/worktree-root-preparation.ts
  • src/main/wsl/wsl-unc-access-gate.test.ts
  • src/main/wsl/wsl-unc-access-gate.ts
  • src/preload/api/agent-hook-api.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/github-work-item-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.test.tsx
  • 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.test.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-wsl-wake.test.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/right-sidebar/use-source-control-git-history.test.tsx
  • src/renderer/src/components/settings/use-settings-repo-scroll-effects.test.tsx
  • src/renderer/src/components/settings/use-settings-repo-scroll-effects.ts
  • src/renderer/src/components/task-page/github/task-page-github-landing-refresh-run.tsx
  • 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/runtime/runtime-hooks-client.ts
  • src/renderer/src/store/github/cache-model.ts
  • src/renderer/src/store/github/check-actions.ts
  • src/renderer/src/store/github/issue-actions.ts
  • src/renderer/src/store/github/pr-for-branch-ipc-fallback.ts
  • src/renderer/src/store/github/pull-request-execution.ts
  • src/renderer/src/store/github/request-coordination.ts
  • src/renderer/src/store/github/slice-types.ts
  • src/renderer/src/store/github/work-item-aggregate-actions.ts
  • src/renderer/src/store/github/work-item-fetch-actions.ts
  • src/renderer/src/store/github/work-item-routing.ts
  • src/renderer/src/store/github/wsl-stopped-distro-poll-refusal.test.ts
  • src/renderer/src/store/slices/hosted-review.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.

try {
const gitOptions = getWorktreeCreatePrefetchGitOptions(store, repo)
// Speculative: a composer opening is no act on the repo's WSL distro (E9).
if (await blockedWslDistroForPath(repo.path, gitOptions.wslDistro)) {

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 · Stability & Availability · Quick win

Supported by static analysis

Script executed:

cat src/main/ipc/worktrees/create/register-worktree-prefetch-handler.ts
rg -n 'prefetchWorktreeCreateBase|prepareLocalWorktreeRootForRepo|blockedWslDistroForPath' src/main --glob '!*.test.ts'

Repository: stablyai/orca

Length of output: 13516


Script executed:

set -eu
printf '%s\n' '--- prefetch implementation ---'
sed -n '1,240p' src/main/worktree-create-base-prefetch.ts
printf '%s\n' '--- checkout preparation ---'
sed -n '1,260p' src/main/worktree-create-preparation.ts
printf '%s\n' '--- worktree-root preparation ---'
sed -n '1,180p' src/main/worktree-root-preparation.ts
printf '%s\n' '--- WSL gate ---'
sed -n '1,180p' src/main/wsl/wsl-unc-access-gate.ts
printf '%s\n' '--- related root/settings symbols ---'
rg -n -F --glob '*.ts' -e 'worktreeBasePath' -e 'workspaceDir' -e 'getWorktreeMirrorDistro' -e 'prepareLocalWorktreeRootForRepo' src/main src/renderer || test "$?" -eq 1

Repository: stablyai/orca

Length of output: 41428


Script executed:

set -eu
printf '%s\n' '--- preparation pool definitions ---'
rg -n -F --glob '*.ts' -e 'export async function startPreparation' -e 'function startPreparation' -e 'workspaceRoot' src/main/worktree-create-preparation-pool.ts src/main/worktree-create-preparation*.ts src/main/git
printf '%s\n' '--- preparation pool ---'
sed -n '1,280p' src/main/worktree-create-preparation-pool.ts
printf '%s\n' '--- preparation worker and filesystem operations ---'
rg -n -F --glob '*.ts' -e 'startPreparation(' -e 'mkdir(' -e 'workspaceRoot' src/main/worktree-create-preparation.ts src/main/git/worktree-create-preparation.ts
sed -n '1,260p' src/main/git/worktree-create-preparation.ts

Repository: stablyai/orca

Length of output: 28069


Script executed:

set -eu
printf '%s\n' '--- worktree root resolution ---'
sed -n '100,295p' src/main/ipc/worktree-logic.ts
printf '%s\n' '--- host filesystem path conversion ---'
rg -n -F --glob '*.ts' -e 'export function toHostFilesystemPath' -e 'function toHostFilesystemPath' src/main
sed -n '1,180p' src/main/host-tree-removal.ts
printf '%s\n' '--- exact preparation block ---'
nl -ba src/main/worktree-create-preparation-pool.ts | sed -n '205,255p'
printf '%s\n' '--- exact WSL gate contract ---'
nl -ba src/main/wsl/wsl-unc-access-gate.ts | sed -n '15,95p'

Repository: stablyai/orca

Length of output: 17467


Check the worktree root before speculative preparation.

prefetchWorktreeCreateBase invokes prepareWorktreeCreateForRepo, which computes the settings-derived workspaceRoot and starts preparation for that root. The prefetch handler checks only repo.path and gitOptions.wslDistro. A WSL UNC worktreeBasePath or workspaceDir can remain unchecked, and mkdir can start its stopped distro. Check the resolved worktree root before starting speculative preparation, including when its distro differs from the Git distro.

await Promise.all(store.getRepos().map((repo) => prepareLocalWorktreeRootForRepo(store, repo)))
await Promise.all(
store.getRepos().map(async (repo) => {
if (await blockedWslDistroForPath(repo.path, getWorktreeMirrorDistro(store, repo))) {

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 · Stability & Availability · Quick win

Supported by static analysis

Script executed:

cat src/main/worktree-root-preparation.ts
rg -n 'blockedWslDistroForPath|getWorktreeMirrorDistro' src/main --glob '!*.test.ts'

Repository: stablyai/orca

Length of output: 9688


Script executed:

set -o pipefail
printf '%s\n' '--- worktree-root-preparation.ts ---'
nl -ba src/main/worktree-root-preparation.ts | sed -n '1,90p'
printf '%s\n' '--- base-to-head diff ---'
git diff --no-ext-diff --unified=80 0774fc9373125a554358b94ee7f558022c4a0ae1 de2f9db964cf3ad96d7f253cf388b138537650a8 -- src/main/worktree-root-preparation.ts
printf '%s\n' '--- wsl gate ---'
nl -ba src/main/wsl/wsl-unc-access-gate.ts | sed -n '1,150p'
printf '%s\n' '--- computeWorkspaceRootAsync and path settings ---'
rg -n -F -e 'computeWorkspaceRootAsync' -e 'getWorktreePathSettings' src/main/ipc/worktree-logic.ts src/main --glob '*.ts' --glob '!*.test.ts'
nl -ba src/main/ipc/worktree-logic.ts | sed -n '1,240p'
printf '%s\n' '--- worktree-root tests and references ---'
rg -n -F -e 'prepareLocalWorktreeRoot' -e 'workspaceDir' -e 'worktreeBasePath' src/main --glob '*test*.ts' --glob '*.spec.ts' || test "$?" -eq 1

Repository: stablyai/orca

Length of output: 41731


Script executed:

set -o pipefail
printf '%s\n' '--- remaining worktree logic ---'
nl -ba src/main/ipc/worktree-logic.ts | sed -n '121,245p'
printf '%s\n' '--- mirror distro resolution ---'
nl -ba src/main/project-runtime-git-options.ts | sed -n '80,135p'
printf '%s\n' '--- WSL path helpers ---'
rg -n -F -e 'function resolveWslRepoWorktreeBasePath' -e 'function isWslUncPath' -e 'function parseWslUncPath' -e 'function workspaceRootForMirrorHome' src/shared src/main
nl -ba src/shared/wsl-paths.ts | sed -n '1,180p'
printf '%s\n' '--- focused worktree logic tests ---'
nl -ba src/main/ipc/worktree-logic-wsl.test.ts | sed -n '235,335p'
printf '%s\n' '--- root preparation tests ---'
rg -n -F -e 'worktree-root-preparation' -e 'prepareLocalWorktreeRootsForRepos' src/main --glob '*test*.ts' --glob '*.spec.ts' || test "$?" -eq 1

Repository: stablyai/orca

Length of output: 22972


Script executed:

set -o pipefail
printf '%s\n' '--- effective worktree base path ---'
rg -n -F -e 'function getEffectiveWorktreeBasePath' -e 'function getRepoWorktreeBasePath' src/main/ipc/worktree-logic.ts
nl -ba src/main/ipc/worktree-logic.ts | sed -n '245,330p'
printf '%s\n' '--- worktree root preparation tests ---'
nl -ba src/main/worktree-root-preparation.test.ts | sed -n '1,190p'
printf '%s\n' '--- workspace-dir policy helper ---'
rg -n -F -e 'shouldMirrorWorkspaceDirInsideWsl' -e 'resolveMirrorDistro' src/main/ipc/worktree-logic.ts src/main

Repository: stablyai/orca

Length of output: 11105


Gate the destination root as well as the repo path.

An explicit WSL UNC workspaceDir or worktreeBasePath is a supported destination. The current gate checks only repo.path, so it can miss the destination distro. prepareLocalWorktreeRootForRepo can then call mkdir on the UNC root while the distro is stopped. A WSL UNC filesystem touch can start that distro.

This behavior existed before this PR, but the new gate does not cover it. The PR still fails to prevent this background settings-preparation path. Check the effective destination before calling mkdir.

setComments([])
}
if (!isPanelVisible || (!isGitLabReview && !prNumber)) {
wakeNextReadRef.current = true

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

Supported by static analysis

Script executed:

sed -n 1,130p src/renderer/src/components/right-sidebar/checks-panel/use-checks-detail-timer.ts

Repository: stablyai/orca

Length of output: 4799


Script executed:

sed -n '120,280p' src/renderer/src/components/right-sidebar/checks-panel/use-checks-detail-timer.ts
printf '\n--- poller references and implementation ---\n'
rg -n -F --glob '*.ts' -e 'export function installWindowVisibilityTimeoutPoller' -e 'function installWindowVisibilityTimeoutPoller' src/renderer/src
poller=$(rg -l -F --glob '*.ts' -e 'export function installWindowVisibilityTimeoutPoller' -e 'function installWindowVisibilityTimeoutPoller' src/renderer/src | head -n 1)
if [ -n "$poller" ]; then
  printf '\n--- %s ---\n' "$poller"
  sed -n '1,260p' "$poller"
fi

Repository: stablyai/orca

Length of output: 4988


Do not retain wake permission for a later poll.

When the panel reopens before nextAttemptAtRef, the poller's immediate read returns at the cooldown check. The code consumes wakeNextReadRef only after that check. The poller then schedules another read, which can call fetchChecks with wakeWslDistro: true.

Consume the permission before the cooldown return.

Suggested fix
         if (inFlightRef.current?.identity === requestIdentity) {
           return
         }
+        const shown = wakeNextReadRef.current
+        wakeNextReadRef.current = false
         const now = Date.now()
         const nextAttemptAt = nextAttemptAtRef.current
         if (
@@
         const token = Symbol()
         inFlightRef.current = { identity: requestIdentity, token }
-        const shown = wakeNextReadRef.current
-        wakeNextReadRef.current = false
         lastAttemptAtRef.current = now

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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Minor · Suppress logs for expected WSL refusals. · hosted-review.ts:270

src/renderer/src/store/slices/hosted-review.ts:270
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Suppress logs for expected WSL refusals.

When a stopped WSL distro refuses a background poll, return the preserved cached review without logging the recognized refusal. Continue logging other failures.

Suggested fix
+import { isWslDistroNotRunningRefusal } from '../../../../shared/wsl-distro-not-running-refusal'
+
...
-          console.error('Failed to fetch hosted review:', error)
+          if (!isWslDistroNotRunningRefusal(error)) {
+            console.error('Failed to fetch hosted review:', error)
+          }

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: 41b7800f-fd35-4a5e-b845-b5f126ccc435
Commits

Reviewing files that changed from the base of the PR and between de2f9db and 8859b31.

Files selected for processing: 11
  • src/main/ipc/hosted-review.test.ts
  • src/main/ipc/hosted-review.ts
  • src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-manual-refresh.tsx
  • src/renderer/src/store/github/visible-hosted-review-refresh-targets.test.ts
  • src/renderer/src/store/slices/hosted-review-cache-state.ts
  • src/renderer/src/store/slices/hosted-review-card-refresh.ts
  • src/renderer/src/store/slices/hosted-review-request-lifetime.test.ts
  • src/renderer/src/store/slices/hosted-review-request-state.ts
  • src/renderer/src/store/slices/hosted-review.test.ts
  • src/renderer/src/store/slices/hosted-review.ts
  • src/shared/hosted-review.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.

… distro

Git history, diff and status-follower reads, GitHub issue/work-item/check
polls, chat link existence checks, the composer's create-base prefetch,
the worktree-root fan-out and the Settings/Automations orca.yaml previews
now refuse or skip a stopped WSL distro instead of starting it (E9).
… (E9)

Folds the parallel G1-G6 work into this branch and splits background
reads from user acts:

- An explicit open runs as a user act for its distro and may boot it:
  showing a diff tab or its Retry, showing Commits or its Refresh,
  opening the checks panel or entering its tab, checks Refresh, a check
  action, and linking or creating a PR. Main takes a wakeWslDistro flag
  on git:diff, git:branchDiff, git:commitDiff, git:history and
  gh:prChecks and runs those reads under runAsWslUserAct.
- Polls, timers, refreshes after Git actions, prefetches and fan-outs
  stay background and are refused while the distro is stopped.
- Also gated: the hosted-review card poll for every provider, the GitLab
  checks-panel poll (background flag), and the composer's open-time
  orca.yaml check (Create re-checks in the foreground).
- Pollers keep the data they already show on a refusal: the issue on a
  card, the checks list, an open diff and loaded submodule children, and
  stop logging it.
… link-check gating (E9)

- Link existence checks (shell:pathsExist / pathExists) are no longer
  gated here: answering "missing" cached chat and terminal links as
  absent and toasted "File not found" on markdown link clicks. The
  pathsExist refusal lives in its own PR, which throws instead.
- Settings no longer sits on "checking" forever: a repo whose distro
  refused the background check is re-asked on window focus, on
  visibility, and after 10 s, until it answers. An unverifiable distro is
  now marked (wsl-distro-unverifiable) and treated as unread too, instead
  of being stored as "no orca.yaml".
- The sidebar issue poll and the Tasks list and count refuse with "Open a
  terminal in it to start it", since their Retry is itself a background
  read; the checks panel keeps "Retry", whose Refresh is a user act.
…kups may start a stopped distro (E9)

- Tasks: a Refresh, Retry or search, or Tasks opened on a single repo,
  passes wakeWslDistro through gh:listWorkItems and gh:countWorkItems
  (IPC only; the RPC twins and web routes drop it). A multi-repo open
  stays background. Their refusal says "Retry" again; only the sidebar
  issue poll says "Open a terminal".
- hostedReview:forBranch wakes for an interactive request (the checks
  panel's manual Refresh), so GitLab, Bitbucket, Azure DevOps and Gitea
  reviews with nothing cached can load.
- gh:prForBranch, the renderer's fallback when refreshPRNow is missing,
  is gated like the other card polls; a manual lookup wakes, matching
  refreshPRNow's manual-only rule. The fallback call moves into its own
  module, built from the refresh candidate.
… status (E9)

hostedReview:forBranch woke on admissionTier 'interactive', but the
visible-review scheduler sends 'interactive' for the selected card on a
timer, so that poll restarted a stopped distro every interval. The wake
is now an explicit wakeWslDistro flag (desktop IPC only). The card
refresh helper sets it, since every caller follows a user act (the
checks panel's manual Refresh, or a review created, linked or edited),
and the manual Refresh also wakes its pre-refresh git status.
admissionTier is back to priority only.
fetchHostedReviewForBranch let a forced card Refresh join an in-flight
forced scheduler poll, since the join only compared force. On a stopped
WSL distro that poll is refused, so the click got the refusal. The
in-flight entry now records the wake, and a waking request joins only a
waking flight; a poll may still join an explicit Refresh.
@nwparker
nwparker force-pushed the nwparker/wsl-e9-git-readers branch from 8859b31 to 8db6a06 Compare October 29, 2026 00:18
}
void refreshGitHistoryRef.current()
// The user is looking at Commits; refreshes after Git actions stay background (E9).
void refreshGitHistoryRef.current(SHOWN_HISTORY_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.

P1 Commits restarts stopped distros

useSourceControlGitHistory grants wake permission whenever compareBaseRef changes, not just when the user opens Commits. A review poll started before the distro stops can return afterward with a changed PR target branch. That changes compareBaseRef and starts the stopped distro through git:history, without another click.

Keep the automatic refresh, but grant wake permission only for opening Commits, switching workspaces, or pressing Refresh.

Comment on lines +175 to +178
const wake =
(forceRefresh && taskRefreshNonce > 0) || selectedRepos.length === 1
? { wakeWslDistro: true }
: {}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Typed searches cannot start distros

Typing a search on multi-repo Tasks does not get wake permission. The search applies automatically after 750 ms, but commitTaskSearch only updates appliedTaskSearch; it does not change taskRefreshNonce. This condition therefore sends no wake flag, and the new main-process guard refuses reads from stopped distros.

Track an applied user search separately from opening the multi-repo page so typing works without an extra Enter or Retry.

@nwparker
nwparker merged commit 8c3551b into main Oct 29, 2026
57 of 58 checks passed
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