Repository navigation
fix(wsl): Source Control's PR push-target and Create PR checks never start a stopped distro - #35885
Conversation
…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.
|
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 1 minute. 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 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. FindingsSummaryThis PR guards background PR, MR, and Create PR checks so they leave stopped WSL distros alone.
Reviews (3) · Last reviewed commit: "test(runtime): let the mocked running ga..." · Reviewed by Greptile |
| 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) } |
There was a problem hiding this comment.
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.
| return resolvePrStartPointUnlessWslStopped( | ||
| { path: repo.path, wslDistro: localGitExecOptions.wslDistro }, | ||
| { wakeWslDistro: args.wakeWslDistro }, | ||
| () => resolveGitLabMrBaseInRepo(repo, args, localGitExecOptions, localWorktreeGitOptions) |
There was a problem hiding this comment.
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.
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
worktrees:resolvePrBaseover IPC,worktree.resolvePrBasefor paired clients):resolveGitHubReviewPushTarget) ran this. It read the repo's.git/configover\\wsl.localhostand rangh pr viewand git in the distro.resolvePrStartPointUnlessWslStoppedchecks the distro first (guardWslUncPathAccesson 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".resolveGitHubPrStartPointForRepo, used by the composer and direct launch) passeswakeWslDistro: true.hostedReview:getCreationEligibilityandhostedReview.getCreationEligibility):use-create-pr-intent-probes) passeswakeWslDistro: true.worktrees:resolveMrBaseandworktree.resolveMrBase, which both go throughresolveRuntimeGitLabWorktreeBase):gitlab-provider-selection) passeswakeWslDistro: true.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
.gitstat →getGitHubApiRepositoryForRemote→getWorkItem→resolveGitHubPrStartPoint(pr-start-point.ts:66) → theworktrees:resolvePrBasehandler. That was followed bygh pr view 2in the distro, and concurrently bygit worktree listfromhostedReview: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: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: truereaches the runtime, and a non-boolean value is dropped.github-pr-start-point.test.ts: create-from-PR passeswakeWslDistro: trueover IPC and RPC.launch-work-item-direct.test.tsis updated to match.runtime-gitlab-worktree-base-wsl-gate.test.ts:worktree.resolveMrBasewake 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:changedand anti-slop oxlint. A real-WSL probe with this commit is running.Review
Agent skill upstream boundary
Notes
wakeWslDistrofor paired clients: these three fields carry only explicit user acts (create or launch from a PR or MR, and the Create PR click), and stripping them would refuse that action outright on a paired client whose host distro is stopped. This follows fix(wsl): Settings' issue-command and path checks never start a stopped distro #35829's optionalrepo.issueCommandRead/issueCommandWritewake. Background callers never send it, and older clients sending nothing are refused, which is safe.hostedReview:getCreationEligibilityserves every provider and is gated here.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)