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): refuse Windows drive folders on a WSL host, offer Add on this computer - #34530
On a computer running Windows, a project can be added to a WSL host (Orca's server running inside a Linux distro). If that project folder is really on a Windows drive (the distro sees C: as /mnt/c), Git inside Linux gets it wrong: every file looks changed because of line endings, edits made from Windows are missed, and searches are slow. Orca now refuses those folders on a WSL host and offers a one-click Add on this computer, which adds the same folder as a normal Windows project.
What Changed
User risk: none outside WSL hosts. Every check runs only for a WSL host: on the desktop, only when the selected host maps to a WSL distro; on the host, only in an orcad launched as a WSL host. Add Project for this computer and for SSH hosts behaves as before. An earlier revision made Add Project select this computer whenever it opened with a dropped local folder, which every user would have seen. That is removed. The "Add on this computer" entry point now uses its own dialog field, addOnThisComputerPath.
Before: typing /mnt/c/... in Add Project for a WSL host, or picking \\wsl.localhost\<distro>\mnt\c\..., added the folder to the WSL host. A picked C:\... folder was refused, but only with a hint to switch hosts.
After:
Desktop, inside Add Project. The dialog refuses these and shows the reason inline, together with an Add on this computer button:
a typed /mnt/<drive> path, normalized first, so /mnt/c/../../home is allowed and /mnt/C/x is refused;
a picked C:\... folder;
a picked \\wsl.localhost\<any distro>\mnt\<drive> folder, including the \\?\UNC\ long-path spelling;
a refusal sent back by the host.
The refusal is inline rather than a toast because toasts above a modal can't be clicked. The button switches the open dialog to this computer and then adds the folder there. The add waits one render after the switch so the dialog's host-change reset can't cancel it, and nothing closes or reopens. A refused create switches to this computer and opens the create step with the parent folder filled in. The button is offered only on a Windows desktop. If the switch to this computer can't happen, the pending add is dropped.
Desktop, sidebar drop. With WSL hosts turned on, a dropped drvfs folder from any distro is routed as the Windows folder it is, the same way a picked one is. With them off, the drop is routed exactly as on main: it stays a WSL-bridge project at its UNC path. A Windows-drive drop while a WSL host is focused gets a toast whose Add on this computer opens Add Project on this computer. No dialog is open at that moment, so the toast can be clicked.
WSL host (orcad). These operations check the path against the distro's Windows-drive mounts:
repo.add;
repo.create (the parent folder);
repo.clone (the destination);
folderWorkspace.create (only when an explicit folder is passed);
the nested-repo scan and import.
Symlinks are resolved first. Mounts come from /proc/self/mountinfo and are read on every check, so a drive mounted after orcad started is still caught. A mount counts as a Windows drive if it is drvfs, virtiofs, or 9p with aname=drvfs, so /usr/lib/wsl/drivers is not one. The host only suggests a C:\ path when the mount source is a drive letter and the mount covers the whole drive. A drvfs mount of a network share, or a bind of a drive subfolder, is refused with no suggested path, because a wrong suggestion is worse than none.
Wire compatibility.repo.add, repo.clone, folderWorkspace.create and the scan/import keep the existing runtime_error code and add an optional data: { kind: 'wsl_host_windows_drive_path', windowsPath }. repo.create keeps its { error } result and adds an optional windowsDriveRefusal field. Older desktops and the CLI show the plain message, which also says to add the folder on this computer.
Why
The owner's decision is that Windows-drive folders are native Windows projects, which can still use WSL terminals. Checking only on the desktop would let an older client, or a symlink into /mnt/c, through. Checking only on the host would scan the drive first and leave older clients without the offer, so both are needed. Switching the host inside the open dialog avoids a close-and-reopen sequence whose host selection could race.
Linked Issue
Internal gate E8 for making the WSL host the default; no issue.
Visual Proof
The e2e (tests/e2e/wsl-host-fake-transport.spec.ts, C8 section) saves screenshots of the inline refusal for a picked drive folder, a picked \\wsl.localhost\Ubuntu\mnt\c folder and a typed /mnt/d path. It also checks that the dialog switched off the WSL host after the click. Not run locally because the machine is overloaded; CI produces them.
Testing
Unit tests:
Typed-path normalization, picked-path classification (drive, any distro's drvfs, long paths) and refusal parsing.
The mountinfo parser: drvfs only with aname=drvfs, and no suggested path for share or bind mounts.
The host guard: drive mounts, symlinks, missing folders, mounts re-read per check, and non-WSL hosts such as SSH.
The host backstop for clone, create (which keeps its typed detail) and explicit folder workspaces.
Error mapping.
Picker and drop parity.
The server-path flow: inline refusal before any scan, normalization, and SSH/paired hosts unaffected.
The store: the refusal goes to the dialog when it is open, and is a plain toast otherwise.
The inline hook: it adds only after the host switch lands, the create action fills the parent folder, and there is no button without a known path or on a web client.
e2e: the updated C8 section, as above.
pnpm tc, pnpm run typecheck:ci, check:code-quality:changed and the touched tests pass. Full lint and test are left to CI under the overloaded-machine rule.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
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: no change. The host check needs the WSL-host launch marker, and the desktop check needs a WSL host's distro mapping.
Folder workspaces get the same refusal as Git projects.
Mixed versions: older clients get the readable message; older hosts don't refuse, but a newer desktop still stops typed and picked drive paths first.
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)
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
The changes add WSL mount parsing and Windows-drive path detection. Runtime repository operations reject selected paths that map to Windows drives and return typed refusal details. Renderer flows detect and propagate refusals, display notices in the Add Project dialog, and offer a local-host action for supported paths. Project-drop routing also converts supported WSL UNC paths to Windows paths.
Priority: Normal
Merge Risk: Moderate · up to b3f72
Some Windows-drive projects can still bypass protection or fail without the offered local-host recovery, and the e2e test does not fully guard the refusal behavior.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surv…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title "fix(wsl): refuse Windows drive folders on a WSL host, offer Add on this computer" names the main change: WSL hosts refuse Windows-drive folders and offer an Add on this computer option. The…
Description check
The description follows the template sections: ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist. It explains the…
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.
Full details: Title check
Explanation
The title "fix(wsl): refuse Windows drive folders on a WSL host, offer Add on this computer" names the main change: WSL hosts refuse Windows-drive folders and offer an Add on this computer option. The changeset implements exactly this, across the desktop dialog, sidebar drop routing, and host-side guards. The title is a single sentence, but at 80 characters it is slightly long and uses a conventional-commit prefix.
Full details: Description check
Explanation
The description follows the template sections: ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist. It explains the before and after behavior, the mechanism, and the reasons for the approach. Gaps: the Linked Issue section has no issue link (it cites an internal gate instead, and the template says outside contributors need a real issue), the Visual Proof section has no before/after attachments and the screenshot checkbox is unchecked, the AI Disclosure section is empty, and the lint, typecheck, test, and build checkbox is unchecked. The e2e run was not performed locally.
Full details: Docstring Coverage
Explanation
Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 44 functions across 40 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.
The new descriptionWithPath string uses the positional placeholder {{value0}}. The localization guideline requires intent-named IDs with named interpolation placeholders for new strings. Only existing hash-based strings are grandfathered. Rename the placeholder to {{path}}. Update the matching entry in src/renderer/src/i18n/locales/en.json (Line 1471) in the same change.
♻️ Proposed change
- '{{value0}} is on a Windows drive. Git in WSL reports false line-ending changes there, misses edits made from Windows, and searches it slowly.',- { value0: windowsPath }+ '{{path}} is on a Windows drive. Git in WSL reports false line-ending changes there, misses edits made from Windows, and searches it slowly.',+ { path: windowsPath }
Based on learnings: for newly added user-facing strings in stablyai/orca, follow config/i18n-translation-source.md and use intent-named localization IDs with named interpolation placeholders.
Assert the reopened dialog through the DOM, not through store state.
expectDriveRefusal polls window.__store for activeModal === 'add-repo' and modalData.droppedLocalPath. The tests/e2e/** guideline says to use window.__store for setup and to assert user-visible behavior through the DOM. Reading store state cannot catch a dialog that fails to render. This applies to hidden CDP-driven renderers too.
Keep the store poll if you want the exact path check. Add a DOM assertion that the "Add a project" dialog is visible after the click. Assert the selected host label there if the dialog exposes it.
♻️ Proposed addition
await toast.getByRole('button', { name: 'Add on this computer' }).click()
+ await expect(page.getByRole('dialog', { name: /Add a project/i })).toBeVisible()
await expect
.poll(() =>
As per coding guidelines: "Use window.__store for setup; assert user-visible behavior through the DOM (getByRole, toBeVisible, toHaveText)."
Source: Coding guidelines
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: 3a098de2-f20c-4a11-8649-80fda8168397
Commits
Reviewing files that changed from the base of the PR and between 1d2778f and ef1d07c.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
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.
Major · Functional Correctness · Heavy lift
Resolve existing ancestors of a new destination.
If /home/me/drive links to /mnt/c and /home/me/drive/new does not exist, realpath(path) fails. The guard then checks only the /home/me spelling and permits the path. create and clone can subsequently create the project on the Windows drive. Resolve the nearest existing ancestor and append the missing components before matching mounts. Node 24 documents that realpath returns ENOENT for a nonexistent path. (nodejs.org)
… them on this computer
A /mnt/<drive> project on a WSL host shows false line-ending changes, misses
edits made from Windows, and searches slowly. Add Project refuses typed,
picked and dropped Windows drive folders for a WSL host and shows the refusal
inline with Add on this computer, which switches the open dialog to this
computer. The WSL-host orcad re-checks by /proc/self/mountinfo (after
resolving symlinks) in repo.add, repo.create, repo.clone, explicit
folderWorkspace.create and the nested scan/import, answering with the
existing runtime_error code plus optional data, so older clients still show a
readable message. Everything is behind the WSL hosts gate; SSH is untouched.
Files skipped from review as they are similar to previous changes: 2
src/renderer/src/i18n/en-runtime-required.json
src/renderer/src/i18n/locales/en.json
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Major · Functional Correctness · Quick win
Guard the repository target as well as its parent.
If /home/me/projects/link is a symlink to an empty directory under /mnt/c, create('/home/me/projects', 'link') passes this parent-path check. The later stat and readdir accept the target directory. Git initialization or folder registration then proceeds on the Windows drive without a refusal. Check targetPath before using an existing directory, and return the same structured refusal when that check fails. (raw.githubusercontent.com)
…lure
On the Linux CI host the switched local add of a Windows path fails its nested
scan and hands off to the Open as Folder modal, closing Add Project before the
test looked. The refusal itself already came before any scan. The e2e now
records the local add at its scan step and asserts it went to this computer
with the Windows path; a unit test pins that a refused pick never reaches the
host path step.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Record scans before asserting that no scan occurred.
If a refused pick starts a scan before the user clicks “Add on this computer,” this assertion still passes. The test installs its scan recorder only after the assertion. Install a recorder before each pick or typed-path submission, then assert that it recorded no pre-action scan. (raw.githubusercontent.com)
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 (2)
Minor · Guard each resolved nested import path before persistence. · runtime-nested-repo-import.ts:81-128
src/main/runtime/runtime-nested-repo-import.ts:81-128 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
Guard each resolved nested import path before persistence.
RuntimeNestedRepoImport.import checks only args.parentPath. A nested scan can discover a Git repository inside a Windows-drive mount below an otherwise valid Linux parent. The loop then resolves that path and calls store.addRepo(repo) without checking importRepoPath, so the WSL host can persist a Windows-drive repository.
A WSL nested import can reject its parent path with WslHostWindowsDriveRefusalError. importNestedRepos catches that error, shows only Failed to import repositories, and returns null. The nested Add Project flow then exits without showing the Windows-drive refusal or offering the local-host action.
Preserve the refusal at src/renderer/src/store/project-groups/nested-repository-operations.ts:107-115, then pass it through useAddRepoNestedImportFlow and useAddRepoNestedReviewController to windowsDrive.showRefusal in AddRepoDialog. Use the same readWslHostWindowsDriveRefusal handling as addRepoPath. This is separate from guarding each nested repository path: those guards produce the refusal, while this renderer boundary must preserve it.
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: f9c9b295-c149-4a71-bfcd-1db2b05b9ba0
Commits
Reviewing files that changed from the base of the PR and between cb6c38e and b3f7240.
Files selected for processing: 1
tests/e2e/wsl-host-fake-transport.spec.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
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
On a computer running Windows, a project can be added to a WSL host (Orca's server running inside a Linux distro). If that project folder is really on a Windows drive (the distro sees
C:as/mnt/c), Git inside Linux gets it wrong: every file looks changed because of line endings, edits made from Windows are missed, and searches are slow. Orca now refuses those folders on a WSL host and offers a one-click Add on this computer, which adds the same folder as a normal Windows project.What Changed
User risk: none outside WSL hosts. Every check runs only for a WSL host: on the desktop, only when the selected host maps to a WSL distro; on the host, only in an orcad launched as a WSL host. Add Project for this computer and for SSH hosts behaves as before. An earlier revision made Add Project select this computer whenever it opened with a dropped local folder, which every user would have seen. That is removed. The "Add on this computer" entry point now uses its own dialog field,
addOnThisComputerPath.Before: typing
/mnt/c/...in Add Project for a WSL host, or picking\\wsl.localhost\<distro>\mnt\c\..., added the folder to the WSL host. A pickedC:\...folder was refused, but only with a hint to switch hosts.After:
Desktop, inside Add Project. The dialog refuses these and shows the reason inline, together with an Add on this computer button:
/mnt/<drive>path, normalized first, so/mnt/c/../../homeis allowed and/mnt/C/xis refused;C:\...folder;\\wsl.localhost\<any distro>\mnt\<drive>folder, including the\\?\UNC\long-path spelling;The refusal is inline rather than a toast because toasts above a modal can't be clicked. The button switches the open dialog to this computer and then adds the folder there. The add waits one render after the switch so the dialog's host-change reset can't cancel it, and nothing closes or reopens. A refused create switches to this computer and opens the create step with the parent folder filled in. The button is offered only on a Windows desktop. If the switch to this computer can't happen, the pending add is dropped.
Desktop, sidebar drop. With WSL hosts turned on, a dropped drvfs folder from any distro is routed as the Windows folder it is, the same way a picked one is. With them off, the drop is routed exactly as on main: it stays a WSL-bridge project at its UNC path. A Windows-drive drop while a WSL host is focused gets a toast whose Add on this computer opens Add Project on this computer. No dialog is open at that moment, so the toast can be clicked.
WSL host (orcad). These operations check the path against the distro's Windows-drive mounts:
repo.add;repo.create(the parent folder);repo.clone(the destination);folderWorkspace.create(only when an explicit folder is passed);Symlinks are resolved first. Mounts come from
/proc/self/mountinfoand are read on every check, so a drive mounted after orcad started is still caught. A mount counts as a Windows drive if it isdrvfs,virtiofs, or9pwithaname=drvfs, so/usr/lib/wsl/driversis not one. The host only suggests aC:\path when the mount source is a drive letter and the mount covers the whole drive. A drvfs mount of a network share, or a bind of a drive subfolder, is refused with no suggested path, because a wrong suggestion is worse than none.Wire compatibility.
repo.add,repo.clone,folderWorkspace.createand the scan/import keep the existingruntime_errorcode and add an optionaldata: { kind: 'wsl_host_windows_drive_path', windowsPath }.repo.createkeeps its{ error }result and adds an optionalwindowsDriveRefusalfield. Older desktops and the CLI show the plain message, which also says to add the folder on this computer.Why
The owner's decision is that Windows-drive folders are native Windows projects, which can still use WSL terminals. Checking only on the desktop would let an older client, or a symlink into
/mnt/c, through. Checking only on the host would scan the drive first and leave older clients without the offer, so both are needed. Switching the host inside the open dialog avoids a close-and-reopen sequence whose host selection could race.Linked Issue
Internal gate E8 for making the WSL host the default; no issue.
Visual Proof
The e2e (
tests/e2e/wsl-host-fake-transport.spec.ts, C8 section) saves screenshots of the inline refusal for a picked drive folder, a picked\\wsl.localhost\Ubuntu\mnt\cfolder and a typed/mnt/dpath. It also checks that the dialog switched off the WSL host after the click. Not run locally because the machine is overloaded; CI produces them.Testing
Unit tests:
aname=drvfs, and no suggested path for share or bind mounts.e2e: the updated C8 section, as above.
pnpm tc,pnpm run typecheck:ci,check:code-quality:changedand the touched tests pass. Full lint and test are left to CI under the overloaded-machine rule.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)