SIGN IN SIGN UP

fix: insert separator between Responses API phase commentary and final text (#312173)

* test: add failing test for missing separator between phase commentary and final text

When the Responses API streams a commentary message item followed by a
final message item, the text from both items gets directly concatenated
in the textAccumulator without any separator, producing e.g.
'Commentary text.Final text.' instead of properly separated text.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: insert separator between output items in Responses API stream

When the Responses API streams multiple message output items (e.g.
commentary followed by final), their text deltas were all accumulated
into a single textAccumulator without any separator. This caused text
like 'Commentary text.Final text.' instead of properly separated
paragraphs.

Track the output_index of the last text delta and emit a paragraph
break (\n\n) when text arrives from a different output item.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* test: use last accumulated text instead of brittle index-from-end

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
U
Ulugbek Abdullaev committed
2993fbd0aedaf19cf7ab7b46f9268d02e402baf3
Parent: 8c833a0
Committed by GitHub <noreply@github.com> on 4/24/2026, 8:49:03 AM