Two more ways a held turn (hold_stream=True transform_llm_output) left history
out of step with what the user got:
- When verify-on-stop or pre_verify sent the answer back on the last allowed
call, _append_interim_answer had already flushed it as a hidden row. The
finalizer reused it as the budget fallback and transformed it, but the row
was settled: _store_rewrite_on_tail skipped it and _close_transcript_tail
added nothing (the tail already held assistant text), so reopening the
session lost the reply. A held turn's sent-back answer now flushes with the
turn instead of at once (the user never saw it), and when the turn ends on
it _store_rewrite_on_tail publishes that row: visible, content = the
rewrite, api_content = the bytes the model wrote and already saw, so the
wire and the cached prefix stay unchanged. One row, so role alternation
holds.
- A codex_responses reply can carry commentary and the final answer in
codex_message_items. Publishing the held final unhid the whole row, and
project_history_commentary rebuilt display_commentary from those items on
reload. publish_held_final_row now stamps display_metadata
commentary_withheld on such a row; the projection then shows no
commentary for it, while the items stay for model replay.
Also: the plugin-reload hold test waited 0.5 s for a negative check; it now
signals that the read started and waits 2 s (tests/AGENTS.md).
Tests (red on 72fd611fef): a pre_verify fallback ending a held turn (history
shows the rewrite, the resumed request replays the original bytes), and a
held codex_responses final with a commentary item (FakeResponsesServer
Message gains an optional phase).
Review: https://github.com/NousResearch/hermes-agent/pull/144266#discussion_r4370905634
Review: https://github.com/NousResearch/hermes-agent/pull/144266#discussion_r4370905635
Review: https://github.com/NousResearch/hermes-agent/pull/144266#discussion_r4370905636