openai / openai/codex-plugin-cc

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

Open
#70 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
33.3k
Forks
2.3k
PR merge metrics
No merged PRs in 30d

Description

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

Root 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

  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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/process.mjs to inspect the Windows spawnSync options, then trace the repository-root handling in lib/git.mjs and the calls from collectReviewContext(), collectBranchContext(), and collectWorkingTreeContext(). Reproduce the review command from a Windows repository on a mapped or UNC network drive, and consider the issue's proposed approaches; done means subsequent git commands succeed with the repository root as their working directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, javascript, node.js
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.