Repository navigation
File paths on Windows improperly treat their UNC representation as canonical #10347
Description
Context
As shown in rust-lang/rust#42869, the choice to have std:fs:canonicalize return UNC paths is viewed as a mistake. The docs mention:
[...] it may be incompatible with other applications (if passed to the application on the command-line, or written to a file another application may read).
The word "may" is quite inaccurate though because in reality support for UNC paths is astonishingly rare, even for internal Windows APIs.
What issue are you seeing?
Codex appears to use these paths internally and leaks its usage, for example in how every project path in ~\.codex\config.toml is stored as UNC:
[projects.'\\?\C:\Users\ofek\Desktop\code\datadog-agent']
trust_level = "trusted"
[projects.'\\?\C:\Users\ofek\Desktop\code\hatch']
trust_level = "trusted"
[projects.'\\?\C:\Users\ofek\Desktop\code\msgspec']
trust_level = "trusted"UNC paths should only ever be used internally, never exposed, to maintain interoperability with the vast majority of software and to reduce user confusion when seen.
Issues caused by UNC paths
- 'Open config.toml in WSL environment' broken (incorrect path) #6809
- apply_patch fails with Access is denied on mapped/UNC Windows worktrees #12350
- Ephrmale thread when starting a worktree #13582
- Codex App worktree creation fails for WSL-backed repos with "Failed to resolve worktree git directory" #13618
- Windows: Codex launches tools with \\?\ namespace cwd, breaking pnpm/Node tooling #13845
- Windows app: threads disappear after restart when project is on a mapped network drive (possible //?/unc/... path normalization issue) #13846
- Windows app: in-app worktree creation still fails when workspace path normalization leaks \?\ paths #13847
- Windows app shows "Create git repository" for valid WSL worktrees and does not show branch in thread #14182
- Desktop-created worktree thread exists locally but never appears in Codex Desktop thread list #14519
- Worktree development is unusable #14703
- Windows sandbox setup refresh fails for workspace on \\wsl.localhost UNC path #35380
Solution
One of the following two approaches must be chosen:
- Keep UNC as the internal representation and strip the prefix upon external access. For example, when writing the paths to a file, during subprocess execution, or using Windows APIs that don't support UNC.
- Change the internal representation to the one that is universally recognized and document how to enable a setting that would allow Codex to declare itself as long-path aware.
The former is the current approach that is obviously difficult to apply ubiquitously so I'd recommend the latter, which is the modern way offered by Microsoft (where possible). They recommend embedding an application manifest directly within the binary. This is pretty easy using something like the embed-manifest crate or manually setting the associated linker options.
The path normalization should likely use the normalize_for_native_workdir core utility, introduced in #13742, that relies on the de facto standard dunce crate.
Activity
[-]Project locations are stored as UNC paths in config on Windows[/-][+]Paths on Windows[/+][-]Paths on Windows[/-][+]File paths on Windows improperly treat their UNC representation as canonical[/+]BradenHartsell commentedon May 5, 2026
@etraut-openai any update on this? I'd really like to be able to use the worktree feature in codex.
walter-seethaler commentedon Sep 1, 2026
Please add #35380 to the list of UNC-related Windows path failures. It is a concrete
\\wsl.localhostcase in which Codex accepts the UNC workspace root, then passes it into Windows sandbox ACL setup.GetSecurityInfo/GetNamedSecurityInfoWfail on the WSL provider, and the entire setup refresh aborts before any command can run—even when the requested command uses a separate localC:\working directory.This is more than leaked extended-path formatting, but it belongs in the same general tracking area because the UNC-backed root is accepted and propagated into a subsystem that cannot operate on that path class.
douglasg14b commentedon Sep 17, 2026
Is this why I can't use worktrees with Codex at all??
I just constantly get
reparse-pointerrors.Which is honestly incredibly frustrating.