Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#70·codex-plugin-cc

spawnSync with shell:true fails on Windows network drives (UNC paths)

Author: caapablecodeCreated Mar 31, 2026Updated Sep 29, 2026

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:

bash
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): .git

Root cause

In lib/process.mjs:

javascript
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

  1. Have a git repo on a Windows SMB/NAS share (either mapped drive like N: or direct UNC path)
  2. Run any /codex:review or /codex:adversarial-review command from that repo

Suggested fixes (either would work)

  • Use shell: false in spawnSync — git doesn't need a shell to execute, and this sidesteps the cmd.exe UNC limitation entirely
  • Fall back to process.cwd() when git rev-parse --show-toplevel returns a UNC path on Windows (i.e. starts with \ or //)

Workarounds attempted (none worked)

  • GIT_WORK_TREE / GIT_DIR environment variables — git still resolves to UNC
  • git config --local core.worktree "N:/..." — --show-toplevel ignores it
  • subst virtual drive — git resolves through to the real UNC path
  • Overriding ComSpec to 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

View original on GitHubView discussion on GitHub