Repository navigation
fix(wsl): read a UNC drive-mount project's files through its drive path - #33735
Conversation
WSL 2.7 refuses Windows file access to its drive mounts over UNC: \\wsl.localhost\<distro>\mnt\c\x answers EPERM, while the distro's own folders still open. A project saved under such a path lost its file explorer (fs:readDir failed on the authorization realpath) and logged an EPERM warning for every setup-script import candidate. The authorization realpath now resolves a UNC drive-mount path through its drive and answers in the caller's UNC spelling, so allow-list checks are unchanged; readdir and the import-candidate reads open the same folder by drive path. Distro folders, other UNC shares and non-Windows hosts are untouched.
|
No actionable comments were generated in the recent review.
|
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

Major · Use the mapped Windows path for the missing-target symlink check. · filesystem-auth.ts:143
src/main/ipc/filesystem/filesystem-auth.ts:143
🩺 Stability & Availability | 🟠 Major | ⚡ Quick winUse the mapped Windows path for the missing-target symlink check.
When
realpathAcrossWslDriveMount(existingAncestor)returnsENOENT,isSymlinkcallslstatwith the original UNC path. WSL can returnEPERMfor that access, andisSymlinkrethrows it before checking the existing ancestor. UsewindowsFsPath(path)for this filesystem check and keep the UNC path for authorization.Suggested fix
-import { realpathAcrossWslDriveMount } from '../../wsl/wsl-unc-drive-fs-path' +import { realpathAcrossWslDriveMount, windowsFsPath } from '../../wsl/wsl-unc-drive-fs-path' ... - return (await lstat(path)).isSymbolicLink() + return (await lstat(windowsFsPath(path))).isSymbolicLink()

Minor · Convert the path for batch existence checks. · filesystem-read-handlers.ts:158
src/main/ipc/filesystem/filesystem-read-handlers.ts:158
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winConvert the path for batch existence checks.
For a registered WSL UNC drive-mount path, authorization preserves the UNC spelling after resolving through the drive path.
fs:pathsExistpasses that UNC path directly tostat, so a UNCEPERMreturns an{ error }item instead of an existence result. ApplywindowsFsPathat this filesystem call.Suggested fix
- await stat(await resolveDesktopAuthorizedPath(filePath, store)) + await stat(windowsFsPath(await resolveDesktopAuthorizedPath(filePath, store)))

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:
928fe6c8-c42d-4fe9-abdd-477af75db6f2
Files selected for processing: 10-
src/main/ipc/filesystem/filesystem-auth.tssrc/main/ipc/filesystem/filesystem-path-containment.tssrc/main/ipc/filesystem/filesystem-read-dir-unc-drive.test.tssrc/main/ipc/filesystem/filesystem-read-handlers.tssrc/main/ipc/filesystem/filesystem-symlink-directory-entries.tssrc/main/ipc/hooks/register-worktree-hook-inspection-handler.tssrc/main/ipc/hooks/worktree-hook-inspection-unc-drive.test.tssrc/main/runtime/runtime-repository-hooks-commands.tssrc/main/wsl/wsl-unc-drive-fs-path.test.tssrc/main/wsl/wsl-unc-drive-fs-path.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.
-
…ath; pin junction refusals orca.yaml checks (hasHooksFile, loadHooks, the unknown-key probe) opened the UNC path, which WSL 2.7 refuses for drive mounts, so a saved /mnt/c project's setup hooks silently disappeared. They now use the same drive mapping. Also pin that authorization still judges a UNC drive-mount path against the UNC roots: a junction under the project that resolves to another drive or outside the project is refused.
…ckage lane Its cases need native Windows path resolution, so they skip on Linux and macOS. Gate the suite (not each case) on win32 and register the file with the Windows lane, so CI actually runs it.
…ough its drive path (#33756) * fix(wsl): open, save and rename a UNC drive-mount project's files through its drive path WSL 2.7 refuses Windows file access to its drive mounts over UNC. #33735 fixed listing a saved \\wsl.localhost\<distro>\mnt\c\... project, but opening a file from it still failed with EPERM, as did saving, renaming, creating and copying. The open/read helpers (editor reads, ranged reads, media previews), the save path (write probe, disk precondition, its locks), rename, create, copy, the file stat/exists checks, the runtime provider used by remote clients and the document-folder realpaths now hand the filesystem the drive path. Authorization is unchanged: it still runs on the caller's UNC spelling against the UNC roots. Delete already runs inside the distro. * fix(wsl): check a missing path's ancestors for links through the drive path Authorizing a path that does not exist yet walks up to the nearest existing folder and refuses a dangling link on the way; that link check ran lstat on the UNC spelling, which WSL 2.7 refuses for drive mounts. So New File, New Folder, a first save, an upload and a copy or rename into a new folder all failed with EPERM (failing closed). The check now lstats the drive path, where Windows still reports junctions and symlinks.
ELI5
On Windows, a project can be opened through WSL's network path to a Windows drive, for example
\\wsl.localhost\Ubuntu\mnt\c\src\app. Newer WSL releases refuse Windows programs that open files that way, although the very same folder opens fine asC:\src\app. Orca now reads such a project's files through theC:\path, while still showing and storing the path the user chose.What Changed
Before, on WSL 2.7 and later, for a project saved under
\\wsl.localhost\<distro>\mnt\<drive>\...:EPERM: operation not permitted, realpath '\\wsl.localhost\...'.EPERMwarning for each setup-script import file Orca checks (package.json,conductor.json,.cmux/cmux.json, …), and no import was offered.After:
Mechanism (new
src/main/wsl/wsl-unc-drive-fs-path.ts):wslUncDriveFsPathmaps a UNC path into a distro's drive mount (/mnt/<letter>) to the drive path, on Windows only. Folders inside the distro (\home), other network shares and non-Windows hosts are left alone.filesystem-auth.ts,normalizeExistingPath) resolves such a path's real path through the drive, then turns the answer back into the caller's UNC spelling. The allow-list check is therefore unchanged: a path is still allowed only if it sits under an allowed UNC root, so access is not widened.fs:readDir(and its symlink classification), the setup-script import candidate reads and theorca.yamlchecks (hasHooksFile,loadHooks, the unknown-key probe) hand the drive path to the filesystem. Before, a saved/mnt/cproject's setup hooks silently disappeared.D:\…becomes\\wsl.localhost\<d>\mnt\d\…) or anywhere outside the project is therefore still refused. A test pins this.Why
C:\would change their identity; that is a separate, opt-in conversion.C:\.Linked Issue
Internal WSL rework; found by a real-host test on WSL 2.7.11.
Visual Proof
N/A: the change is in main-process file reads. Before, the file explorer was empty and the log showed EPERM; the evidence is from the real-host run described above.
Testing
New tests:
src/main/wsl/wsl-unc-drive-fs-path.test.ts: the mapping; that\home, shares and non-Windows are untouched; and real-path resolution when every UNC access throws EPERM.src/main/ipc/hooks/worktree-hook-inspection-unc-drive.test.ts: the import candidate is found throughC:\, with no EPERM warning. Without the fix it fails.src/main/ipc/filesystem/filesystem-read-dir-unc-drive.test.ts:fs:readDirwith every UNC access throwing EPERM, plus junctions toD:\and to a folder outside the project being refused. It needs native Windows path resolution, so the suite is gated on win32 and registered in the Windows package lane (package (windows)→ "Test Windows-specific boundaries").src/main/hooks-orca-yaml-unc-drive.test.ts:orca.yamlis found and parsed throughC:\when UNC access throws EPERM. It fails without the fix.Checks run:
pnpm tcpasses.pnpm lintstops only at a localization-coverage finding in settings files on main that this PR does not touch.Tested on macOS (unit). The Windows-only suite runs in the Windows package lane.
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)