When Codex CLI notifications stop working, the cause is almost always one of five things: the hook hasn't been trusted, the hook file isn't loaded, the hook runs but fails or prints something it shouldn't, the event you rely on doesn't fire when you expect, or the operating system hides the alert. Type /hooks inside Codex to see what is loaded and trusted, run the hook's command by hand with sample input, then check your notification settings on the computer or phone. If you use Notifier for Codex, codex-notifier doctor and codex-notifier test cover most of this in two commands.
011. Is the hook trusted?
This is the most common cause in Codex. A new or edited hook does nothing until you review and trust it. Codex records trust against a hash of the exact definition, so changing the command, matcher or timeout makes it untrusted again.
- Start
codex. If hooks need review, it prints a warning at startup. - Type
/hooks, find your entries, and trust them. - After every edit to
hooks.json, do it again.
022. Is the file loaded?
- Right place?
~/.codex/hooks.json(%USERPROFILE%\.codex\hooks.jsonon Windows). If you setCODEX_HOME, the file goes there instead. Project hooks in.codex/hooks.jsonload only in trusted projects. - Valid JSON? No trailing commas, no comments. Run
python3 -m json.tool ~/.codex/hooks.jsonto check. - Right shape? Event name, then a list of matcher groups, each with a
hookslist of handlers with"type": "command". See Codex hooks explained. - Hooks turned off? Check
config.tomlforhooks = falseunder[features]. An administrator can also allow managed hooks only (allow_managed_hooks_only). - Declared twice? Hooks in both
hooks.jsonand[hooks]in the same folder'sconfig.tomlboth load, with a warning, and can run twice.
033. Does the hook run, and succeed?
Run the command yourself with the kind of input Codex sends:
echo '{"hook_event_name":"Stop","cwd":"/tmp/demo","session_id":"test","last_assistant_message":"done"}' | ~/.codex/hooks/your-script.sh
Then look for:
- "Invalid output" from a Stop hook.
Stopaccepts only JSON or nothing on stdout. A strayecho, orcurlprinting a response, breaks it. Redirect output to/dev/null. - Command not found. Hooks may not see the same
PATHas your interactive shell. Use full paths, such as/opt/homebrew/bin/terminal-notifier. - Timeouts. The default is 600 seconds, but a hung
curldelays the end of the turn. Add--max-time 10and atimeout, or"async": true. - Wrong working folder. Commands run in the session's folder, so relative paths like
.codex/hooks/x.shbreak when Codex starts in a subfolder. Use absolute paths.
For more detail from Codex itself, codex doctor checks your install, config, auth and runtime, and setting log_dir in config.toml turns on a plaintext codex-tui.log.
044. Does the event fire when you think it does?
- There is no Notification event in Codex. Hooks named
Notificationin a copied config do nothing. UseStopfor "finished" andPermissionRequestfor "needs approval". PermissionRequestonly fires when Codex would ask you. In the default Auto preset, commands inside the sandbox run without asking, so no prompt and no hook. With--ask-for-approval neveror--yolo, it never fires. With auto-review (approvals_reviewer = "auto_review"),PermissionRequesthooks still run first; only what they leave undecided goes to the reviewer.notifyonly sendsagent-turn-complete. It never reports approvals, and it's ignored in a project's.codex/config.toml.- The built-in alert waits for the terminal to lose focus (
notification_condition = "unfocused") and is only a bell in many terminals. See the built-in notifications guide. - Questions come mostly in plan mode. In the default mode, Codex usually asks in its reply, which is a
Stop.
055. Is the operating system hiding it?
- macOS:
osascriptnotifications appear as Script Editor. Allow it in System Settings > Notifications, and check Focus. - Windows: check Focus assist / Do Not Disturb, and that the BurntToast module is installed for your user.
- Linux:
notify-sendneeds a notification daemon and a desktop session. Over SSH there is none. - Phone: check notification permission for the app, Focus or Do Not Disturb, and battery savers that delay background apps on Android.
06If you use Notifier for Codex
Two commands check almost everything:
codex-notifier doctor # hooks, trust hashes, credentials, server, presence detection
codex-notifier test # sends a test notification to every paired phone
doctor tells you if hooks are missing (codex-notifier setup reinstalls them), if a trust hash is missing or stale (also fixed by setup), if the hooks point at an old binary after a move, and whether any phone is paired.
Common cases:
- Nothing on the phone while you're at the computer. That's by design. If you typed in the last 30 seconds, approvals and questions stay in the terminal, and if you're looking at the terminal Codex runs in, the phone gets nothing. Step away to test, or use
codex-notifier test. - The phone gets the alert but Codex doesn't wait. Over SSH or wherever your idle time can't be read,
codex-notifierdoesn't hold Codex.doctorshows what it detects;codex-notifier config set hold_without_presence onmakes it hold anyway. - Quiet at night. Check
quiet_hourswithcodex-notifier config show. - "Not paired any more". The server no longer recognises the computer (for example, after 60 days unused). Run
codex-notifier pairagain. - Duplicate alerts. You have your own notification hooks or the built-in alert as well. Remove one.
The log is at ~/.config/codex-notifier/codex-notifier.log (%APPDATA%\codex-notifier\ on Windows).
07FAQ
My hook worked yesterday and stopped today. Why?
If you edited it, or a tool rewrote it, the trust hash no longer matches: trust it again in /hooks. A Codex upgrade can also change behaviour, so check the release notes and codex doctor.
Why do I get the same notification twice?
Codex runs every matching hook from every source. The same command in ~/.codex/hooks.json and in a project file, or in both hooks.json and config.toml, runs twice. The built-in TUI alert can add a third.
Can I test a hook without waiting for Codex?
Yes. Pipe sample JSON into the command, as in step 3. For codex-notifier, codex-notifier test sends a test push.
Does --dangerously-bypass-hook-trust fix it?
It runs hooks without stored trust for one invocation, so it can confirm trust is the problem. Don't use it day to day; trust the hook in /hooks instead.