Skip to content

feat(wsl): run Git for Windows for a WSL project on a Windows drive (D1c-2) - #33090

Merged
nwparker merged 8 commits into
mainfrom
nwparker/wsl-d1c-2-windows-git
Oct 28, 2026
Merged

nwparker merged 8 commits into
mainfrom
nwparker/wsl-d1c-2-windows-git

Conversation

@nwparker

@nwparker nwparker commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​489 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​485
Prod 18 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​415 $\color{#cf222e}{\Huge{\mathbf{−}}}$​41 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​374

ELI5

Some Windows projects live on C:\ but are set to run in WSL. For those, Orca currently runs every Git command through WSL on the Windows drive, which is about 300 times slower than Git for Windows and misses changes made from Windows. This PR adds a switch for such a project: Orca uses Git for Windows, and its terminals and agents keep running in WSL.

What Changed

  • New field. A project's WSL runtime setting can carry git: 'windows-host' (src/shared/project-execution-runtime.ts). With it set:
    • Orca's own Git uses Windows. That includes source control, status, and worktree commands.
    • New worktrees are created on the Windows side instead of inside the distro (src/main/project-runtime-git-options.ts).
    • Everything else that reads the runtime (terminals, agent launches, accounts, skills, hooks) still sees WSL with the same distro, so nothing else changes. Paths, worktree ids, chats and running terminals are untouched.
  • New conversion check. src/main/wsl/wsl-drive-project-windows-git.ts checks the project, then hands back the runtime setting to save. The caller saves it through the normal project update, so the window and the move fence see it. It refuses when:
    • Git for Windows isn't installed.
    • New worktrees are configured to go inside the distro.
    • Any linked worktree has a link written by WSL Git, i.e. a Linux path like /mnt/c/… or /home/…. Git for Windows can't read those links. It lists those worktrees as prunable, and the git worktree prune Orca runs after removing any worktree would delete their Git data. The check reads the link files directly, because Git for Windows may print a Linux path as a path under the current drive.
  • Optional line-ending fix. If Git for Windows uses core.autocrlf=true and the repo doesn't set it, the conversion can write core.autocrlf=true into the repo, so plain git in WSL terminals stops showing every file as modified. It never writes core.checkStat, because that hides same-size edits from Windows Git.
  • Base-ref and remote-identity reads follow the runtime, with WSL hosts on. The default base, remote count, base-ref search and the remote-identity sweep run Git where the project's runtime does (getProjectRuntimeReadGitOptions in project-runtime-git-options.ts). With the gate closed they run host Git, as on main.
  • IPC. Two calls, wslDriveProject:preview and wslDriveProject:convert. Both are refused off Windows and while the internal WSL hosts gate is closed. The settings UI comes in the next PR.

Why

  • Owner decision (2026-10-24). Windows-drive projects that run under WSL become native Windows projects with WSL terminals, measured in docs/design/wsl-via-orcad-mntc-mixed-git.md.
  • Why keep the runtime as WSL and flag only Git. About 40 call sites branch on "runtime is WSL" to place agents, accounts, hooks and skills. Keeping the runtime as WSL leaves every one of them on the code path they use today. The alternative was flipping the runtime to Windows and adding a separate "terminal runtime", which would have touched all of them.
  • Downgrade. An older build drops the unknown field and goes back to WSL Git: slow, but correct, as today.
  • Why no journal. No path or id changes, so there is nothing to make durable beyond the one setting.

Linked Issue

Part of the WSL re-write, step D1c (risk rows R36, R37, R6). Stacked on #33085.

Visual Proof

N/A: no UI in this PR (the settings row is in the next PR).

Testing

  • Automated tests added/updated:
    • wsl-drive-project-windows-git.test.ts: override and inherited default, WSL-made worktrees, missing Git for Windows, worktree folder in the distro, already converted, distro gone, line-ending opt-in.
    • wsl-drive-project-handlers.test.ts: gate, platform and argument checks; link reading from a real temp dir.
    • project-execution-runtime.test.ts and project-runtime-git-options.test.ts: Git routing and worktree placement.
  • Manual on Windows: not run yet (the shared Windows box is in use).

Review

Self-reviewed.

Agent skill upstream boundary

  • Not applicable.

Notes

  • Flag-off: no change. The wslDriveProject:* IPC refuses unless it is Windows with the gate open (wsl-drive-project-handlers.ts). Base-ref lookups and the remote-identity sweep get their Git options from getProjectRuntimeReadGitOptions, which returns {} (host Git, as on main) while the gate is closed, so a Windows project already on a WSL runtime keeps main's Git for those reads. The new 'while WSL hosts are off' tests pin this. On macOS and Linux every runtime resolves to this computer, so the options are {} either way. The new optional git field on a WSL runtime preference is written only by the gated convert flow; old builds and old servers ignore it. git.runs_in is a new trace attribute only.
  • Remote/wire. project.update accepts the new optional field. Older peers drop it, and the setting belongs to the local Windows host anyway.
  • SSH and folder workspaces. Not affected: only local Windows projects with a WSL runtime can carry the field.
  • Open question for the owner. A repo with worktrees made by WSL Git can't convert yet (see the refusal above). The options are in the D1c report.

Status

  • 2026-10-28, head 5b29bb34c9e: rebased onto main 88662806c0e with no conflicts; every commit carried over unchanged (range-diff). fix(wsl-host): tell users how to fix a distro Orca can't host (D1c-1) #33085 is merged and feat(wsl): run Git for Windows for a WSL project on a Windows drive (D1c-2) #33090 targets main. CI: running on this head.
  • Re-review (E9): the remote-identity sweep computes the project's Git options first and gates on the distro that Git runs in, so a Windows-drive project with a WSL runtime never probes (and never boots) a stopped distro. Test: a drive-path repo with a WSL runtime and a stopped distro makes no probe.
  • Review fixes: the Git for Windows check skips folder repos (they run no Git), and worktree links are read with readWorktreeLinks/isForeignLink from worktree-prune-guard.ts, so a //wsl.localhost link counts as Windows Git's. Tests cover both.
  • Added here: register-core-handlers.ts registers the filesystem handlers in one call (the optional resolvers pass straight through, so nothing changes). Land the WSL project mover dark (merges only after verify-15b, the flag-off audit and green CI) #34059 left that file at the 300-line lint cap, and this stack's WSL wiring adds to it.
  • Kept here: base-ref and remote-identity reads use host Git, as before, while WSL hosts are off.
  • pnpm tc, pnpm run typecheck:ci, the PR's tests, check:code-quality:changed, the anti-slop oxlint, repo oxlint and ast-grep (including the no-real-time-sleep test rules) and the e2e typecheck ratchet all pass locally on this head, run one branch at a time.

@nwparker
nwparker marked this pull request as ready for review October 24, 2026 08:28
@nwparker
nwparker force-pushed the nwparker/wsl-d1c-1-unsupported-distros branch from da5e00e to 23beeb2 Compare October 25, 2026 02:00
@nwparker
nwparker requested a review from brennanb2025 as a October 25, 2026 02:00
@nwparker
nwparker force-pushed the nwparker/wsl-d1c-2-windows-git branch from 4744e59 to ae05cd2 Compare October 25, 2026 02:00
@nwparker
nwparker force-pushed the nwparker/wsl-d1c-1-unsupported-distros branch from 23beeb2 to c77bc34 Compare October 25, 2026 02:29
@nwparker
nwparker force-pushed the nwparker/wsl-d1c-2-windows-git branch from ae05cd2 to 2f43ad5 Compare October 25, 2026 02:29
@nwparker
nwparker force-pushed the nwparker/wsl-d1c-1-unsupported-distros branch from c77bc34 to e7aacf8 Compare October 25, 2026 04:33
@nwparker
nwparker force-pushed the nwparker/wsl-d1c-2-windows-git branch from 2f43ad5 to 7a5ca94 Compare October 25, 2026 04:34
@nwparker
nwparker force-pushed the nwparker/wsl-d1c-1-unsupported-distros branch from e7aacf8 to 9468359 Compare October 25, 2026 06:39
@nwparker
nwparker force-pushed the nwparker/wsl-d1c-2-windows-git branch from 7a5ca94 to 73563e1 Compare October 25, 2026 06:39
@nwparker
nwparker force-pushed the nwparker/wsl-d1c-1-unsupported-distros branch from 9468359 to cddc92b Compare October 25, 2026 08:30
@nwparker
nwparker force-pushed the nwparker/wsl-d1c-2-windows-git branch 2 times, most recently from bd03615 to 5f403b6 Compare October 25, 2026 09:48
@nwparker
nwparker force-pushed the nwparker/wsl-d1c-1-unsupported-distros branch from 40089d1 to 233d2eb Compare October 25, 2026 10:21
@nwparker
nwparker force-pushed the nwparker/wsl-d1c-2-windows-git branch from 5f403b6 to 9f1aaf2 Compare October 25, 2026 10:21
@nwparker
nwparker force-pushed the nwparker/wsl-d1c-1-unsupported-distros branch from 233d2eb to e3f0ef2 Compare October 25, 2026 11:10
@nwparker
nwparker force-pushed the nwparker/wsl-d1c-2-windows-git branch from 9f1aaf2 to 4d04511 Compare October 25, 2026 11:10
@nwparker
nwparker force-pushed the nwparker/wsl-d1c-1-unsupported-distros branch from e3f0ef2 to 7d37d79 Compare October 25, 2026 12:35
@nwparker
nwparker force-pushed the nwparker/wsl-d1c-2-windows-git branch from 090d7be to e511133 Compare October 25, 2026 12:36
@nwparker
nwparker force-pushed the nwparker/wsl-d1c-1-unsupported-distros branch from 7d37d79 to 2d26087 Compare October 25, 2026 13:03
@nwparker
nwparker force-pushed the nwparker/wsl-d1c-2-windows-git branch 2 times, most recently from 767b00d to ab406c7 Compare October 25, 2026 13:16
@OrcaWin
OrcaWin force-pushed the nwparker/wsl-d1c-2-windows-git branch from ab406c7 to d19fc7b Compare October 27, 2026 23:53
@nwparker
nwparker force-pushed the nwparker/wsl-d1c-1-unsupported-distros branch from a4b8ff3 to 4b8ab7c Compare October 28, 2026 02:11
@nwparker
nwparker force-pushed the nwparker/wsl-d1c-2-windows-git branch from d19fc7b to 7149b9f Compare October 28, 2026 02:11
@OrcaWin
OrcaWin force-pushed the nwparker/wsl-d1c-1-unsupported-distros branch from 4b8ab7c to 244d317 Compare October 28, 2026 02:20
@OrcaWin
OrcaWin force-pushed the nwparker/wsl-d1c-2-windows-git branch from 7149b9f to a476da8 Compare October 28, 2026 02:20
@OrcaWin
OrcaWin force-pushed the nwparker/wsl-d1c-1-unsupported-distros branch from 244d317 to b51d42f Compare October 28, 2026 10:47
@OrcaWin
OrcaWin force-pushed the nwparker/wsl-d1c-2-windows-git branch 2 times, most recently from 6706826 to 695780a Compare October 28, 2026 12:05
@OrcaWin
OrcaWin changed the base branch from nwparker/wsl-d1c-1-unsupported-distros to main October 28, 2026 12:05
@OrcaWin

OrcaWin commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

STATUS: all re-review fixes are pushed. The stack is rebased onto main ce3c8d1383c, which includes #33085's squash merge 0b6071aec4b. #33085's commits are dropped, and #33090 now targets main. Nothing merged.

Heads (CI just started on all of them):

PR Head Base
#33090 695780a2ca3 main
#33097 47c5a07cf95 #33090
#33108 8c12faaf4bc #33097
#33128 7fa0632bfa2 #33108
#33135 0a225120201 #33128
#33143 75aa19f9d0a #33135
#33122 4e271a5c978 #33143
#33531 27d2bdd2cbd #33122

For reviewer A:

Reviewer B's items:

Checks: each branch passed the full load rule, run one branch at a time on this head: pnpm tc, typecheck:ci, the e2e typecheck ratchet, the touched tests, check:code-quality:changed, anti-slop oxlint, repo oxlint, and the ast-grep rules including the no-real-time-sleep test rules. I also checked every PR's diff file by file against its last pushed head. Each one differs only by its fixes.

Open: in the previous run, repos-local-clone-lifecycle.test.ts ("skips abort cleanup when the claimed target is replaced before close") failed once on #33143. No PR in the stack touches it, and it passes 3/3 locally, so it looks flaky. I'll rerun it if it fails again.

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent 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: ba4a0d8f-1fa3-4d03-a97c-4a6610fa225d
Commits

Reviewing files that changed from the base of the PR and between 695780a and 5b29bb3.

Files selected for processing: 1
  • src/main/ipc/register-core-handlers/register-core-handlers.ts

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

Walkthrough

The change adds a Windows-host Git option to WSL project runtimes and applies runtime-specific Git options to base-ref queries, remote counts, and remote-identity probes. It also adds preview and conversion logic for WSL projects on Windows drives, including blocker checks and optional local line-ending alignment. New IPC handlers and preload API methods expose preview and conversion requests.

Priority: Normal

Merge Risk: Minimal · up to 5b29b

The reviewed changes are mergeable with no actionable risk established by the available evidence.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 21.74% 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 and concisely describes the main change: using Git for Windows for WSL projects on Windows drives.
Description check Passed The description covers the user impact, implementation, rationale, linked issue context, visual proof, testing, review notes, compatibility considerations, and current status. It is mostly complete, a…
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 covers the user impact, implementation, rationale, linked issue context, visual proof, testing, review notes, compatibility considerations, and current status. It is mostly complete, although it does not include the template's formal Checklist section and manual Windows testing remains incomplete.

Full details: Docstring Coverage

Explanation

Docstring coverage is 21.74% 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 23 functions across 26 files.

Resolution

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

Finishing Touches: 💡 1
📝 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@OrcaWin

OrcaWin commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

STATUS: CI is green on every head in the stack (finished 12:32 UTC). Base is main ce3c8d1383c. Nothing merged.

PR Head CI
#33090 695780a2ca3 green (31 pass, 20 skipped)
#33097 47c5a07cf95 green (14 pass, 20 skipped)
#33108 8c12faaf4bc green (27 pass, 21 skipped)
#33128 7fa0632bfa2 green (51 pass, 17 skipped)
#33135 0a225120201 green (29 pass, 22 skipped)
#33143 75aa19f9d0a green (29 pass, 22 skipped)
#33122 4e271a5c978 green (36 pass, 17 skipped)
#33531 27d2bdd2cbd green (28 pass, 20 skipped)

The repos-local-clone-lifecycle test that failed once before passed this run, so I didn't rerun anything. Reviewer A can re-check #33090 (E9) and #33108 (case-sensitive mount match). Still open as a separate follow-up: the setup runner's rev-parse --git-path path conversion.

nwparker and others added 8 commits October 28, 2026 13:36
A project on C:\ whose runtime is WSL ran every Orca Git command through wsl.exe on
/mnt/c: ~300x slower than Windows Git, and blind to Windows-side edits. The project's
WSL runtime preference gains an optional `git: 'windows-host'`. With it, Orca's Git
(and where new worktrees go) is Windows; terminals, agents, accounts and hooks still
resolve to WSL, so nothing else changes. Older builds drop the field and go back to WSL
Git.

The conversion checks first, then the caller saves the returned preference through the
normal project update:
- Git for Windows must exist.
- New worktrees must not be set to go inside the distro.
- No linked worktree may have a Linux-path link. WSL Git made those; Windows Git sees
  them as prunable, and Orca's prune after a worktree removal would delete their
  metadata.
- Optionally writes core.autocrlf=true into the repo when Windows Git uses it, so WSL
  Git in the project's terminals stops seeing CRLF changes. Never core.checkStat.

IPC is refused off Windows and with the internal WSL hosts gate closed.

Co-Authored-By: Claude <[email protected]>
…th WSL hosts on

These reads ran host Git on main. Routing them into a WSL-runtime project's
distro is part of D1c, so with the WSL hosts gate closed they run host Git
exactly as before.

(cherry picked from commit 2ed82987dc5b82c3a86ea7e03ce05e9efc3e77fb)
…core registration under its line cap

The optional commit-message resolvers pass straight through, so the call is the same with or
without them. #34059 left this file at the 300-line cap and the WSL drive-project wiring adds to it.

Co-Authored-By: Claude <[email protected]>
…ee links with the prune guard's reader

Folder repos run no Git, so rev-parse on them always failed the preview. The link reader and
the WSL-authored test now come from worktree-prune-guard.ts; the copy's startsWith('/') wrongly
refused //wsl.localhost links, which Windows Git writes itself.

Co-Authored-By: Claude <[email protected]>
…'s Git runs in, so it never boots a stopped one
@OrcaWin
OrcaWin force-pushed the nwparker/wsl-d1c-2-windows-git branch from 695780a to 5b29bb3 Compare October 28, 2026 20:57
@OrcaWin

OrcaWin commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

STATUS: the whole D1c stack is restacked onto main 88662806c0e. All eight PRs are pushed with --force-with-lease against their 12:33 heads. Nothing merged.

Conflicts: none, so nothing was resolved by hand. Range-diff shows every commit identical to its previous version, and each PR's diff matches its previous diff line for line.

PR Head Base
#33090 5b29bb34c9e main 88662806c0e
#33097 a683039e25b #33090 nwparker/wsl-d1c-2-windows-git
#33108 5a931aa7e01 #33097 nwparker/wsl-d1c-3-windows-git-ui
#33128 2f0aeb39781 #33108 nwparker/wsl-d1c-4a-unc-drive-scope
#33135 b9ca555006c #33128 nwparker/wsl-d1c-4b-unc-rewrite
#33143 a58d1f08dd6 #33135 nwparker/wsl-d1c-4c-unc-conversion-run
#33122 17acf4a3c94 #33143 nwparker/wsl-d1c-4d-unc-conversion-ui
#33531 4c3e55eb9a6 #33122 nwparker/wsl-d1c-5-new-drive-project-default

Checks: each PR passed the full load rule on its new head, run one at a time: pnpm tc, typecheck:ci, the e2e typecheck ratchet, the touched tests, check:code-quality:changed, anti-slop oxlint, repo oxlint, and the ast-grep rules including the no-real-time-sleep test rules. git status --short was empty after every rebase. CI is now running on all eight heads.

Changed in a PR body: #33531's Flag-off line said the new git.runs_in attribute goes on spawn and stream spans. That has been out of date since its review fix. It actually goes on exec and stream spans, and on spawn spans only while the router is installed. The line now says so.

@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change affects Git and worktree workflows for opted-in Windows-drive projects.

The PR appears safe to merge with the verified routing changes in PR #33531; two non-blocking conversion checks should be tightened.

Findings

  1. P2 Inherited WSL folders escape checks ▶
  2. P2 Failed reads pass safety checks ▶

Summary

Adds git: 'windows-host' to WSL project preferences, conversion checks, optional line-ending alignment, and desktop IPC. Terminals and agents remain in WSL.

  • Windows-drive projects can keep WSL terminals while Orca runs Git on Windows.
  • Windows-drive WSL projects can switch Orca's Git to Windows.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Preview or convert request] --> B{Windows and gate open?}
  B -->|Yes| C[Check runtime, repo paths, Git and worktree links]
  B -->|No| D[Refuse request]
  C --> E{Blockers?}
  E -->|Yes| F[Return blockers]
  E -->|No| G[Optionally align line endings]
  G --> H[Return WSL preference with Windows Git]
  H --> I[Caller saves project preference]
  I --> J[Git runs on Windows]
  I --> K[Terminals and agents stay in WSL]
Loading

Reviews (1) · Last reviewed commit: "fix(wsl): the remote-identity sweep chec..." · Reviewed by Greptile

Comment on lines +62 to +64
if (repo.worktreeBasePath && isWslUncPath(repo.worktreeBasePath)) {
preview.blockers.push({ kind: 'worktree-folder-in-distro', repoId: repo.id })
}

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 Inherited WSL folders escape checks

The folder check only reads repo.worktreeBasePath. If a repo has no override and the global workspaceDir points into WSL, conversion succeeds but new worktrees still go into that distro. Windows Git then crosses the slow Windows-to-WSL file connection instead of staying on the Windows drive. Check the effective worktree folder, including the global fallback, before allowing conversion.

Knowledge Base Used: Workspace and worktree lifecycle

Comment on lines +68 to +69
export async function readWorktreeLinks(commonDir: string): Promise<string[]> {
return (await readWorktreeAdminLinks(join(commonDir, 'worktrees'))).map(({ link }) => link)

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 Failed reads pass safety checks

readWorktreeLinks uses a reader that turns every folder-read error into an empty list and skips unreadable gitdir files. If a permission or temporary file error occurs, conversion can succeed without checking whether existing worktrees are compatible. Use a strict reader here: allow a missing worktree folder, but stop conversion on other read failures.

Knowledge Base Used: Workspace and worktree lifecycle

@nwparker
nwparker merged commit bfbdcd7 into main Oct 28, 2026
80 of 82 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.

2 participants