Hooks do not fire in interactive sessions (v0.125.0)

Resolved 💬 2 comments Opened Apr 27, 2026 by Riku4230 Closed Apr 27, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

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.

View original on GitHub ↗

2 Comments

github-actions[bot] contributor · 4 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #17532

Powered by Codex Action

oxysoft · 3 months ago

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.