[Bug] Responses-family parsers drop the terminal SSE event and unparented text deltas #1770
Replies: 1 comment 1 reply
|
Investigated this report and produced a candidate fix, validated on a fork of this repository. Root cause, fix and validation from the working notes:
Diff: awhite0030/prime-agent@main...fix-responses-parser-data-loss-15600850845829273638 The change passes |
Uh oh!
There was an error while loading. Please reload this page.
Affected area
AI providers and models
What happened?
Two silent data-loss bugs in the OpenAI Responses-family parsers.
parseSSEonly yields events delimited by a blank line inside the read loop. If the server closes right after the lastdata:line, the terminalresponse.completedevent is lost, along with usage and stop reason. CRLF is also not tolerated.output_text.deltaandrefusal.deltawhen nocontent_part.addedarrived first. Azure, OpenRouter, and proxies do this, and the streamed text vanishes with no error.Steps to reproduce
data:line and no blank line, then close the connection. The client never seesresponse.completed.response.output_text.deltawithout a precedingresponse.content_part.added. The assistant text is gone.Expected behavior
Flush remaining SSE after the read loop, same as the Anthropic iterator, and normalize CRLF. Lazily create the missing content part before appending a delta.
Prime Agent version
0.7.1 / source as of 2026-08-08
Environment
Reproduced from source. The delta drop shows up on Azure, OpenRouter, and other Responses-compatible endpoints that skip
content_part.added.Additional context
Original report: #995
Tested patch, closed in the August 15 backlog sweep: #996
All reactions