Hooks do not fire in interactive sessions (v0.125.0)
Summary
Hooks configured in ~/.codex/hooks.json (global) and .codex/hooks.json / .codex/config.toml (project-level) do not fire in interactive sessions on Codex CLI v0.125.0.
Environment
- Codex CLI version: v0.125.0
- OS: macOS Darwin 24.6.0 (Apple Silicon)
- Shell: zsh
Feature flag status
codex_hooks stable true
Confirmed via codex features list.
What I tried
1. Project-level hooks.json
my-project/.codex/hooks.json
my-project/.codex/config.toml (with [features] codex_hooks = true)
Codex shows the warning: loading hooks from both .codex/hooks.json and .codex/config.toml — confirming files are discovered — but no hooks fire.
2. Project-level config.toml (TOML format)
[features]
codex_hooks = true
[[hooks.SessionStart]]
[[hooks.SessionStart.hooks]]
type = "command"
command = "touch /tmp/codex_hook_fired"
timeout = 10
File /tmp/codex_hook_fired is never created.
3. Global ~/.codex/hooks.json
Added hooks to the global ~/.codex/hooks.json. Same result — hooks are loaded (no error) but never execute.
4. Minimal test
Reduced to the absolute minimum:
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "touch /tmp/codex_hook_fired"
}
]
}
]
}
}
Started codex, exited. /tmp/codex_hook_fired does not exist.
5. CLI flag
codex --enable codex_hooks
Same result.
Expected behavior
SessionStart hook should execute touch /tmp/codex_hook_fired on session startup, creating the file.
Actual behavior
No hooks fire. No errors in output. Hook configuration is silently loaded but never executed.
Context
I'm building a project management harness (PM-Harness) that uses hooks for schema validation (PreToolUse), session context injection (SessionStart), and feedback loops (Stop). It works with Claude Code and I'm adding Codex CLI support. The hook scripts are ready and dual-compatible, but blocked by this issue.
Possibly related to #17532.
2 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Indexed this hook ticket in the umbrella tracker: #21753
Goal: collect the scattered Codex hook requests and bugs into one parity matrix for Full Claude Code Hook Parity (29+), while preserving this issue as the detailed thread for its specific behavior.