Bug Report Draft
Title
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.
Environment
- Codex CLI version:
0.120.0
- Installation: npm global package
- Platform: macOS Apple Silicon
- Repo uses project-local config:
./.codex/config.toml
Reproduction
- Create a repo-local
.codex/config.toml with:
hooks = "/absolute/path/to/repo/.codex/hooks.json"
[features]
codex_hooks = true
- 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.
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.