Skip to content

bug(agents): output_item.added/done handler flushes buffered text without valid phase — commentary leaks on OpenAI Responses stream #61814

Closed

Description

@100yenadmin

Description

When the OpenAI Responses adapter receives output_item.added or output_item.done events, the handler flushes any buffered text content without checking whether the current phase is user-visible. This means commentary/work-note text accumulated during tool-calling phases gets emitted to user-facing channels.

Root cause

The flush path in the output_item event handlers does not consult currentPhase before forwarding buffered text blocks. The phase-gate check only exists on the response.text.delta / response.text.done paths but not on the item-level flush.

Impact

  • Internal commentary text leaks to end users on messaging channels (Telegram, Feishu, etc.)
  • Affects OpenAI Responses API stream adapter specifically
  • Intermittent — only triggers when text is buffered before an output_item boundary

Related

Reproduction

  1. Configure an agent with openai-responses provider and a messaging channel
  2. Trigger a multi-tool-call response where the model emits text between tool calls
  3. Observe that buffered text flushes to the channel on output_item.added

Activity

  1. steipete commented on Apr 6, 2026

    @steipete
    Contributor

    Closing as fixed by #61829, which merged in bbd0702.

    Your root-cause writeup lines up with the patch we merged: phase-aware visible-text hardening in the OpenAI Responses path, including the buffered-text / output-item flush family and the related history sanitization follow-through.

  2. locked as resolved and limited conversation to collaborators on Apr 9, 2026
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

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions