Independent review of the hold_stream feature found four paths that still
let the untransformed reply or commentary reach the user:
- History loads showed held commentary. The tool-call assistant row of a
held turn is now typed display_kind="hidden" before its first flush
(withhold_held_commentary), so TUI/Desktop display_projection, the
dashboard and classic CLI resume skip it. display_kind never reaches the
wire: the model's context and cached prefix are unchanged (test replays
the resumed session and compares the request bytes). The TUI projection
still labels the hidden row's tool cards from its calls. Codex held turns
type their earlier agentMessages hidden the same way.
- A plugin reload mid-turn could empty the hook registry before the final
transform. The held turn now snapshots its transform_llm_output callbacks
together with the hold decision under the discovery lock
(held_stream_transforms) and runs that snapshot at the final. If no
callback rewrote and one raised or timed out, the user gets a fixed
"reply withheld" notice instead of the original (fail closed).
- Classic CLI replay-gap recovery painted and spoke pre_transform_response.
A held turn's result (generic and codex) no longer carries the original
at all (public_pre_transform), so receipts, recovery and post-stream
suffix painting only ever see the rewrite.
- Codex error-after-text returned the raw agentMessage. The codex reply is
now transformed whenever it has text, also when the turn errored (and,
when held, when interrupted).
Same class, also fixed: the end-of-stream scrubber flush recorded a held
tail as streamed text (an interrupted turn could return it as an
untransformed partial final), and quiet-mode CLI printed held commentary
via _vprint.
The codex app-server bookkeeping passed turn.final_text (pre-transform)
to _sync_external_memory_for_turn, so a memory provider stored the text
a transform_llm_output plugin removed. Pass the reply the user got, as
the generic loop's finalizer does.
Review: https://github.com/NousResearch/hermes-agent/pull/144266#discussion_r4369545047
The codex app-server runtime returns before finalize_turn, so
transform_llm_output never ran there (pre-existing): a rewriting
plugin's change never reached the user or the stored assistant row,
and with hold_stream the user waited only to get the raw reply.
Apply the transform before the projected rows are persisted and return
response_transformed / pre_transform_response like the generic loop.
Review: https://github.com/NousResearch/hermes-agent/pull/144266#discussion_r4369515509