Skip to content

spawn("codex") fails on Windows — missing shell: true and windowsHide: true #67

@cosyeezz

Description

@cosyeezz

Problem

On Windows, the spawn("codex", ["app-server"], ...) call in scripts/lib/app-server.mjs (line ~188) fails with ENOENT because codex is installed as a batch/cmd wrapper (e.g. codex.cmd). Node.js child_process.spawn on Windows requires shell: true to resolve .cmd/.bat extensions via PATH.

Additionally, when shell: true is set, a visible cmd.exe console window briefly flashes on screen. Setting windowsHide: true prevents this.

Environment

  • Windows 11 Pro (10.0.22631)
  • Node.js v22.x
  • Codex CLI installed globally via npm
  • Claude Code plugin codex@openai-codex v1.0.1

Current code

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

Suggested fix

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

shell is conditionally enabled only on Windows so Unix behavior is unchanged. windowsHide is a no-op on non-Windows platforms.

Steps to reproduce

  1. Install Codex CLI globally on Windows (npm i -g @openai/codex)
  2. Enable the codex@openai-codex plugin in Claude Code
  3. Invoke /codex:rescue with any task
  4. Observe ENOENT error — spawn codex ENOENT

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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