You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
codex_hooks do not fire in interactive sessions when configured via repo-local .codex/config.toml #17532
codex_hooks do not fire in interactive sessions when configured via repo-local .codex/config.toml
Summary
Repo-local .codex/config.toml appears to be loaded for normal project configuration, but hook configuration inside that file does not result in interactive SessionStart or Stop hooks firing.
Create hooks.json with SessionStart and Stop command hooks.
Point the hook commands at scripts that:
read hook payload JSON from stdin
emit valid hook JSON on stdout
write debug artifacts to disk so execution can be confirmed
Start an interactive session with codex from the repo root.
Try to confirm:
startup context injection
stop-time block/reminder behavior
Expected
SessionStart should fire when the interactive session starts
Stop should fire when the interactive session exits
hook output should affect the live session just like manual hook execution output does
Actual
interactive sessions start and stop normally
no evidence that SessionStart fired
no evidence that Stop fired
no startup additionalContext appears in the session rollout log
no stop block/reminder occurs
Important Control Result
The same hook scripts work when run manually:
SessionStart script emits valid JSON with hookSpecificOutput.additionalContext
Stop script emits valid JSON with decision = "block" and a reason
debug artifacts are written correctly
This suggests the problem is not the script payload format itself, but that repo-local hook config is not actually being honored by interactive hook execution.
Notes
Moving hooks = ".../hooks.json" under [features] is invalid and causes a TOML type error. The correct placement is top-level.
The repo-local config format itself parses cleanly once hooks is top-level.
The issue affects at least both SessionStart and Stop, which suggests a config-loading or hook-registration problem rather than an event-specific matcher issue.
Would be super helpful if you could attach more details, thank you!
Also FWIW we don't support a custom path to a hooks.json via top-level hooks field in the config.toml. Codex will resolve the hooks.json by looking in the same directories as any enabled config layers.
~/.codex/config.toml has [features] codex_hooks = true (also confirmed default-true in v0.128.0 source).
Results
Invocation
Probe log written?
systemMessage shown?
codex_hooks debug log
codex exec 'echo test'
✅ yes
n/a (non-interactive)
hook: SessionStart + hook: SessionStart Completed
codex (interactive TUI)
❌ no
❌ no
(no hook log lines)
So the discovery + parsing path works (since exec finds and runs the same hooks.json), but the interactive TUI startup path skips hook execution entirely. Same ~/.codex/hooks.json, same ~/.codex/config.toml, same probe script — only the launch mode differs.
Reproduction
Install probe + config above
codex exec --skip-git-repo-check 'echo' → /tmp/codex-probe.log gets a line
codex (interactive) → no log entry, no system message
Both layers tested (user ~/.codex/ and project ./.codex/) — same result
This affects cross-platform tooling that targets all three of Claude Code / Gemini CLI / Codex via SessionStart hooks (e.g. memory injection at session start). Header + context render fine on Claude and Gemini interactive sessions, silently fail on Codex interactive.
Happy to PR a fix if you can point at where the interactive TUI startup path should call into the hook engine.
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.
Activity
github-actions commentedon Apr 12, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
driptaroop commentedon Apr 13, 2026
can confirm. faced the same issue.
sly-codechum commentedon Apr 13, 2026
Same
abhinav-oai commentedon Apr 15, 2026
Just setup a Stop hook locally and I'm not able to repro
Here's my local setup:
As well as how my conversation looks
Would be super helpful if you could attach more details, thank you!
Also FWIW we don't support a custom path to a
hooks.jsonvia top-levelhooksfield in theconfig.toml. Codex will resolve thehooks.jsonby looking in the same directories as any enabled config layers.leorrose commentedon Apr 16, 2026
same
fix(011-002): correct .codex/hooks.json schema for Codex Stop hook
coladapo commentedon May 3, 2026
+1 — confirmed reproducible on Codex CLI 0.128.0 (macOS, ChatGPT auth). Adding empirical detail in case it helps narrow the cause.
Test setup
Minimal probe hook at
/tmp/codex-probe.sh:Registered at
~/.codex/hooks.json:{ "hooks": { "SessionStart": [ { "matcher": "startup|resume", "hooks": [{ "type": "command", "command": "/tmp/codex-probe.sh", "statusMessage": "PROBE…" }] } ] } }~/.codex/config.tomlhas[features] codex_hooks = true(also confirmed default-true in v0.128.0 source).Results
codex_hooksdebug logcodex exec 'echo test'hook: SessionStart+hook: SessionStart Completedcodex(interactive TUI)So the discovery + parsing path works (since
execfinds and runs the samehooks.json), but the interactive TUI startup path skips hook execution entirely. Same~/.codex/hooks.json, same~/.codex/config.toml, same probe script — only the launch mode differs.Reproduction
codex exec --skip-git-repo-check 'echo'→/tmp/codex-probe.loggets a linecodex(interactive) → no log entry, no system message~/.codex/and project./.codex/) — same resultThis affects cross-platform tooling that targets all three of Claude Code / Gemini CLI / Codex via SessionStart hooks (e.g. memory injection at session start). Header + context render fine on Claude and Gemini interactive sessions, silently fail on Codex interactive.
Happy to PR a fix if you can point at where the interactive TUI startup path should call into the hook engine.
oxysoft commentedon May 8, 2026
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.
fix(init): harden Codex hook command + document --codex (experimental)
8 remaining items
fix(usage): wire codex tracking for any PATH codex, not just chosen p…
Collapse per-agent hook scripts into one universal secrets_guard.py
Add a real Codex UserPromptSubmit hook, correcting the earlier claim
feat(hooks): add macOS notification hook for agent completion/input-w…
docs(research): verify Codex capability surface and upgrade hook proj…
Add Codex CLI support (dual-host loader)
Volume <name>.md naming + name/folder registration + Codex CLI dual-h…
feat: multiharness (Codex + OpenCode) + skill /verify-diff (#16)
feat: hook-driven task state, session drag between panes, and a termi…
feat(codex-stop): codex Stop hook shim over the recovery bridge (T17)
fix(server): make the session reaper safe to run
docs(codex): the hook system exists and the gate still does not ship …
Stop the guard from blocking its own escape hatch
Collapse per-agent hook scripts into one universal secrets_guard.py
Stop the guard from blocking its own escape hatch