Repository navigation
Description
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 offgives 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-messagesare not affected.
Proposed behavior
- Route
output_text.*,content_part.*andoutput_item.donefor 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
391and the reasoning summary, and stops withstop. - 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
- The provider-side reasoning flag does not matter here: the models reason on Responses either way, and dreb shows the same empty answer.
- Fix Responses parsing that drops answers and corrupts tool arguments #547 (closed, not planned) covers the general overlapping-items case and the failed PR 548.
Activity