Skip to content

codex_hooks do not fire in interactive sessions when configured via repo-local .codex/config.toml #17532

Description

@hahnpierre

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghooksIssues related to event hooks

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions