codex - 💡(How to fix) Fix codex_hooks do not fire in interactive sessions when configured via repo-local .codex/config.toml [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#17532Fetched 2026-04-12 13:26:53
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

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.

Error Message

  • Moving hooks = ".../hooks.json" under [features] is invalid and causes a TOML type error. The correct placement is top-level.

Root Cause

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.

Code Example

hooks = "/absolute/path/to/repo/.codex/hooks.json"

[features]
codex_hooks = true
RAW_BUFFERClick to expand / collapse

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

  1. Create a repo-local .codex/config.toml with:
hooks = "/absolute/path/to/repo/.codex/hooks.json"

[features]
codex_hooks = true
  1. Create hooks.json with SessionStart and Stop command hooks.
  2. 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
  3. Start an interactive session with codex from the repo root.
  4. 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.

extent analysis

TL;DR

The issue can be resolved by verifying that the codex_hooks feature is properly enabled and the hook configuration is correctly loaded from the repo-local .codex/config.toml file.

Guidance

  • Verify that the codex_hooks feature is enabled by checking the Codex CLI version and configuration.
  • Check the .codex/config.toml file for any syntax errors or incorrect formatting that may prevent the hook configuration from being loaded.
  • Confirm that the hooks.json file is correctly referenced in the .codex/config.toml file and that the hook scripts are executable.
  • Test the hook scripts manually to ensure they are working as expected and producing the correct output.

Example

No code snippet is provided as the issue is related to configuration and not code.

Notes

The issue may be specific to the Codex CLI version 0.120.0 or the project-local configuration. Further investigation is needed to determine the root cause of the problem.

Recommendation

Apply workaround: Verify the codex_hooks feature is enabled and the hook configuration is correctly loaded, and test the hook scripts manually to ensure they are working as expected. This is because the issue seems to be related to the configuration and loading of the hook scripts rather than a code-specific problem.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING