Skip to content

fix(wsl): Source Control's PR push-target and Create PR checks never start a stopped distro - #35885

Merged
nwparker merged 3 commits into
mainfrom
nwparker/e9-resolve-pr-base-gate
Oct 29, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/e9-resolve-pr-base-gate

Conversation

@nwparker

@nwparker nwparker commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​265 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​261
Prod 17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​211 $\color{#cf222e}{\Huge{\mathbf{−}}}$​84 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​127

ELI5

If you stop a WSL distro and then look at Source Control for one of its workspaces, Orca starts the distro again. It does that to check the linked PR's push target and whether "Create PR" is possible. Now both checks leave a stopped distro alone. Pressing Create PR, or creating or launching a workspace from a PR, still starts it, because those are your own actions.

What Changed

  • PR start point (worktrees:resolvePrBase over IPC, worktree.resolvePrBase for paired clients):
    • Before: Source Control's push-target ensure for a linked PR (resolveGitHubReviewPushTarget) ran this. It read the repo's .git/config over \\wsl.localhost and ran gh pr view and git in the distro.
    • After: a new resolvePrStartPointUnlessWslStopped checks the distro first (guardWslUncPathAccess on the repo path and the project's WSL git distro). A stopped or unverifiable distro returns the existing start-point failure shape, { error }, with the stopped-distro text. The push-target ensure already logs that as "no target yet".
    • Creating or launching from a PR (resolveGitHubPrStartPointForRepo, used by the composer and direct launch) passes wakeWslDistro: true.
  • Create PR eligibility (hostedReview:getCreationEligibility and hostedReview.getCreationEligibility):
    • Before: Source Control ran this on mount, ungated. It listed worktrees and checked the remote in the distro.
    • After: it's gated the same way. A refusal rejects with the stopped-distro error, which every caller already catches, falling back to local guidance.
    • The Create PR click path (use-create-pr-intent-probes) passes wakeWslDistro: true.
  • GitLab MR start point (worktrees:resolveMrBase and worktree.resolveMrBase, which both go through resolveRuntimeGitLabWorktreeBase):
    • The same push-target ensure resolves a linked GitLab MR. That path ran glab and git in the distro, ungated.
    • It's now gated with the same helper. Picking an MR to create from (gitlab-provider-selection) passes wakeWslDistro: true.
  • All three RPCs gain an optional wakeWslDistro, and older hosts drop it.

Why

The real-WSL guard (#35590) isolated this with a workspace focused, the distro stopped, and the sidebar switched to Source Control. The first touch, about 8 ms after the switch, was .git stat → getGitHubApiRepositoryForRemote → getWorkItem → resolveGitHubPrStartPoint (pr-start-point.ts:66) → the worktrees:resolvePrBase handler. That was followed by gh pr view 2 in the distro, and concurrently by git worktree list from hostedReview:getCreationEligibility. The distro was running about 0.8 s later.

Gating at the handlers covers every background caller. Only the paths that are the user's own action (create or launch from a PR, Create PR) are marked as user acts.

Flag-off: covers bridge mode, where the repo path is \\wsl.localhost, and host mode, through the project's WSL git distro.
User-risk: while a distro is stopped, Source Control shows no push target for the linked PR or MR and falls back to local Create PR guidance. Both return once the distro runs. Pressing Create PR or creating from a PR still starts the distro.

Linked Issue

Fixes #

Visual Proof

N/A. No new UI. A stopped distro shows the existing fallback states.

Testing

  • I manually tested these changes locally

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

  • pr-start-point-wsl-gate.test.ts, using the real gate with a simulated Windows platform:

    • Stopped (UNC path, or a host path with WSL git) and unverifiable distros refuse without resolving.
    • A wake resolves.
    • Host repos and running distros resolve.
  • hosted-review.test.ts: the mount-time eligibility read is refused for a stopped distro and runs nothing; Create PR's wake runs it.

  • worktree.test.ts (RPC): wakeWslDistro: true reaches the runtime, and a non-boolean value is dropped.

  • github-pr-start-point.test.ts: create-from-PR passes wakeWslDistro: true over IPC and RPC. launch-work-item-direct.test.ts is updated to match.

  • runtime-gitlab-worktree-base-wsl-gate.test.ts:

    • The MR push-target ensure is refused for a stopped distro and touches nothing.
    • Creating from the MR resolves.
    • The worktree.resolveMrBase wake reaches the runtime, and non-boolean values are dropped.

All 42 test files that touch these surfaces pass, as do pnpm tc, typecheck:ci, the RPC contract tests, check:code-quality:changed and anti-slop oxlint. A real-WSL probe with this commit is running.

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

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)

…start a stopped distro

Showing Source Control resolved the linked PR's push target
(worktrees:resolvePrBase) and its Create PR eligibility
(hostedReview:getCreationEligibility); both read the repo's git config over
\\wsl.localhost and ran git and gh in the distro, starting a stopped one
(E9). Both now refuse a stopped distro unless the user is creating or
launching from the PR, or pressed Create PR (optional wakeWslDistro), in
the IPC handlers and their runtime twins.
@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 1 minute.

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: 36cbb58b-9d6f-4372-99c2-f3a696ebc6b7
Commits

Reviewing files that changed from the base of the PR and between a50b996 and 21584b8.

Files selected for processing: 24
  • src/main/github/pr-start-point-wsl-gate.test.ts
  • src/main/github/pr-start-point-wsl-gate.ts
  • src/main/ipc/hosted-review.test.ts
  • src/main/ipc/hosted-review.ts
  • src/main/ipc/worktrees/create/register-review-base-handlers.ts
  • src/main/runtime/orca-runtime-test-mocks/setup.spec.ts
  • src/main/runtime/rpc/methods/hosted-review.ts
  • src/main/runtime/rpc/methods/worktree.test.ts
  • src/main/runtime/rpc/methods/worktree.ts
  • src/main/runtime/runtime-github-worktree-base.ts
  • src/main/runtime/runtime-gitlab-worktree-base-wsl-gate.test.ts
  • src/main/runtime/runtime-gitlab-worktree-base.ts
  • src/main/runtime/runtime-hosted-review-commands.ts
  • src/main/runtime/workspaces/workspace-metadata.ts
  • src/preload/api/worktree-api.ts
  • src/renderer/src/components/right-sidebar/source-control/review/use-create-pr-intent-probes.ts
  • src/renderer/src/hooks/composer-state/gitlab-provider-selection.ts
  • src/renderer/src/lib/github-pr-start-point.test.ts
  • src/renderer/src/lib/github-pr-start-point.ts
  • src/renderer/src/lib/launch-work-item-direct.test.ts
  • src/renderer/src/web/preload-api/web-worktrees-api.ts
  • src/shared/hosted-review.ts
  • src/shared/rpc-contract/hosted-review-params.ts
  • src/shared/rpc-contract/worktree-params.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: 4/5

[Medium impact] The change affects WSL-backed review lookups across local and paired-client Source Control workflows.

The PR still needs the mobile MR creation fix before merging.

Findings

  1. P1 Mobile MR creation stops ▶
  2. P2 PR target stays missing ▶

Summary

This PR guards background PR, MR, and Create PR checks so they leave stopped WSL distros alone.

  • Source Control leaves stopped WSL distros alone during review lookups.
  • Create PR eligibility checks leave stopped WSL distros alone.

Reviews (3) · Last reviewed commit: "test(runtime): let the mocked running ga..." · Reviewed by Greptile

Comment on lines +25 to +27
if (error instanceof WslDistroStoppedError) {
// Uncoded: the English text is the refusal contract, and the push-target ensure only logs it.
return { error: wslDistroStoppedMessage(error.distro, false) }

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 PR target stays missing

After this refusal, starting the distro outside Orca does not retry the linked PR's push-target lookup. The caller turns { error } into undefined, and its only calling effect does not watch distro availability. With the same workspace and Source Control panel open, the target stays missing until another effect dependency changes or the panel remounts.

Add a retry when the distro becomes available, without letting background checks start it.

Source Control's push-target ensure also resolves a linked GitLab MR
(worktrees:resolveMrBase / worktree.resolveMrBase), which read the repo and
ran glab and git in a stopped distro. It now refuses unless the user is
creating from the MR, which passes wakeWslDistro.
Comment on lines +58 to +61
return resolvePrStartPointUnlessWslStopped(
{ path: repo.path, wslDistro: localGitExecOptions.wslDistro },
{ wakeWslDistro: args.wakeWslDistro },
() => resolveGitLabMrBaseInRepo(repo, args, localGitExecOptions, localWorktreeGitOptions)

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 Mobile MR creation stops

The new guard blocks explicit mobile create actions when the paired Windows host's WSL distro is stopped. Both resolveComposerMrBase and the Tasks create flow call worktree.resolveMrBase without wakeWslDistro. The Tasks flow then throws on the returned error before creating the workspace.

Pass wakeWslDistro: true from these explicit mobile actions, just as the desktop composer does.

…s too

Runtime specs fake win32 with no wsl.exe and mock blockedWslDistroForPath
to running; the real guard calls its own module's check, so the PR-base,
MR-base and eligibility gates refused there. The guard mock now asks the
mocked check, keeping per-test overrides working.
@nwparker
nwparker merged commit 31b672e into main Oct 29, 2026
52 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