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 💬 2 comments 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 ↗

2 Comments

Ray0213 · 1 month ago

Additional confirmation after updating and re-testing on July 1, 2026:

  • Still reproducible on macOS with codex-cli 0.142.5
  • codex --version => codex-cli 0.142.5
  • which codex => /Users/hooray0213/.local/bin/codex
  • codex exec --dangerously-bypass-hook-trust --json "pwd" runs successfully, but still emits no hook/started or hook/completed events

I also re-tested in the interactive TUI with a minimal file-probe hook config:

{
  "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'"
          }
        ]
      }
    ]
  }
}

Expected:

  • UserPromptSubmit should create ~/.codex/state/user-prompt-hook.log
  • PreToolUse for Bash should create ~/.codex/state/pretool-hook.log
  • PreToolUse should block the Bash tool call because it exits non-zero

Actual:

  • interactive TUI also does not run either hook
  • no probe log files are created at all
  • ~/.codex/state remains empty after the TUI test

That makes this look stronger than a trust/UI problem:

  • --dangerously-bypass-hook-trust was used for the exec --json repro
  • the TUI repro uses file side effects, so it does not depend on /hooks UI visibility
  • both exec and interactive TUI paths fail to dispatch hooks

So at this point the issue appears to be in hook discovery/dispatch/runtime execution itself, not just hook trust or review UX.

Ray0213 · 1 month ago

Additional confirmation after updating again and re-testing on July 21, 2026:

  • Still reproducible on macOS with codex-cli 0.144.6
  • codex --version => codex-cli 0.144.6
  • which codex => /Users/hooray0213/.local/bin/codex

I re-ran the same minimal isolated file-probe setup under a separate CODEX_HOME:

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

Expected:

  • UserPromptSubmit should create user-prompt-hook.log
  • PreToolUse for Bash should create pretool-hook.log
  • PreToolUse should block the Bash tool call because it exits non-zero

Actual in codex exec --dangerously-bypass-hook-trust --json:

  • Bash executes successfully
  • no hook/started or hook/completed events are emitted
  • no probe log files are created

Actual in interactive TUI (codex --no-alt-screen):

  • Bash also executes successfully
  • no probe log files are created
  • the hook side effects are still completely absent

So this is still reproducible in 0.144.6 across both exec and interactive TUI paths: tool execution works, but hook dispatch/runtime execution still does not occur.