Skip to content

Responses parser drops the answer when a reasoning item streams inside an open message item #593

Backlog

Description

@m-aebrer

Summary

dreb 2.84.2 returns an empty answer from some openai-responses providers that sit behind a LiteLLM chat-completions-to-Responses bridge, when the model reasons. The answer is in the stream, and the events that carry it name the message's own item id. This is the narrower case that the closing comment on #547 asked for: "an event's own item id, correctly applied, fixes output that positional routing corrupted."

Current behavior

processResponsesStream in packages/ai/src/providers/openai-responses-shared.ts tracks one currentItem/currentBlock pair. The bridge opens the message item first. It then streams the whole reasoning item at the same output_index: 0, and after that sends the message's text and completion:

output_item.added      msg_…  (message, content [])
content_part.added     msg_…  (output_text, "")
output_item.added      rs_…   (reasoning)
reasoning_summary_*    rs_…
output_item.done       rs_…   (reasoning)
output_text.done       msg_…  text "391"
content_part.done      msg_…  text "391"
output_item.done       msg_…  (message, content [{output_text "391"}])
response.completed            output: [reasoning, message "391"]

The reasoning item replaces the open text block, and its output_item.done clears currentBlock. The later output_text.* events and the message's output_item.done find no current text block, so they are ignored. dreb stops normally with [{text: ""}, {thinking: …}].

Captured on 2026-12-03 with:

dreb -p --mode json --model <provider>/<model> --thinking medium "What is 17*23? Reply with just the number."
  • --thinking off gives the same result when the model reasons anyway.
  • A second model behind the same bridge streams this shape whenever it reasons. When it does not reason, the answer comes through.
  • The same models over anthropic-messages are not affected.

Proposed behavior

  • Route output_text.*, content_part.* and output_item.done for a message to the text block of the item id they name, even when another item was started more recently.
  • When an event names an id dreb has not recorded, keep today's positional routing. Never abort: the Fix Responses parsing that drops answers and corrupts tool arguments #547 attempt (PR 548) aborted on unknown ids and broke GitHub Copilot streams.
  • Keep the provider's item order. Do not reorder blocks.

Acceptance criteria

  • For the event sequence above (saved locally, no network), dreb's assistant message has the answer 391 and the reasoning summary, and stops with stop.
  • An event with an unknown item id does not abort the stream, and existing Copilot and OpenAI Responses tests still pass.
  • A live request to an affected provider shows the answer text.

Context

Activity

  1. added
    bug
    on Dec 3, 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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions