Skip to content

GPT-5.5 (openai-codex): pre-tool-call preamble text leaks as visible assistant content to chat gateways since v0.16.0 #41293

Closed

Description

@fa1k3

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-empty content but empty reasoning_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

  1. Don't surface pre-tool-call preamble items as default-visible content on gateways (or route them through transform_llm_output).
  2. A dedicated config switch / transform hook to gate interim/preamble content (cf. Proposal: add transform_interim_output hook for interim assistant commentary #35264).

Activity

  1. added
    type/bugSomething isn't working
    P2Medium — degraded but workaround exists
    on Jun 7, 2026
  2. annguyenNous commented on Jun 7, 2026

    @annguyenNous

    Submitted a fix in #41343.

    Root cause: In agent/codex_responses_adapter.py, _normalize_codex_response() added ALL message items to content_parts regardless of their phase. The saw_commentary_phase flag was tracked but never used to route text.

    Fix: When normalized_phase is "commentary" or "analysis", route the message text to reasoning_parts instead of content_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.

  3. 1kuna commented on Jun 16, 2026

    @1kuna

    bump. experiencing same.

  4. teknium1 commented on Jul 5, 2026

    @teknium1
    Collaborator

    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.

  5. added a commit that references this issue on Jul 5, 2026
    538173f
  6. added a commit that references this issue on Jul 8, 2026
    f9976ea
  7. added a commit that references this issue on Jul 8, 2026
    c541b0e
  8. added a commit that references this issue on Jul 13, 2026
    8fb9274
  9. added a commit that references this issue on Jul 21, 2026
    09bfbc1
  10. added a commit that references this issue on Aug 7, 2026
    20b05b8
  11. added a commit that references this issue on Sep 3, 2026
    7374be6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existsprovider/copilotGitHub Copilot (ACP + Chat)type/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions