TUI ignores suppressOutput for prompt hook context

Open 💬 1 comment Opened Aug 26, 2026 by ZaunEkko

What version of Codex CLI is running?

codex-cli 0.149.1; the behavior is also present on main at 9dea1f709f.

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64, Codex TUI.

What issue are you seeing?

A successful UserPromptSubmit hook that returns model-facing additionalContext
is rendered in the TUI even when the structured output sets suppressOutput to
true:

UserPromptSubmit hook (completed)
  hook context: commit-commands runtime metadata for this turn: ...

The hook output parser preserves suppressOutput, but the session-start and
user-prompt-submit event parsers currently discard it. The context therefore
becomes both model input and a visible HookOutputEntryKind::Context entry.

What steps can reproduce the bug?

  1. Configure a synchronous UserPromptSubmit command hook.
  2. Have the hook print this structured output:
{
  "suppressOutput": true,
  "hookSpecificOutput": {
    "hookEventName": "UserPromptSubmit",
    "additionalContext": "quiet model context"
  }
}
  1. Submit a prompt in the Codex TUI.
  2. Observe that the successful hook and its context are displayed.

The same parsing issue applies to SessionStart and SubagentStart context.

What is the expected behavior?

The additional context should still reach the model, but a successful hook
with suppressOutput: true should not produce a visible context entry in the
TUI. Block, stop, warning, and error feedback should remain visible.

Additional information

The TUI already omits completed hook runs whose output entry list is empty, so
the event parser can implement this without a protocol change: keep the
model-facing context while omitting only the visible context entry.

View original on GitHub ↗

1 Comment

ZaunEkko · 2 days ago

I prepared a validated reference implementation in my fork:

https://github.com/ZaunEkko/codex/commit/8566d14b2d

The patch separates model-facing additional context from the visible hook
output entry for SessionStart, SubagentStart, and UserPromptSubmit when
suppressOutput is true. It deliberately preserves block, stop, warning, and
error feedback.

Validation:

  • cargo check -p codex-hooks --tests
  • just test -p codex-hooks (170 passed)
  • just test -p codex-tui completed_hook_with_no_entries_stays_out_of_history
  • just fix -p codex-hooks

I did not open a pull request because the repository's contribution policy
does not accept external code contributions or pull requests.