Repository navigation
Description
Summary
Since v0.16.0 (v2026.6.5), GPT-5.x models on the openai-codex provider emit their short pre-tool-call "preamble" text as standalone, user-visible assistant message items (content channel). On chat gateways (Telegram in my case) these are delivered to the end user as interim messages — raw, telegraphic English internal-planning text ("Need patch …", "Convert.", "Vision.") — even though the final answer is correctly formatted. On v0.15.1 the same model kept this text in the reasoning channel, so nothing leaked.
Environment
- Hermes-Agent v0.16.0 (
v2026.6.5); regressed vs v0.15.1 (v2026.5.29.2) - Provider
openai-codex(ChatGPT codex backend), model gpt-5.5 - Gateway: Telegram; terminal backend: docker
display.show_reasoning: false(does not gate this — it's content, not reasoning)
Expected vs. actual
- Expected: pre-tool-call model planning stays internal (reasoning channel), as on v0.15.1.
- Actual: it is surfaced as visible assistant content and delivered mid-turn to the chat user.
Evidence
- Version boundary: under v0.15.1, gpt-5.5 ran for ~2 days under heavy tool/vision/playwright load with 0 content-leak turns. The first sessions on v0.16.0 leak.
- Field-level (session store): leak turns are
role=assistant,finish_reason=tool_calls, non-emptycontentbut emptyreasoning_content/codex_reasoning_items. Clean turns are the inverse (reasoning populated, content empty). So on leak turns the model emits a message item instead of a reasoning item. - Conditional, not constant: within a single v0.16.0 session it stayed clean for hours, then started leaking on a long autonomous tool/vision grind — consistent with GPT-5 emitting preambles only situationally, now surfaced by v0.16.0.
Suspected mechanism
The v0.16.0 backend rework appears to reclassify "intermediate assistant text emitted before a tool call" as standalone message items — same mechanism reported (opposite direction, items dropped) in #39558 and #40903 for Desktop. On gateways the delivery path (_emit_interim_assistant_message → interim_assistant_callback) bypasses transform_llm_output, cf. #35264 (proposal) and #27442.
Impact
Customer-facing chat agents leak raw internal English planning to end users, breaking persona/localization and exposing chain-of-thought-like text.
Workaround
display.platforms.<platform>.interim_assistant_messages: false stops delivery — but also suppresses legitimate interim commentary; it's a blunt mitigation.
Asks
- Don't surface pre-tool-call preamble items as default-visible content on gateways (or route them through
transform_llm_output). - A dedicated config switch / transform hook to gate interim/preamble content (cf. Proposal: add transform_interim_output hook for interim assistant commentary #35264).
Activity
annguyenNous commentedon Jun 7, 2026
Submitted a fix in #41343.
Root cause: In
agent/codex_responses_adapter.py,_normalize_codex_response()added ALL message items tocontent_partsregardless of theirphase. Thesaw_commentary_phaseflag was tracked but never used to route text.Fix: When
normalized_phaseis"commentary"or"analysis", route the message text toreasoning_partsinstead ofcontent_parts. This keeps preamble/internal planning in the reasoning channel where it belongs, matching v0.15.1 behavior.Minimal 1-file change (8 insertions, 1 deletion) in
codex_responses_adapter.py.1kuna commentedon Jun 16, 2026
bump. experiencing same.
teknium1 commentedon Jul 5, 2026
Fixed on main via PR #58868 (salvage of #58696 by @devatnull + #41343 by @annguyenNous, both authorships preserved).
Codex Responses commentary/analysis-phase message text is now routed to the reasoning channel instead of visible assistant content — in both the normalized-response path and live streaming deltas — so pre-tool-call planning fragments no longer leak as visible messages or get concatenated into final answers. The text remains visible as thinking/reasoning display, and the exact phase-tagged items are still replayed for prompt-cache continuity.
fix(codex): route commentary-phase preamble text to reasoning channel (…
STR-751: catch up upstream main to 2026-07-07 (#62)
fix(codex): route commentary-phase preamble text to reasoning channel (…
fix(codex): route commentary-phase preamble text to reasoning channel (…
fix(codex): route commentary-phase preamble text to reasoning channel (…
fix(codex): route commentary-phase preamble text to reasoning channel (…
fix(codex): route commentary-phase preamble text to reasoning channel (…