codex - 💡(How to fix) Fix Hooks do not fire in interactive sessions (v0.125.0) [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#19780Fetched 2026-04-28 06:37:24
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×3closed ×1commented ×1cross-referenced ×1

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.

Error Message

Added hooks to the global ~/.codex/hooks.json. Same result — hooks are loaded (no error) but never execute.

Root Cause

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.

Code Example

codex_hooks    stable    true

---

my-project/.codex/hooks.json
my-project/.codex/config.toml  (with [features] codex_hooks = true)

---

[features]
codex_hooks = true

[[hooks.SessionStart]]

[[hooks.SessionStart.hooks]]
type = "command"
command = "touch /tmp/codex_hook_fired"
timeout = 10

---

{
  "hooks": {
    "SessionStart": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "touch /tmp/codex_hook_fired"
          }
        ]
      }
    ]
  }
}

---

codex --enable codex_hooks
RAW_BUFFERClick to expand / collapse

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.

extent analysis

TL;DR

Check the Codex CLI documentation for any specific requirements or limitations on hook execution in interactive sessions.

Guidance

  • Verify that the codex_hooks feature is properly enabled and configured, as shown in the codex features list output.
  • Review the Codex CLI documentation to ensure that hooks are supported in interactive sessions and that the configuration files are correctly formatted.
  • Test the hooks with a different event, such as SessionEnd, to see if the issue is specific to SessionStart.
  • Check if there are any open issues or pull requests related to hook execution in interactive sessions, such as #17532, which may provide more information or a potential fix.

Example

No code snippet is provided as the issue seems to be related to configuration and documentation rather than code.

Notes

The issue may be related to a limitation or bug in the Codex CLI, and further investigation is needed to determine the root cause.

Recommendation

Apply workaround: Try testing the hooks with a different event or configuration to see if the issue is specific to SessionStart or interactive sessions. This may help identify a potential workaround or provide more information for further debugging.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

SessionStart hook should execute touch /tmp/codex_hook_fired on session startup, creating the file.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Hooks do not fire in interactive sessions (v0.125.0) [1 comments, 2 participants]