Skip to content

[Bug] app-server spawn fails with ENOENT on Windows (missing shell: true) #16874

@nap-zzz

Description

@nap-zzz

What version of Codex CLI is running?

0.118.0

What subscription do you have?

pro

Which model were you using?

N/A — the app-server fails to spawn before any model is selected. Used via Claude Code plugin /codex:review (default model).

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What terminal emulator and version are you using (if applicable)?

VSCode 3.0.4 (integrated terminal, Git Bash)

What issue are you seeing?

On Windows, the codex app-server subprocess fails to start with spawn codex ENOENT when invoked from the Claude
Code plugin (/codex:review).

Root Cause

In plugins/codex/scripts/lib/app-server.mjs line 188, spawn("codex", ["app-server"]) is called without shell:
true. On Windows, codex is installed as a .cmd shim (codex.cmd) by npm, which requires a shell to execute.

In contrast, plugins/codex/scripts/lib/process.mjs correctly sets shell: process.platform === "win32" for
spawnSync, so binaryAvailable("codex") and other sync calls work fine. The async spawn in app-server.mjs lacks
this handling.

Steps to Reproduce

  1. Install Codex CLI on Windows: npm install -g @openai/codex
  2. Verify it works: codex --version → codex-cli 0.118.0 ✓
  3. Run /codex:review from Claude Code
  4. Observe error: spawn codex ENOENT

Expected Behavior

codex app-server should start successfully on Windows.

Suggested Fix

Add shell: true on Windows to the spawn call in app-server.mjs:

this.proc = spawn("codex", ["app-server"], {
cwd: this.cwd,
env: this.options.env,
stdio: ["pipe", "pipe", "pipe"],
shell: process.platform === "win32" // <-- add this
});

Environment

  • OS: Windows 11
  • Codex CLI: 0.118.0
  • Plugin: @openai/codex-plugin-cc
  • Node.js: v22.19.0

What steps can reproduce the bug?

  1. Install Codex CLI on Windows: npm install -g @openai/codex
  2. Confirm it works: codex --version → codex-cli 0.118.0 ✓
  3. Use the Claude Code plugin and run /codex:review
  4. Error: spawn codex ENOENT

Root cause: In plugins/codex/scripts/lib/app-server.mjs line 188, spawn("codex", ["app-server"]) is called without shell: true. On Windows, npm installs codex as a .cmd shim (codex.cmd), which requires a shell to execute.

Note that plugins/codex/scripts/lib/process.mjs already handles this correctly with shell: process.platform === "win32" for spawnSync calls, so binaryAvailable("codex") passes. Only the async spawn in app-server.mjs is missing this.

What is the expected behavior?

codex app-server should start successfully on Windows. Adding shell: process.platform === "win32" to the spawn options would fix it:

// app-server.mjs line 188
this.proc = spawn("codex", ["app-server"], {
cwd: this.cwd,
env: this.options.env,
stdio: ["pipe", "pipe", "pipe"],
shell: process.platform === "win32" // add this
});

Additional information

  • codex --version works fine in both bash and Node.js (spawnSync with shell: true)
  • Only the spawn (async, no shell) in app-server.mjs fails
  • The .cmd shim exists at C:\Users<user>\AppData\Roaming\npm\codex.cmd

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't workingwindows-osIssues related to Codex on Windows systems

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions