You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(wsl): runtime RPC background reads never start a stopped WSL distro (E9) - #35430
A phone, the web client or the orca CLI connected to this computer keeps asking for details in the background: commit history, submodules, ignored files, conflict state, upstream status, whether linked files exist. When the repo lives in a stopped WSL distro, each of those questions started the distro again. The desktop app already stopped doing that. Now the same background questions from other clients also leave a stopped distro alone.
What Changed
Before: the desktop IPC follower handlers refuse while the distro is stopped. Their runtime RPC twins did not, so a phone left on a workspace booted the distro again right after the user terminated it.
After: seven runtime RPC reads that no user is looking at now check the existing settled running gate (assertWslUncPathRunning, through assertRuntimeReadWslDistroRunning) before running Git:
git.history
git.submoduleStatus
git.checkIgnored
git.conflictOperation
git.mutationInFlight
git.upstreamStatus
files.pathsExist (link checks on render and retry timers)
The gate covers both a UNC worktree and a Windows-path repo whose Git runs in WSL.
Not gated, on purpose:
git.status: a client viewing the workspace is a user act, and its status is that client's implicit wake. Old clients keep working unchanged.
diffs and compares: user-opened views
files.read, readPreview, readChunk, readDocPreview and readDir: explicit taps or browsing
files.stat: the browser download path uses it to check whether a file name is taken, and a refusal there would read as "free" and risk overwriting a file
writes, fetch and pull
SSH and remote-runtime hosts, which never involve WSL
Why
Remote wire compatibility: the refusal is the existing WslDistroStoppedError, which mapRuntimeError already turns into runtime_error with the readable message "WSL distro 'X' is not running. Retry, or open a terminal in it, to start it." Every released client already handles that, so there's no new code, opcode or parameter.
The alternative was an optional wakeWslDistro RPC param, so new clients could flag user acts and everything else could be gated. It's left as a follow-up, only if this turns out not to be enough.
Linked Issue
N/A (internal WSL E9 audit, PR 4 of the plan: item G7).
Visual Proof
N/A. A running distro behaves as before. A stopped one returns the existing error text for these follower reads instead of booting; showing that needs a Windows WSL host.
Testing
New runtime-wsl-background-read-gate.test.ts:
the seven background reads refuse before touching the distro
the user acts never ask the gate: git.status, git.diff, git.branchCompare, files.read, files.readPreview, files.readDir and files.stat
a Windows-path repo whose Git runs in WSL is gated
SSH hosts never ask WSL
the refusal maps to { code: 'runtime_error', message }
8 of its 17 cases fail with the gate stubbed out: the seven refusals and the Windows-path case. The other 9 (the user-act, SSH and wire-shape checks) pass by design.
orca-runtime-git, orca-runtime-files-mobile-explorer-reads, and the files and git RPC method suites pass.
pnpm tc, pnpm run typecheck:ci, pnpm run check:code-quality:changed, the anti-slop oxlint and ast-grep pass.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Flag-off: these paths don't check ORCA_INTERNAL_WSL_HOSTS, so the change ships to everyone pairing a phone, web or CLI client with a desktop that has WSL repos. A running distro is unchanged, apart from at most one shared wsl --list --running per minute.
User-risk: low. On a stopped distro, a remote client's history, submodule, upstream or link-existence reads show the stopped message until the client's own status read (which wakes the distro) or a terminal starts it.
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: unaffected. Only local execution hosts are gated.
Mobile: these reads use the same runtime_error path as today's other read failures.
Mobile file reads stay ungated.
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)
nwparker
changed the title
fix(wsl): runtime RPC git and file reads never start a stopped WSL distro (E9)
fix(wsl): runtime RPC Git followers never start a stopped WSL distro (E9)
Oct 28, 2026
Selected runtime Git reads now check that a local WSL distro is running before proceeding. The gate skips non-local execution hosts. Submodule status, ignored-path checks, history, conflict-operation detection, and mutation-in-flight queries use the gate. git.status still resolves its target directly. Tests cover stopped distros, SSH-host behavior, and runtime error mapping.
Priority: Normal
Merge Risk: Low · previous review f9981
The new check can block some Git reads for Windows linked worktrees while WSL is stopped, even though their Git runs on the host. It can also let a read through in the short window after a distro stops without notice. Both issues are limited in scope and recoverable, so the change is mergeable with follow-up.
Pre-merge checks: 5
Check name
Status
Explanation
Docstring Coverage
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Title check
The title clearly and concisely describes the main change: preventing runtime RPC background reads from starting a stopped WSL distro.
Description check
The description includes the required sections, explains the user impact and implementation, documents testing, and addresses compatibility and platform scope. The stated scope and test counts differ …
Full details: Docstring Coverage
Explanation
Docstring coverage is 100.00% which is sufficient. 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 1 functions across 3 files.
Full details: Description check
Explanation
The description includes the required sections, explains the user impact and implementation, documents testing, and addresses compatibility and platform scope. The stated scope and test counts differ from the provided PR objectives and should be reconciled, but the description is otherwise complete.
Finishing Touches
📝 Generate docstrings
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.
The reason will be displayed to describe this comment to others. Learn more.
Local conflict checks fail
For a Windows-local linked worktree whose project has wslDistro set, this gate rejects git.conflictOperation when that distro is stopped. But detectConflictOperation only reads the local .git pointer and Windows-local metadata files in this case. It does not run Git in WSL.
Remote clients therefore lose a previously working conflict check until an unrelated distro starts. Account for the paths the operation actually touches before applying the distro override.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Supported by static analysis
Script executed:
sed -n '1,120p' src/main/runtime/runtime-git-status-commands.ts
sed -n '1,140p' src/main/git/wsl-linked-worktree-git-routing.ts
rg -n 'localGitOptionsForTarget' src/main | head -20
rg -n 'assertWslUncPathRunning' src/main | head -30
Repository: stablyai/orca
Length of output: 14634
Script executed:
set -e
echo"=== runtime-wsl-background-read-gate.ts ==="
cat -n src/main/runtime/runtime-wsl-background-read-gate.ts
echo"=== runtime-git-command-target.ts (lines 1-110) ==="
sed -n '1,110p' src/main/runtime/runtime-git-command-target.ts | cat -n
echo"=== wsl-unc-access-gate.ts (lines 60-140) ==="
sed -n '60,140p' src/main/wsl/wsl-unc-access-gate.ts | cat -n
echo"=== references to wsl-linked-worktree routing in runtime/ and git/ ==="
rg -n -F -e 'isWslLinkedWorktreeGitRoutingCandidate' -e 'shouldUseWslLinkedWorktreeHostGit' -e 'wsl-linked-worktree-git-routing' -- src/main ||test"$?" -eq 1
Repository: stablyai/orca
Length of output: 12144
Script executed:
set -e
echo"=== wsl-unc-access-gate.ts (lines 1-60) ==="
sed -n '1,60p' src/main/wsl/wsl-unc-access-gate.ts | cat -n
echo"=== wsl-linked-worktree-git-routing.ts (lines 220-280) ==="
sed -n '220,280p' src/main/git/wsl-linked-worktree-git-routing.ts | cat -n
Repository: stablyai/orca
Length of output: 5295
Route Windows linked worktrees to host Git before the WSL distro gate.
resolveGatedGitTarget passes the configured wslDistro to the stopped-distro gate for every local target, without checking the Git route. For a Windows linked worktree, the cached route can send Git to the Windows host. The gate still throws WslDistroStoppedError when that distro is stopped, so the five gated reads fail even though Git does not run in WSL.
Resolve the route first and pass the distro to the gate only when Git runs in WSL. prepareWslLinkedWorktreeGitRouting fills the route cache asynchronously. If the route cannot be determined, it returns false, and the gate keeps its current WSL behavior.
Require a fresh running-state probe after an unreported stop.
assertRuntimeReadWslDistroRunning reaches assertWslUncPathRunning, which accepts a confirmed running-list observation from the previous 60 seconds. Stop invalidation occurs only after a later probe detects that the distro is missing. If wsl --terminate occurs before a watcher, relay, or read signals the stop, the next runtime Git read can reuse the stale observation and reach an operation that can boot the stopped distro.
Require these runtime reads to perform a fresh confirmed running-state check instead of using the 60-second lease.
…ro (E9)
Paired phones, web clients and the CLI poll reads nobody is looking at:
history, submodule status, ignored paths, the conflict operation, the
in-flight mutation probe, upstream status and link-existence checks.
Their desktop IPC twins already refuse a stopped distro; these did not, so
a client left open booted the distro again after the user terminated it.
Each now asks the settled running gate first and refuses with
WslDistroStoppedError, which reaches every client version as the existing
runtime_error.
User acts stay ungated: git.status (a viewing client's implicit wake),
diffs and compares (opened views), file reads and directory listing
(taps and browsing), and stat (the download name check).
nwparker
changed the title
fix(wsl): runtime RPC Git followers never start a stopped WSL distro (E9)
fix(wsl): runtime RPC background reads never start a stopped WSL distro (E9)
Oct 28, 2026
The reason will be displayed to describe this comment to others. Learn more.
Link checks still start WSL
files.pathsExist checks WSL too late for folder and floating workspaces. resolveFileExplorerPaths first calls resolveRuntimeFileTarget, which reads the folder or configured floating directory with stat before returning.
If that directory is a stopped distro's UNC path, the background link check starts the distro before this gate runs. Check WSL before those directory reads, and add a test using the real target resolver.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
A phone, the web client or the
orcaCLI connected to this computer keeps asking for details in the background: commit history, submodules, ignored files, conflict state, upstream status, whether linked files exist. When the repo lives in a stopped WSL distro, each of those questions started the distro again. The desktop app already stopped doing that. Now the same background questions from other clients also leave a stopped distro alone.What Changed
Before: the desktop IPC follower handlers refuse while the distro is stopped. Their runtime RPC twins did not, so a phone left on a workspace booted the distro again right after the user terminated it.
After: seven runtime RPC reads that no user is looking at now check the existing settled running gate (
assertWslUncPathRunning, throughassertRuntimeReadWslDistroRunning) before running Git:git.historygit.submoduleStatusgit.checkIgnoredgit.conflictOperationgit.mutationInFlightgit.upstreamStatusfiles.pathsExist(link checks on render and retry timers)The gate covers both a UNC worktree and a Windows-path repo whose Git runs in WSL.
Not gated, on purpose:
git.status: a client viewing the workspace is a user act, and its status is that client's implicit wake. Old clients keep working unchanged.files.read,readPreview,readChunk,readDocPreviewandreadDir: explicit taps or browsingfiles.stat: the browser download path uses it to check whether a file name is taken, and a refusal there would read as "free" and risk overwriting a fileWhy
Remote wire compatibility: the refusal is the existing
WslDistroStoppedError, whichmapRuntimeErroralready turns intoruntime_errorwith the readable message "WSL distro 'X' is not running. Retry, or open a terminal in it, to start it." Every released client already handles that, so there's no new code, opcode or parameter.The alternative was an optional
wakeWslDistroRPC param, so new clients could flag user acts and everything else could be gated. It's left as a follow-up, only if this turns out not to be enough.Linked Issue
N/A (internal WSL E9 audit, PR 4 of the plan: item G7).
Visual Proof
N/A. A running distro behaves as before. A stopped one returns the existing error text for these follower reads instead of booting; showing that needs a Windows WSL host.
Testing
New
runtime-wsl-background-read-gate.test.ts:git.status,git.diff,git.branchCompare,files.read,files.readPreview,files.readDirandfiles.stat{ code: 'runtime_error', message }8 of its 17 cases fail with the gate stubbed out: the seven refusals and the Windows-path case. The other 9 (the user-act, SSH and wire-shape checks) pass by design.
orca-runtime-git,orca-runtime-files-mobile-explorer-reads, and thefilesandgitRPC method suites pass.pnpm tc,pnpm run typecheck:ci,pnpm run check:code-quality:changed, the anti-slop oxlint and ast-grep pass.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Flag-off: these paths don't check
ORCA_INTERNAL_WSL_HOSTS, so the change ships to everyone pairing a phone, web or CLI client with a desktop that has WSL repos. A running distro is unchanged, apart from at most one sharedwsl --list --runningper minute.User-risk: low. On a stopped distro, a remote client's history, submodule, upstream or link-existence reads show the stopped message until the client's own status read (which wakes the distro) or a terminal starts it.
Agent skill upstream boundary
Notes
runtime_errorpath as today's other read failures.Status
Ready for review. Not merged.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)