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(files): let phone uploads land in WSL folders on Windows hosts - #51491
Uploading a file from the phone into a project that lives inside WSL on a Windows computer always failed with "this drive can't create files safely". Now the file lands, with the same safety rules as everywhere else.
After: when the hard link is refused on Windows and both files are on the same distro's share, Orca makes the link inside the distro instead. It runs wsl.exe -d <distro> --exec sh -c 'ln -T -- "$1" "$2"', which is Linux link() on the Linux filesystem, and the guest answers with a stdout marker. The temp is still removed in finally on every outcome.
The extra process runs only on that refused-link path. Uploads that hard-link normally (NTFS, APFS, ext4, /mnt/c paths, which are already mapped to C:\) do no extra work.
Other drives without hard links keep refusing with the same message, on purpose: exFAT, SMB shares, and other 9P mounts outside WSL.
Why
Root cause: the publish step assumed the drive holding the workspace can make hard links. That holds for every local filesystem Orca runs on, but not for WSL's share as seen from Windows, which is where most WSL repos on Windows hosts live (in-distro WSL hosts are still gated).
Why link inside the distro: it keeps all three upload guarantees:
an existing file or folder is never replaced (link() refuses any taken name atomically, and -T refuses a folder instead of linking into it);
a partial file is never exposed under the final name (the temp is complete and closed first);
Node exposes no renameat2(RENAME_NOREPLACE), renamex_np(RENAME_EXCL) or non-replacing MoveFileEx.
copyFile(COPYFILE_EXCL) writes in place, exposing a partial file under the final name.
Linked Issue
No GitHub issue; follow-up to #51195 (phone upload host methods).
Visual Proof
N/A, host-only. Real Windows + WSL (Ubuntu) runs of the Windows WSL E2E workflow, each with a temporary probe that drove the real upload RPCs into a \\wsl.localhost folder three times. The probe was never merged.
Before, current main: every upload failed with Can't add 'fresh.txt' here: this drive can't create files safely.
After, this branch: 3/3 passed. The run's overall red is the workflow's own participation step, which expects exactly 3 tests and counted my 3 extra probe runs.
[wsl-upload-probe] fresh.txt bytes=32000 expected=32000
[wsl-upload-probe] race commit -> A file or folder named 'race.txt' already exists in this location
[wsl-upload-probe] listing=["fresh.txt","race.txt"]
fresh.txt lands whole.
race.txt, taken in the guest between begin and commit, is refused, and the other program's bytes are kept.
An aborted upload leaves nothing, and no .orca-upload-* temp remains.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Windows + WSL: verified on real runners as above, against both main and this branch.
macOS: pnpm check:changed and tc:node pass.
No permanent test: the behaviour needs a real Windows host with a WSL distro, which only the dedicated workflow has. Its suite is kept to the agent-launch journey.
Performance
None, because the wsl.exe spawn happens only when a hard link is refused on a WSL share during an upload commit. That is one short-lived process per such upload, capped at 30 s, spawned with an async working-directory check. Normal uploads return before reaching it.
Risk
Level: Low
Who it touches: only uploads into WSL repos from a Windows host, which all failed before.
On a distro without GNU ln -T (e.g. old busybox), ln fails, no marker is printed, and the upload is refused as before. Nothing is replaced or exposed.
A wedged wsl.exe is cut at 30 s. If its link lands after that, the name holds the complete file, never a partial one.
Back out: plain revert.
AI Disclosure
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
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Paths go to the guest as $1/$2, never inside the shell text, so spaces, quotes and $ in file names can't be interpreted.
The script is a single line because newlines don't survive wsl.exe argv encoding reliably.
exFAT, SMB and 9P workspaces still refuse phone uploads with the existing message. Supporting them safely would need a native no-replace rename on each platform.
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)
I stated the risk: what could break, for whom, and how to back it out
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)
…the distro
Windows can't create hard links on WSL's \\wsl.localhost share, so every
upload into a WSL repo on a Windows host was refused. When the link is
refused and both paths are on one distro's share, link inside the distro,
where link() still refuses a taken name atomically.
On Windows, publishNoClobber now tries to create a hard link inside a WSL distro when the normal link operation fails with a recognized no-hard-links error. The helper checks that both paths belong to the same distro, runs ln -T with a 30-second timeout, and handles success, an existing destination, and other process failures.
Merge Risk: Low · up to 19c26
Uploads to WSL folders on Windows now work through an in-distro hard link. In a rare timeout case, an upload can be reported as failed even though the file was published, and a retry then fails because the name is taken. The risk is narrow, so this is mergeable with awareness.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the change: phone uploads into WSL folders on Windows hosts. It matches the changeset, which adds an in-distro hard-link fallback for uploads that Windows refuses on the \\wsl.localhos…
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.
Description check
The description is thorough and follows the repository template. It includes ELI5, What Changed (before/after and mechanism), Why (root cause and rejected alternatives), a linked-issue note, Visual Pr…
Full details: Title check
Explanation
The title names the change: phone uploads into WSL folders on Windows hosts. It matches the changeset, which adds an in-distro hard-link fallback for uploads that Windows refuses on the \wsl.localhost share. The type prefix and scope are conventional and the title is specific.
Full details: Description check
Explanation
The description is thorough and follows the repository template. It includes ELI5, What Changed (before/after and mechanism), Why (root cause and rejected alternatives), a linked-issue note, Visual Proof with run links and probe output, Testing, Performance, Risk with level and back-out plan, and a completed checklist. The Linked Issue section does not contain a "Fixes #" reference. It names a follow-up to #51195 and states that no GitHub issue exists. The template asks outside contributors to link an actual issue, so this is a gap to confirm. The AI Disclosure and Review sections are empty. The AI Disclosure section is for outside contributors only, so its absence is minor. The local lint, typecheck, test, and build checkbox is unchecked, and the author notes that CI covers it. Testing reports macOS checks only, and the Windows checks rely on temporary probe runs that were not merged.
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.
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 · Heavy lift
Report publication state accurately when the WSL link times out.
When the 30-second deadline expires, runProcess settles with the stdout captured so far. tryLinkInsideWslDistro treats a missing LINKED_MARKER as a generic failure. If ln -T already created the destination, the upload reports failure while the destination remains. A retry then receives the EEXIST name-taken error for a file the first attempt published.
The helper must return a result that reflects whether the destination now exists. The fix needs a decision about how to determine that state after a timeout or a missing marker, so no specific change is prescribed here.
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
Uploading a file from the phone into a project that lives inside WSL on a Windows computer always failed with "this drive can't create files safely". Now the file lands, with the same safety rules as everywhere else.
What Changed
\\wsl.localhostshare (the call fails with "Incorrect function"; Codex settings reach WSL accounts again: save the usual atomic way where hard links aren't available #46060 hit the same thing). So every upload into a WSL repo on a Windows host was refused.wsl.exe -d <distro> --exec sh -c 'ln -T -- "$1" "$2"', which is Linuxlink()on the Linux filesystem, and the guest answers with a stdout marker. The temp is still removed infinallyon every outcome./mnt/cpaths, which are already mapped toC:\) do no extra work.Why
link()refuses any taken name atomically, and-Trefuses a folder instead of linking into it);renameNoClobber, Codex settings reach WSL accounts again: save the usual atomic way where hard links aren't available #46060's fallback) check and then rename. Another program can create the name in between and lose it to the rename.renameat2(RENAME_NOREPLACE),renamex_np(RENAME_EXCL)or non-replacingMoveFileEx.copyFile(COPYFILE_EXCL)writes in place, exposing a partial file under the final name.Linked Issue
No GitHub issue; follow-up to #51195 (phone upload host methods).
Visual Proof
N/A, host-only. Real Windows + WSL (Ubuntu) runs of the Windows WSL E2E workflow, each with a temporary probe that drove the real upload RPCs into a
\\wsl.localhostfolder three times. The probe was never merged.Can't add 'fresh.txt' here: this drive can't create files safely.fresh.txtlands whole.race.txt, taken in the guest between begin and commit, is refused, and the other program's bytes are kept..orca-upload-*temp remains.Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Windows + WSL: verified on real runners as above, against both main and this branch.
macOS:
pnpm check:changedandtc:nodepass.No permanent test: the behaviour needs a real Windows host with a WSL distro, which only the dedicated workflow has. Its suite is kept to the agent-launch journey.
Performance
None, because the
wsl.exespawn happens only when a hard link is refused on a WSL share during an upload commit. That is one short-lived process per such upload, capped at 30 s, spawned with an async working-directory check. Normal uploads return before reaching it.Risk
Level: Low
ln -T(e.g. old busybox),lnfails, no marker is printed, and the upload is refused as before. Nothing is replaced or exposed.wsl.exeis cut at 30 s. If its link lands after that, the name holds the complete file, never a partial one.AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
$1/$2, never inside the shell text, so spaces, quotes and$in file names can't be interpreted.wsl.exeargv encoding reliably.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)