spawnSync with shell:true fails on Windows network drives (UNC paths)
Bug
collectReviewContext() in lib/git.mjs calls getRepoRoot() → git rev-parse --show-toplevel, which on Windows network/NAS drives returns a UNC path (e.g. \192.168.8.4\NAS\AIProjects\MyRepo). This UNC path is then passed as cwd to spawnSync({ shell: true }) in lib/process.mjs, which invokes cmd.exe — and cmd.exe rejects UNC working directories:
git merge-base HEAD main: exit=128: '\192.168.8.4\NAS\AIProjects\MyRepo'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
fatal: not a git repository (or any of the parent directories): .gitRoot cause
In lib/process.mjs:
shell: process.platform === "win32"When shell: true, Node.js uses cmd.exe on Windows. cmd.exe cannot use UNC paths as working directories.
The initial git commands succeed because process.cwd() returns the mapped drive letter (e.g. N:\AIProjects\MyRepo). But getRepoRoot() in lib/git.mjs:30 runs git rev-parse --show-toplevel, which resolves to the underlying UNC path. That UNC path is then used as cwd for all subsequent git calls in collectBranchContext() and collectWorkingTreeContext(), which fail.
Reproduction
- Have a git repo on a Windows SMB/NAS share (either mapped drive like
N:or direct UNC path) - Run any
/codex:reviewor/codex:adversarial-reviewcommand from that repo
Suggested fixes (either would work)
- Use
shell: falseinspawnSync— git doesn't need a shell to execute, and this sidesteps thecmd.exeUNC limitation entirely - Fall back to
process.cwd()whengit rev-parse --show-toplevelreturns a UNC path on Windows (i.e. starts with\or//)
Workarounds attempted (none worked)
GIT_WORK_TREE/GIT_DIRenvironment variables — git still resolves to UNCgit config --local core.worktree "N:/..."—--show-toplevelignores itsubstvirtual drive — git resolves through to the real UNC path- Overriding
ComSpecto bash — not picked up correctly by Node.js - PowerShell as launcher — same result, Node still spawns cmd.exe internally
Environment
- Windows 11 Pro
- Node.js (via Claude Code plugin runtime)
- Git for Windows
- SMB network share (Synology NAS)
- codex-plugin-cc v1.0.1
Source: openai/codex-plugin-cc