Codex Let Commands Through When Its Safety Check Broke. Now You Choose.
Version 0.173.0 adds a setting that stops the tool, but it stays off until someone adds it to each hook.
A safety check that crashes should stop the thing it was checking. In Codex, OpenAI's coding agent, that isn't the default. OpenAI's hooks guide says that when a check before a tool call errors, times out or answers in a form Codex can't read, that failure "can let the tool run." On December 1, OpenAI released Codex 0.173.0, which lets a builder change that, one check at a time.
Rowan Vale is the AI host, speaking with HeyGen’s Sabrina voice.
The checks are called hooks: small programs Codex runs at set moments, such as just before it uses a tool. People use them to block dangerous commands or catch a password before it leaves the machine. The new setting is onFailure. Set it to block and a hook that fails before a tool call stops the tool. Leave it out and nothing changes, because the pull request that added it says the default, continue, "preserves existing behavior." OpenAI's reason for adding it is plain: continuing after a failed check "can let an action proceed without a completed check."
Jon's agents use Codex every day, so on December 2 they broke a hook on purpose in 0.173.0. The command behind it was harmless: create one empty file. With the default setting, the file was created when the hook quit with an error, when it ran past its time limit, and when it printed broken output. With onFailure set to block, Codex stopped the command all three times. A working hook let the command through under both settings. The default failure is easy to miss, too. Run as codex exec with normal text output, Codex printed "hook: PreToolUse Failed" for the hook that quit with an error, then ran the command anyway. With --json, the output scripts read, none of the three failures showed up at all.
One failure fooled the obvious guess. When the hook pointed at a Python script that didn't exist, Codex blocked the command even on the default. Python quits with code 2 when it can't find its file, and code 2 is also how a hook tells Codex to block. So a test that only deletes the script can make a weak setup look safe. Make the hook quit with code 1, then make it time out, and watch both.
The change is one setting on each hook that has to work, shown here in a hooks.json entry:
{ "type": "command", "command": "python3 /path/to/check.py", "timeout": 30, "onFailure": "block" }Then approve the hook again. Codex trusts a hook's exact definition, and adding this setting changes it. A changed hook is "skipped until trusted," so in the meantime it checks nothing. Type /hooks in Codex to review it. Hooks an administrator manages don't need that step.
Set the timeout too. Most hooks get 600 seconds if nobody picks a number, and with block on, a stuck check holds the tool up for that long before stopping it. The setting doesn't fit every hook. Codex rejects it on background hooks, on hooks that run when a session ends, and on hooks around each request to the model. After a tool call it can only hide the result, since the tool has already run. The hooks guide hadn't caught up on December 2: it doesn't mention onFailure at all, so the release notes and the pull request are the pages to work from.
Put it on the hooks that protect something, and leave it off the ones that only take notes. A logging hook that breaks shouldn't stop the work.
Sources
- OpenAI Codex docs: HooksPrimary · Dec 2, 2026
- OpenAI Codex 0.173.0 release notesPrimary · Dec 1, 2026
- OpenAI Codex pull request 62831: Let required hooks block continuation on failurePrimary · Nov 20, 2026
Comments
No comments yet.
Sign in to comment. You'll come back to this story.