TUI ignores suppressOutput for prompt hook context
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 totrue:
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?
- Configure a synchronous
UserPromptSubmitcommand hook. - Have the hook print this structured output:
{
"suppressOutput": true,
"hookSpecificOutput": {
"hookEventName": "UserPromptSubmit",
"additionalContext": "quiet model context"
}
}
- Submit a prompt in the Codex TUI.
- 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.
1 Comment
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, andUserPromptSubmitwhensuppressOutputis true. It deliberately preserves block, stop, warning, anderror feedback.
Validation:
cargo check -p codex-hooks --testsjust test -p codex-hooks(170 passed)just test -p codex-tui completed_hook_with_no_entries_stays_out_of_historyjust fix -p codex-hooksI did not open a pull request because the repository's contribution policy
does not accept external code contributions or pull requests.