Repository navigation
codex_hooks do not fire in interactive sessions when configured via repo-local .codex/config.toml #17532
Description
Activity
- addedbugSomething isn't workingSomething isn't workingCLIIssues related to the Codex CLIIssues related to the Codex CLIhooksIssues related to event hooksIssues related to event hooksconfigIssues involving config.toml, config keys, config merging, or config updatesIssues involving config.toml, config keys, config merging, or config updates
on Apr 12, 2026 github-actions commented
on Apr 12, 2026 on Apr 12, 2026 – with GitHub ActionsContributorMore actionsPotential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
- removedCLIIssues related to the Codex CLIIssues related to the Codex CLIconfigIssues involving config.toml, config keys, config merging, or config updatesIssues involving config.toml, config keys, config merging, or config updates
on Apr 12, 2026 can confirm. faced the same issue.
Same
Just setup a Stop hook locally and I'm not able to repro
Here's my local setup:
─────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │ File: .codex/hooks.json ─────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 1 │ { 2 │ "hooks": { 3 │ "Stop": [ 4 │ { 5 │ "hooks": [ 6 │ { 7 │ "type": "command", 8 │ "command": "/usr/bin/python3 \"$(git rev-parse --show-toplevel)/.codex/hooks/stop_keep_going.py\"", 9 │ "timeout": 30, 10 │ "statusMessage": "blocking end of turn" 11 │ } 12 │ ] 13 │ } 14 │ ] 15 │ } 16 │ } ─────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ─────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │ File: .codex/config.toml ─────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 1 │ [features] 2 │ codex_hooks = true ─────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ─────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │ File: .codex/hooks/stop_keep_going.py ─────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 1 │ #!/usr/bin/env python3 2 │ 3 │ import json 4 │ import sys 5 │ import time 6 │ 7 │ 8 │ def main() -> int: 9 │ json.load(sys.stdin) 10 │ json.dump({"decision": "block", "reason": "keep going"}, sys.stdout) 11 │ sys.stdout.write("\n") 12 │ return 0 13 │ 14 │ 15 │ if __name__ == "__main__": 16 │ raise SystemExit(main()) ─────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────As well as how my conversation looks
› hi • Hi. • Stop hook (blocked) feedback: keep goingWould 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.same
- added a commit that references this issue
on Apr 26, 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:#!/bin/bash date -u +"%Y-%m-%dT%H:%M:%SZ probe fired" >> /tmp/codex-probe.log echo '{"systemMessage":"PROBE WORKED"}'
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
Invocation Probe log written? systemMessage shown? codex_hooksdebug logcodex exec 'echo test'✅ yes n/a (non-interactive) hook: SessionStart+hook: SessionStart Completedcodex(interactive TUI)❌ no ❌ no (no hook log lines) 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
- Install probe + config above
codex exec --skip-git-repo-check 'echo'→/tmp/codex-probe.loggets a linecodex(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.
- added a commit that references this issue
on May 21, 2026 8 remaining items
- added a commit that references this issue
on Jun 21, 2026 - added a commit that references this issue
on Jul 3, 2026 - added a commit that references this issue
on Jul 8, 2026 - added a commit that references this issue
on Jul 14, 2026 - added a commit that references this issue
on Jul 21, 2026 - added 2 commits that reference this issue
on Jul 23, 2026 - added a commit that references this issue
on Jul 25, 2026 - added a commit that references this issue
on Aug 16, 2026 - added a commit that references this issue
on Aug 17, 2026 - added a commit that references this issue
on Sep 5, 2026 - added a commit that references this issue
on Sep 8, 2026 - added a commit that references this issue
on Sep 10, 2026 - added 2 commits that reference this issue
on Sep 24, 2026
Bug Report Draft
Title
codex_hooksdo not fire in interactive sessions when configured via repo-local.codex/config.tomlSummary
Repo-local
.codex/config.tomlappears to be loaded for normal project configuration, but hook configuration inside that file does not result in interactiveSessionStartorStophooks firing.Environment
0.120.0./.codex/config.tomlReproduction
.codex/config.tomlwith:hooks.jsonwithSessionStartandStopcommand hooks.codexfrom the repo root.Expected
SessionStartshould fire when the interactive session startsStopshould fire when the interactive session exitsActual
SessionStartfiredStopfiredadditionalContextappears in the session rollout logImportant Control Result
The same hook scripts work when run manually:
SessionStartscript emits valid JSON withhookSpecificOutput.additionalContextStopscript emits valid JSON withdecision = "block"and areasonThis 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
hooks = ".../hooks.json"under[features]is invalid and causes a TOML type error. The correct placement is top-level.hooksis top-level.SessionStartandStop, which suggests a config-loading or hook-registration problem rather than an event-specific matcher issue.