GSD Version
Installed hook scripts report gsd-hook-version: 1.41.2.
Runtime
Codex CLI
Operating System
Windows
Shell
PowerShell / Windows shell invocation from Codex hooks
What happened?
Some GSD-managed Codex hooks are emitted as shell scripts invoked with bare bash, for example:
"command": "bash 'C:\\Users\\REDACTED\\.codex\\hooks\\gsd-validate-commit.sh'"
and:
"command": "bash 'C:\\Users\\REDACTED\\.codex\\hooks\\gsd-phase-boundary.sh'"
On this Windows machine, Git for Windows is installed, but bash is not on PATH in the PowerShell/Codex environment. Direct reproduction:
The term 'bash' is not recognized as a name of a cmdlet, function, script file, or executable program.
This surfaces in Codex as hook failures, including SessionStart, PreToolUse, and PostToolUse warnings:
SessionStart hook (failed)
error: hook exited with code 1
PreToolUse hook (failed)
error: hook exited with code 1
PostToolUse hook (failed)
error: hook exited with code 1
The same scripts succeed when invoked with the resolved Git Bash executable:
"C:/Program Files/Git/bin/bash.exe" "C:/Users/REDACTED/.codex/hooks/gsd-session-state.sh"
"C:/Program Files/Git/bin/bash.exe" "C:/Users/REDACTED/.codex/hooks/gsd-validate-commit.sh"
"C:/Program Files/Git/bin/bash.exe" "C:/Users/REDACTED/.codex/hooks/gsd-phase-boundary.sh"
What did you expect?
On Windows, the GSD Codex installer/migrator should not emit bare bash unless it has verified that bash is available in the runtime PATH Codex will use.
Possible fixes:
- Resolve Git Bash and emit the absolute executable path, for example
C:/Program Files/Git/bin/bash.exe.
- Prefer Node or PowerShell wrappers for these hooks on Windows.
- If no supported shell is found, skip the Bash-backed hooks with a clear install-time warning instead of installing commands that will fail every time.
Steps to reproduce
- Use Windows with Git Bash installed but not exposed as
bash on PATH.
- Install or migrate GSD Codex hooks that include
bash ...gsd-*.sh commands.
- Start Codex or trigger a matching tool event.
- Hooks fail with exit code 1 because
bash cannot be resolved.
Control check: running the same hook scripts with C:/Program Files/Git/bin/bash.exe exits 0.
Impact
Moderate. Managed hooks are installed but fail noisily at runtime. Depending on which hook fires, this can affect session-state injection, commit validation, and phase-boundary reminders.
Workaround
Manually edit ~/.codex/config.toml and replace bare bash commands with the resolved Git Bash executable path, using double-quoted forward-slash paths.
Related
Related to #3362, but this is a Codex runtime/install issue with GSD-managed Bash-backed hooks. #3362 is Gemini-focused and mentions Bash ambiguity as a workaround note; this report captures the concrete Codex failure and successful resolved-path workaround.
Privacy Checklist
GSD Version
Installed hook scripts report
gsd-hook-version: 1.41.2.Runtime
Codex CLI
Operating System
Windows
Shell
PowerShell / Windows shell invocation from Codex hooks
What happened?
Some GSD-managed Codex hooks are emitted as shell scripts invoked with bare
bash, for example:and:
On this Windows machine, Git for Windows is installed, but
bashis not on PATH in the PowerShell/Codex environment. Direct reproduction:This surfaces in Codex as hook failures, including
SessionStart,PreToolUse, andPostToolUsewarnings:The same scripts succeed when invoked with the resolved Git Bash executable:
What did you expect?
On Windows, the GSD Codex installer/migrator should not emit bare
bashunless it has verified thatbashis available in the runtime PATH Codex will use.Possible fixes:
C:/Program Files/Git/bin/bash.exe.Steps to reproduce
bashon PATH.bash ...gsd-*.shcommands.bashcannot be resolved.Control check: running the same hook scripts with
C:/Program Files/Git/bin/bash.exeexits 0.Impact
Moderate. Managed hooks are installed but fail noisily at runtime. Depending on which hook fires, this can affect session-state injection, commit validation, and phase-boundary reminders.
Workaround
Manually edit
~/.codex/config.tomland replace barebashcommands with the resolved Git Bash executable path, using double-quoted forward-slash paths.Related
Related to #3362, but this is a Codex runtime/install issue with GSD-managed Bash-backed hooks. #3362 is Gemini-focused and mentions Bash ambiguity as a workaround note; this report captures the concrete Codex failure and successful resolved-path workaround.
Privacy Checklist