Windows: spawn codex ENOENT in app-server.mjs — missing shell/platform handling

Resolved 💬 1 comment Opened Apr 5, 2026 by csg80752-png Closed Apr 6, 2026

Bug

On Windows, codex-companion.mjs adversarial-review (and likely other review commands) fails with:

spawn codex ENOENT

Root Cause

scripts/lib/app-server.mjs line 188 calls spawn("codex", ["app-server"]) without shell option. On Windows, npm global installs create .cmd wrappers, not .exe binaries. Without shell: true or resolving to node + codex.js, the OS cannot find codex.

Meanwhile, scripts/lib/process.mjs line 11 correctly handles this:

spawnSync(command, args, { shell: process.platform === "win32" })

This means binaryAvailable("codex") passes (uses process.mjs with shell), but the actual app-server spawn fails (uses raw spawn without shell).

Environment

  • Windows 11 (10.0.26100)
  • codex-cli 0.118.0
  • Node.js via Git Bash / MSYS2
  • codex installed globally via npm (AppData/Roaming/npm/codex.cmd)

Workaround

Patch app-server.mjs initialize():

const _codexBin = process.platform === "win32" ? process.execPath : "codex";
const _codexArgs = process.platform === "win32"
  ? [require.resolve("@openai/codex/bin/codex.js"), "app-server"]
  : ["app-server"];
this.proc = spawn(_codexBin, _codexArgs, { ... });

Or simply add shell: process.platform === "win32" to the spawn options, consistent with process.mjs.

Affected Plugin

openai-codex Claude Code plugin (codex-companion)

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗