Skip to content

spawn codex ENOENT on Windows — app-server.mjs missing shell: true for .cmd wrapper resolution #32

Closed

Description

@cadamsgcmlp

Summary

On Windows, all review and task commands fail with spawn codex ENOENT because SpawnedCodexAppServerClient in scripts/lib/app-server.mjs uses child_process.spawn("codex", ...) without shell: true. Node.js spawn on Windows uses CreateProcessW, which only resolves .exe binaries — not the .cmd wrappers that npm install -g creates.

Environment

  • OS: Windows 11 Enterprise 10.0.26100
  • Node: v25.4.0
  • npm: 11.7.0
  • Codex CLI: @openai/codex 0.117.0 (installed globally via npm)
  • Plugin version: latest from marketplace

Steps to Reproduce

  1. Install Codex globally on Windows: npm install -g @openai/codex
  2. Run /codex:setup — reports ready: true, all checks pass
  3. Run /codex:review --base <branch> — fails with:
spawn codex ENOENT

Root Cause

The codebase already handles this correctly in scripts/lib/process.mjs — both runCommand and binaryAvailable set shell: process.platform === "win32" (line 12), which is why /codex:setup succeeds.

However, scripts/lib/app-server.mjs line 188 spawns the app server without this flag:

// app-server.mjs:188-192
this.proc = spawn("codex", ["app-server"], {
  cwd: this.cwd,
  env: this.options.env,
  stdio: ["pipe", "pipe", "pipe"]
});

Suggested Fix

Add the same platform-aware shell option already used in process.mjs:

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

Verified locally — reviews and tasks run successfully after this one-line change.

Activity

  1. added a commit that references this issue on Mar 31, 2026
    43195bf
  2. Ranb972 commented on Mar 31, 2026

    @Ranb972

    Same issue here. Windows 11, PowerShell, Claude Code. /codex:review --background starts but shell commands fail with exit -1 in the Codex sandbox.

  3. added a commit that references this issue on Mar 31, 2026
    1a79ae5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions