Skip to content

fix(framework): a Codex hook that was never trusted is skipped in silence, and the journal with it #699

Description

@blafourcade

Codex will not run a hook it has not been asked to trust, and says nothing when it declines. A freshly installed plugin therefore journals nothing, and the silence is indistinguishable from a session where nothing happened.

What was measured

A plugin installed for Codex, enabled in ~/.codex/config.toml, with a hook whose command resolves to a file that exists. Four consecutive codex exec sessions ran clean and wrote no journal. No warning, no line in the output, nothing in the log. The fifth ran with --dangerously-bypass-hook-trust and the same install produced all three hooks and its journal:

hook: SessionStart      Completed
hook: PostToolUse       Completed
hook: Stop              Completed

The mechanism is [hooks.state] in ~/.codex/config.toml: one trusted_hash per hook, written when a person approves it. A hook with no entry is skipped.

Why it matters here

The run journal is the only thing that ties a session to the step that was running. Losing it on a tool loses per-step attribution on that tool, and it fails in the shape this measurement layer exists to avoid: no error, a plausible empty result, and nothing on the record saying a measurement was not taken.

It also lands hardest where it is least visible. A person running Codex interactively approves once and never thinks about it again. Anything headless — CI, an agent, a scripted run — never sees the prompt, and every session it produces is silently unattributed.

Done when

  • Installing a plugin that ships hooks for Codex says, at install time, that its hooks need trusting and how to grant it.
  • A session whose journal hook did not run is distinguishable from one where nothing happened — the report says the journal is missing rather than showing an empty period.
  • The headless path has a documented way to grant trust that does not require a person at a terminal.
  • A test fails if an install that carries hooks reports success without mentioning what is still needed to run them.

Out of scope

Granting trust automatically. A hook trust prompt exists because a plugin hook runs arbitrary commands; routing around it on the user's behalf is not this ticket.

Where it was found

While verifying #698 end to end. The hooks arrive correctly and the command resolves — that part works. This is the next gate after delivery.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    Status
    In review

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions