Skip to content

Hooks never execute on Windows — ${PLUGIN_ROOT:-...} is bash-only, no commandWindows variant #238

Description

@yterterian

Version: databricks 0.2.10 · codex-cli 0.146.1 · Windows 11 26200 · %COMSPEC% = C:\WINDOWS\system32\cmd.exe

All three hooks in hooks/codex-hooks.json use ${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}. Codex spawns hooks via %COMSPEC%, which is cmd.exe. cmd.exe has no ${VAR:-default} expansion, so the token is passed through literally:

python3: can't open file '...\${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}\hooks\databricks-context.py': [Errno 22] Invalid argument
python:  can't open file '...\${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}\hooks\databricks-context.py': [Errno 22] Invalid argument

Both fallbacks fail, so the hooks have never run on Windows. The scripts themselves are fine — invoked directly they exit 0 and emit correct JSON.

The failure is silent. The trailing || true masks it whenever Git for Windows' true.exe is on PATH (it ships at C:\Program Files\Git\usr\bin\true.exe). Under a narrower PATH the mask fails and codex reports SessionStart hook (failed) error: hook exited with code 1. So the observable symptom is environment-dependent, but the hook is non-functional either way.

Suggested fix: add a commandWindows variant using an absolute %PLUGIN_ROOT% path and a cmd-safe fallback (|| exit /b 0 rather than || true). Related upstream: openai/codex#34690.

Activity

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