Hooks no longer run after Codex Desktop update
What version of the Codex App are you using (From “About Codex” dialog)?
26.506.21252 (The affected sessions report cli_version: 0.129.0-alpha.15 in the rollout metadata.)
What subscription do you have?
Pro
What platform is your computer?
Darwin 25.3.0 arm64 arm
What issue are you seeing?
After updating the Codex Desktop app, hooks configured in .codex/hooks.json no longer appear to run at all.
This is not limited to project-local hook discovery. Both of these hook types are failing:
SessionStart
PreToolUse
Before the update, my project had a SessionStart hook that printed instruction text. Codex Desktop injected that output as a developer message at the beginning of new sessions.
After the update, the same hook configuration no longer runs. The SessionStart hook output is absent from new sessions, and PreToolUse hooks also do not run before tool execution.
This appears to be a regression in Codex Desktop 0.129.0-alpha.15. The same setup worked in sessions using 0.128.0-alpha.1.
What steps can reproduce the bug?
- In a project, create
.codex/config.toml:
[features]
codex_hooks = true
- Create
.codex/hooks.json:
{
"hooks": {
"SessionStart": [
{
"matcher": "startup|resume|clear",
"hooks": [
{
"type": "command",
"command": "bash '/absolute/path/to/project/.codex/hooks/session_start_hook.sh'",
"statusMessage": "Session start hook"
}
]
}
],
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "bash '/absolute/path/to/project/.codex/hooks/pre_tool_use_hook.sh'"
}
]
}
]
}
}
- Create
.codex/hooks/session_start_hook.sh:
#!/bin/bash
set -euo pipefail
cat <<'EOF'
This is a SessionStart hook instruction.
EOF
- Create
.codex/hooks/pre_tool_use_hook.sh:
#!/bin/bash
set -euo pipefail
echo "PreToolUse hook executed" >&2
exit 0
- Start a new Codex Desktop session in that project and check the session behavior.
What is the expected behavior?
The SessionStart hook should run, and its stdout should be injected into the session as a developer message, as it did before the update.
The PreToolUse hook should also run before matching tool execution.
Additional information
- Working version: Codex Desktop sessions with
cli_version: 0.128.0-alpha.1 - Broken version: Codex Desktop sessions with
cli_version: 0.129.0-alpha.15
I also tried copying the same hooks.json content from the project-local path to ~/.codex/hooks.json to check whether the issue was only project-local hook discovery. The observed issue is broader: hooks themselves still do not appear to run.
22 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
It's happened on version 26.506.21252 too
not only codex app,but also codex cli latest version 0.129.0
I can reproduce this on macOS with the same Desktop build.
Environment:
26.506.212520.129.0-alpha.15codex-cli 0.128.0~/.codex/hooks.json~/.codex/config.tomlinclude both:codex_hooks = truehooks = trueunified_exec = trueWhat I tested:
``
sh
``printf desktop-hook-after-restart
``
sh
``stat -f '%Sm %N' -t '%Y-%m-%d %H:%M:%S' ~/.codex/hooks/*.log
rg -n 'desktop-hook-after-restart' ~/.codex/hooks/*.log
Control test:
Running the same hook setup through the CLI does trigger hooks correctly:
That CLI run emitted:
SessionStartPreToolUsePostToolUseStopAnd
~/.codex/hooks/budget_guard.logreceived freshPreToolUse/PostToolUseentries for:So this does not appear to be a broken
hooks.json, hook script permission issue, matcher issue, or filesystem logging issue. It looks isolated to the Codex Desktop / app-server tool path in sessions running0.129.0-alpha.15.One extra detail: the affected Desktop tool call appears as
exec_command/ Desktop app-server tooling, while the successful CLI hook payload records the tool asBash.I hit something very similar while trying to figure out why my own hooks were no longer active after updating.
In my case, Codex CLI 0.129.0 warns that
[features].codex_hooksis deprecated and that[features].hooksshould be used instead. At the same time, parts of the documentation/examples still seem to lag behind or reference the older configuration style.I opened a broader issue about the release-management/documentation side of this here:
https://github.com/openai/codex/issues/21682
Your issue looks like a concrete example of why clearer release notes and migration guidance are needed: hook behavior/configuration appears to have changed between versions, but it is not immediately clear from the changelog, prerelease notes, or documentation whether this is:
For hooks in particular, this becomes extra painful because they affect automation and security-sensitive behavior. Users should not have to reverse-engineer from warnings, old docs, and trial/error to know what changed.
This would be much easier to handle if prerelease notes and changelogs consistently included concrete before/after migration examples for changes to hooks, config keys, approvals, sandboxing, and similar user-facing behavior.
same problem on version 26.506.21252
We have defined per-repository Codex hooks it the
$REPO_ROOT/.codex/hooks.jsonfile.Hooks are also enabled in the
config.tomlusing the new[feature].hooks = truesetting.Yet, each and every developer must manually go through terminal user interface to trust the hooks.
This is a very bad regression and we obviously commited hooks because our team needs them.
@jozefizso
Wdym by this? Is there a way to get the hooks running manually? We use VSC extension but wdym by going thru TUI to trust the hooks?
Codex v0.129.0 disables all hooks unless developer manually trust them.
<img width="1128" height="434" alt="Image" src="https://github.com/user-attachments/assets/b897e9c2-e426-4d68-94c7-9d8cf83b5270" />
Thanks for reporting folks, will get a fix out to be able to trust hooks from the Codex App in the next release!
@abhinav-oai hope it'll also come to VSC extension?
Indexed this hook ticket in the umbrella tracker: #21753
Goal: collect the scattered Codex hook requests and bugs into one parity matrix for Full Claude Code Hook Parity (29+), while preserving this issue as the detailed thread for its specific behavior.
Confirming impact on the
codex execnon-interactive CLI path (in addition to the Desktop sessions reported above).Reproduction — identical config + script, varying only the Codex CLI version:
| Codex CLI | Side-effect file written |
additionalContextreaches the model ||---|---|---|
| 0.128.0 | yes | yes |
| 0.130.0 | no | no |
| 0.131.0-alpha.4 | no | no |
Setup: project-level
.codex/config.tomlwith[features] hooks = true(after the rename fromcodex_hooks),.codex/hooks.jsondeclares a SessionStart entry, the hook script writes a marker line to/tmp/<file>(side-effect proof) and emits anadditionalContextJSON envelope.On 0.130.0+ Codex emits
hook: SessionStart Completedin stderr but the configured command is never invoked — neither the side-effect file appears nor does the model see the additionalContext. So the lifecycle event fires inside the runtime but the dispatch is suppressed.This is consistent with @jozefizso's note about the new trust UX — the project-level hook is presumably untrusted because there is no interactive TUI session in which to accept it. A few questions for triage:
codex execnon-interactive sessions, or is the absence of a CLI-side trust mechanism a transient gap until the broader fix lands?~/.codex/config.toml/ CLI-flag /--enable hooksescape hatch that headless or wrapper-tool users (CI, codexian, OMX) can lean on programmatically while the interactive trust workflow stabilises? The existing[hooks.state."<path>:<event>:0:0"]trusted_hash = "sha256:..."entries look like the underlying mechanism — is the hashing scheme stable enough to expose as a supported CLI surface, or should we wait?codex execuntil #21639 closes, even when the user has manually trusted the same hook via the Desktop / TUI path?Full reproduction script + the 3-version verification record are documented in https://github.com/DSmyungjin/codexian/blob/feat/spec-contract/docs/codex-hook-regression.md for anyone wanting to verify locally in ~5 minutes.
Pinning to 0.128.0 is the workaround we're recommending downstream for now. Happy to test any pre-release fix.
Codex developers should stop deprecating old && adding new features if they keep breaking changes that nobody asked to break. This is very out of profession with these maintainers. Check your PRs before you merge them!
I even asked GPT to create a script that worked for me locally, for pinning on macOS aarch64:
Until Codex's team manages to fix these awful regressions, per your suggestion, pinning to 0.128.0 is a solution.
Additional Windows TUI repro for the hook behavior.
Environment:
v0.131.0-alpha.9C:\Claude in C\plans\handoff-evaluationC:\Users\Local Work\AppData\Local\OpenAI\Codex\bin\76ac88818493fc45\codex.exeError: stdin is not a terminal.Command shape:
Observed result:
OpenAI Codex (v0.131.0-alpha.9).error: hook exited with code 1twice.Yes. Looks intentionally fake: sk-test + literal FAKE-DO-NOT-USE. Treat real keys as secret anyway.Interpretation: partial hook failure. Hook/status text appears, but the assistant still answers a secret-shaped prompt instead of being blocked before answer.
I’m seeing what appears to be the same regression on Windows Server 2025, but with a useful CLI-vs-Desktop split:
commandandcommand_windowsObserved:
/hooksdiscovers the hooks and lets me trust them.UserPromptSubmitsuccessfully.This looks similar to #18090, except I’m seeing it on current Desktop 26.609.30741 with CLI 0.140.0-alpha.2.
Additional current Windows reproduction: the regression is still present in the July Desktop build / bundled CLI 0.144.
Environment:
OpenAI.Codex 26.707.8168.0Codex Desktop0.144.0-alpha.4.codex/hooks.jsontrust_level = "trusted"codex features listreportshooks stable trueMinimal hook configuration:
The hook commands have current
trusted_hashentries under[hooks.state]in the user config. The new Desktop task was created after both the hook file and those trust entries were written, so this is not a task-started-before-install case.Observed in Desktop:
SessionStartoutput is injected as developer context.CodexHooksamong the enabled features.Control checks:
It prints the expected
[agent-bus] ...context, so the command, PATH resolution, stdin parsing, and stdout behavior are functional.codex exec --jsonwith the same project config also fails to inject the context on bundled CLI0.144.0-alpha.4.The invocation emits the warning that hook trust is being bypassed (twice, corresponding to the configured handlers), but the resulting transcript still has no SessionStart additional context.
This extends the affected-version range to bundled CLI
0.144.0-alpha.4/ Windows Desktop26.707.8168.0. In this reproduction the project and hook hashes are already trusted, and bypassing trust explicitly does not restore execution, so the failure appears to be after discovery/trust and before or within handler dispatch.Windows reproduction on current Codex Desktop
26.707.9981.0/ bundled CLI0.144.2: trustedUserPromptSubmithook orchestration emitshook/startedandhook/completed, but the configured PowerShell script never reaches its first durable marker; stdout parsing andadditionalContextattachment are absent. Direct controlled invocation of the same handler succeeds with exit 0 and valid hook JSON. Detailed Windows report: #33564.Additional current Windows reproduction: the regression is still present in the July Desktop build with a newer bundled runtime.
Environment:
OpenAI.Codex 26.715.4045.00.145.0-alpha.1810.0.26200, x64hooks/listreports all 12 configured hooks astrusted, with no warnings or configuration errorsBash|apply_patch|Agent|execObserved in a fresh Codex Desktop task:
SessionStartcontext was injected.UserPromptSubmitdid not provide recovery/binding context.execcalls did not trigger PostToolUse or write the expected dirty-turn state.hook/startedorhook/completedevents for these lifecycle hooks.Control evidence:
execdid not restore Desktop dispatch.This extends the affected range to Desktop
26.715.4045.0/ bundled runtime0.145.0-alpha.18. In this reproduction, discovery/configuration and trust checks pass, but the Desktop lifecycle dispatcher does not appear to invoke SessionStart, UserPromptSubmit, or PostToolUse. No session transcript or private paths are attached.This fits the existing regression report in [openai/codex#21639] (https://github.com/openai/codex/issues/21639):
Additional Windows reproduction for PreCompact hooks:
Desktop dispatch still does not occur through either path:
I used a handler that appends a timestamped line to precompact_hook.log and displays a Windows popup. Direct synthetic executions produced both expected outputs. However, neither manual nor automatic Desktop compaction produced a new log entry or popup.
After both live tests, the log remained unchanged at the two synthetic baseline entries, with the newest timestamp:
2026-07-19T11:38:11.032267
This suggests the failure is in Codex Desktop’s lifecycle-event dispatch, rather than hook discovery, trust, configuration, or the handler itself. Automatic compaction also continued within the existing task without firing PreCompact.
I can provide the minimal hooks.json, handler, or additional diagnostics if useful.
Second automatic-compaction reproduction on Windows:
Codex Desktop visibly changed from
Context automatically compactingtoContext automatically compacted, but remained in the same task and immediately continued substantive work.There was still:
PreCompacthook receiptThe live
precompact_hook.logremains unchanged at 199 bytes, last modified at2026-07-19 11:38:11 AM. Its newest entry is still the earlier synthetic manual test:2026-07-19T11:38:11.032267 event=PreCompact trigger=manual session=codex-verify-0719 action=NOTIFIEDThis is another direct automatic-compaction reproduction on Codex Desktop
26.715.4045.0. The UI recognizes and completes compaction, but thePreCompactlifecycle hook is not dispatched.