Regression in 0.142.5 on macOS: hooks.json is discovered neither in exec nor TUI; no hook/started emitted even with --dangerously-bypass-hook-trust

Open 💬 1 comment Opened Jul 1, 2026 by Ray0213

What issue are you seeing?

On macOS with codex-cli 0.142.5, hooks configured in ~/.codex/hooks.json do not run at all.

This reproduces in both:

  • codex exec --json
  • interactive TUI (codex)

Even with --dangerously-bypass-hook-trust, no hooks fire, no hook/started or hook/completed events are emitted, and file-probe hooks produce no side effects.

Environment

  • macOS
  • codex-cli 0.142.5
  • which codex => /Users/hooray0213/.local/bin/codex

Minimal reproduction

Configured ~/.codex/hooks.json with minimal file-writing probes:

{
  "hooks": {
    "userPromptSubmit": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "/bin/sh -c 'date >> /Users/hooray0213/.codex/state/user-prompt-hook.log'"
          }
        ]
      }
    ],
    "preToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "/bin/sh -c 'date >> /Users/hooray0213/.codex/state/pretool-hook.log; exit 2'"
          }
        ]
      }
    ]
  }
}

Then ran:

codex exec --dangerously-bypass-hook-trust --json "pwd"

And also tested interactive TUI by sending a prompt that should trigger a Bash tool call.

Expected behavior

  • userPromptSubmit should write ~/.codex/state/user-prompt-hook.log
  • preToolUse with matcher Bash should write ~/.codex/state/pretool-hook.log
  • preToolUse should block the Bash tool call because the hook exits non-zero
  • codex exec --json should emit hook/started / hook/completed

Actual behavior

  • pwd runs successfully
  • no hook/started or hook/completed events appear
  • interactive TUI also does not run userPromptSubmit or preToolUse
  • ~/.codex/state remains empty
  • no file-probe logs are created at all

Why this does not appear to be trust/config related

  • --dangerously-bypass-hook-trust was used
  • minimal ~/.codex/hooks.json was tested
  • both exec and interactive TUI paths fail
  • file-probe hooks produce no side effects
  • this was also reproduced earlier with isolated minimal hook setups

Additional notes

This looks like a hooks discovery/dispatch regression rather than a trust failure, because the runtime appears to skip hook execution entirely.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗