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.
27 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.Windows validation update on Codex Desktop 26.715.10079.0:
The local PreCompact route is present, discovered, and trusted, but the post-update acceptance check is still RETEST_REQUIRED. I do not have a fresh native Desktop PreCompact receipt plus popup from a throwaway /compact; the latest local receipt is from a direct verification path, not Desktop lifecycle dispatch.
Could maintainers confirm whether this build contains the fix for #21639? If not, the remaining gap appears to be Desktop lifecycle dispatch rather than hook discovery, trust, configuration, or the handler.
Windows reproduction: Desktop 26.721.4979.0 / embedded
0.146.0-alpha.3.1still does not dispatch trustedPreToolUsehooksI can reproduce this regression on a current Windows Codex Desktop build. The hook is discovered and trusted, the handler passes direct self-tests for the exact Desktop tool shapes, and the Desktop task was created after the hook definition and trust state were written. Nevertheless, both protected tool actions execute and modify temporary probe files.
Environment
OpenAI.Codex 26.721.4979.0originator:Codex Desktopsource:vscodecli_version:0.146.0-alpha.3.1codex-cli 0.145.010.0.26200codex features list:hooks stable truecodex doctor --json: overall statusok; user config loads successfullySanitized hook configuration
User-level
%USERPROFILE%\.codex\hooks.jsoncontains onePreToolUsegroup:The corresponding entry under
[hooks.state]in%USERPROFILE%\.codex\config.tomlhas a currenttrusted_hash. In/hooks, thePreToolUsegroup is shown as installed/active and was explicitly trusted.Timing evidence (rules out a stale task snapshot)
Local timestamps were:
hooks.jsonupdated:22:22:31config.tomlupdated:22:24:1922:26:13The task therefore started after both installation and trust persistence. Restarting Desktop and creating fresh tasks did not restore dispatch.
Minimal current-session probe
The probe uses only isolated files under
%TEMP%\md_live_hook_probe_<random>\; no real project file is involved.Action 1 — structured file edit
Desktop invoked
functions.apply_patchagainst:The policy handler supports both
apply_patchandfunctions.apply_patch, including FREEFORM string payloads. It should return aPreToolUsedeny decision for this protected filename.Observed: the patch succeeded and changed the temporary file. No DENY was surfaced.
Action 2 — shell command
Desktop invoked
shell_commandto run a deterministic apply script against a pending temporary changeset:The matcher includes both
Bashandshell_command, and the policy recognizesshell_commandplus namespaced variants.Observed: the command ran to completion with exit code
0; the temporary changeset was applied. No DENY was surfaced.Handler controls
The same deployed policy handler was tested directly:
Result:
The self-test covers the exact relevant inputs:
apply_patchwith object payloadapply_patchwith FREEFORM string payloadfunctions.apply_patchBashshell_commandDirect evaluation returns
denyfor both probe actions. This indicates the failure occurs before handler evaluation: discovery/trust succeeds, but the live Desktop tool path does not invoke the handler.A separate
codex execcontrol on PATH CLI0.145.0also allowed the pending temporary changeset to land. I am not using that as proof of the Desktop-specific path, but it is consistent with the other reports here that some non-interactive paths are affected after the trust/dispatch changes.Expected behavior
Before either tool executes, Codex should dispatch the matching trusted
PreToolUsehandler and honor its deny result:manuscript.mdmust remain unchanged;Actual behavior
Both temporary writes land successfully. Reinstalling the handler, re-reviewing trust, restarting Codex, restarting Windows, and creating brand-new tasks do not change the result.
This extends the reproduced affected range on Windows to Desktop
26.721.4979.0/ embedded runtime0.146.0-alpha.3.1.macOS App Server reproduction: stable
codex-cli 0.146.0still omitsPreToolUseandPostToolUseI reproduced the dispatch failure with the stable
@openai/codex@0.146.0release through the stdio App Server on macOS arm64.Exact tuple
0.146.0rust-v0.146.01.130.0, Extension Development Host22.23.1app-server --stdio --strict-configHook configuration shape
features.hooks=truePreToolUsecommand hookPostToolUsecommand hook*--dangerously-bypass-hook-trustControls that pass
codex --versionreturnscodex-cli 0.146.0.initialize/initializedsucceed.hooks/listreturns both injected hooks with the expected command, matcher, and hashes..codexstate is unchanged by the probe.Real action result
A bounded exact-host turn requested one read-only shell action and one disposable-workspace patch.
The App Server emitted the two supported action items, but the injected handler received neither
PreToolUsenorPostToolUse. The client failed closed, withheld the final response, and its read-only sandbox prevented the disposable file mutation.No credentials, personal paths, raw prompts, raw responses, governed file contents, or raw tool output were captured. This extends the affected range to the stable
0.146.0App Server path, after successful discovery and trust bypass but before handler dispatch.macOS VS Code reproduction with same-runtime CLI control (0.146.0-alpha.9.2)
I reproduced the hook-dispatch gap in a fresh VS Code extension thread and then ran a controlled standalone CLI session using the exact embedded Codex binary from that extension.
Environment
openai.chatgpt 26.727.40816codex-cli 0.146.0-alpha.9.2~/.codex/hooks.jsonSessionStartandPostToolUseforapply_patchCodexHooksFresh VS Code thread - failure
019fbc72-947f-7ca3-b4c0-566e53fde46ccodex_vscode / vscodepid:59837:9b7dea1f-3772-4b38-959f-f88eafeae38aObserved:
SessionStartdeveloper context.target = codex_app_server::outgoing_messagereturned zero bodies beginning withapp-server event: hook/startedorapp-server event: hook/completed..shfile was created viaapply_patch;PostToolUseproduced no lifecycle events, context, or session throttle marker.Standalone CLI control - success
The CLI was launched from the extension embedded binary and reports the same runtime version.
019fbc7a-dd55-71c2-95e5-e56938107286codex-tui / clipid:63569:a55d3405-10da-4b66-a82e-acb7b5851d2eObserved:
SessionStarthook/startedandhook/completedoutgoing-message rows.sha256:97093bb4d6df54cacacdbfebc735b8a2f4458e0b579228e48c6e1866f8ae424aPostToolUsecreation viaapply_patchhook/startedlog ID 960459.hook/completedlog ID 960461.PostToolUsedeletion viaapply_patchhook/startedlog ID 961010.hook/completedlog ID 961011.The same user hook link, configuration, trust state, working directory, and runtime version were used by both surfaces. The handler also passes direct and synthetic controls. The distinguishing variable is the launch surface: TUI dispatches completely, while the VS Code/app-server thread emits no lifecycle events at all.
This appears to place the failure after discovery and trust but before lifecycle dispatch in the VS Code/app-server path. I can provide narrowly filtered, redacted transcript or SQLite rows if useful.
macOS Desktop: plugin trusted, but no lifecycle events dispatch
I can reproduce this with a plugin-installed hook bundle.
Environment
26.727.51351(6119)codex-cli 0.146.0-alpha.9.2Observed
SessionStart,UserPromptSubmit,PermissionRequest,PreToolUse,PostToolUse, orStop.This appears to fail after plugin discovery/trust but before Desktop/app-server lifecycle dispatch. It also shows the regression is not limited to
PreToolUseandPostToolUse; evenUserPromptSubmitandStopare absent.No prompts, responses, transcripts, credentials, command arguments, or raw tool output were captured.