Skip to content

fix(windows): resolve codex.cmd via shutil.which#223

Open
recycletechno wants to merge 1 commit intobanteg:masterfrom
recycletechno:codex/fix-windows-codex-cmd-resolution
Open

fix(windows): resolve codex.cmd via shutil.which#223
recycletechno wants to merge 1 commit intobanteg:masterfrom
recycletechno:codex/fix-windows-codex-cmd-resolution

Conversation

@recycletechno
Copy link

Summary

Fix Windows takopi codex runner startup by resolving the Codex executable from PATH instead of hardcoding "codex".

Problem

On Windows, Codex is commonly installed as codex.cmd via npm. PowerShell resolves that fine, but Python subprocess invocation does not automatically pick it up when Takopi hardcodes "codex" in src/takopi/runners/codex.py.

That leads to:

FileNotFoundError: [WinError 2] The system cannot find the file specified

The repo already handled the same Windows CLI resolution problem for Claude in:

claude.py now resolves the executable via shutil.which(...), but codex.py still uses a hardcoded "codex".

Changes

  • resolve codex with shutil.which("codex")
  • on Windows, also try shutil.which("codex.cmd")
  • raise a clear ConfigError if no Codex executable is found on PATH

Why this approach

This is a small runner-local fix that matches the existing precedent in claude.py and avoids relying on shell-specific command resolution behavior.

If you'd prefer to solve this centrally through the broader Windows subprocess handling in #204, I am happy to rework or close this PR.

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.

1 participant