Skip to content

fix: resolve Codex spawn failures on Windows - #562

Merged
Jinwoo-H merged 1 commit into
mainfrom
Jinwoo-H/codex-windows
Apr 13, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
Jinwoo-H/codex-windows

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Apr 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Fix "spawn EINVAL" error when adding Codex accounts on Windows — child_process.spawn cannot execute .cmd/.bat batch scripts without shell: true
  • Fix "PTY timeout" for Codex usage tracking on Windows — same root cause affecting both the RPC and PTY fetch paths
  • Patch node-pty@1.1.0 to fix Windows build: prefix batch scripts with .\ in winpty.gyp and remove Spectre-mitigated library requirement

All changes are guarded by process.platform === 'win32' checks — zero impact on macOS/Linux.

Test plan

  • Verify Codex usage tracking shows data instead of "PTY timeout" on Windows
  • Verify "Manage Accounts → Add" completes without "spawn EINVAL" on Windows
  • Verify pnpm install succeeds on Windows without Spectre-mitigated MSVC libs
  • Verify no regressions on macOS (all guards are win32-only)

🤖 Generated with Claude Code

closes #589

On Windows, resolveCodexCommand() returns .cmd files (e.g. codex.cmd from
npm). Node's child_process.spawn and node-pty cannot execute batch scripts
directly, causing EINVAL errors for account login and PTY timeouts for
usage tracking.

- Add shell: true on win32 for child_process.spawn calls (RPC fetcher,
  account login)
- Route node-pty spawn through cmd.exe /c for .cmd/.bat files (PTY
  fetcher)
- Patch node-pty@1.1.0 to fix winpty build on Windows: prefix batch
  scripts with .\ and remove Spectre-mitigated library requirement

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Jinwoo-H
Jinwoo-H merged commit 3793125 into main Apr 13, 2026
1 check passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't add codex account; codex cli not found

1 participant