fix done marker for error frame - #5568
Conversation
📝 WalkthroughWalkthroughStreaming responses now track Bifrost error chunks and omit the terminal ChangesSSE termination handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
52453d7 to
d0c6d7d
Compare
7f02a81 to
85057f8
Compare
d0c6d7d to
195b962
Compare
85057f8 to
328c763
Compare
Merge activity
|
The base branch was changed.

Summary
Fixes a bug where a
data: [DONE]marker was emitted after an error frame in a streaming response, causing clients keyed on that marker to interpret a failed or truncated stream as a clean, successful completion. This was the root ambiguity behind truncated upstream streams appearing successful (issue #5546).Changes
sawErrorChunkboolean inhandleStreamingResponsethat is set when a chunk carrying aBifrostErroris written to the wire. If this flag is set, the[DONE]marker is suppressed at the end of the stream, since the error frame already serves as a terminal signal.runCompletererrors are intentionally not factored into this decision — those reflect post-processing or plugin failures, not an incomplete stream, so[DONE]remains accurate in that case.streamdonemarker_test.gowith two regression tests: one asserting[DONE]is absent after an error frame, and one guarding against over-suppression by confirming clean streams still receive the marker.Type of change
Affected areas
How to test
go test ./transports/bifrost-http/handlers/...TestStreamingResponseSkipsDoneAfterErrorChunkverifies that a stream ending with an error frame does not emit[DONE].TestStreamingResponseSendsDoneOnCleanStreamverifies that a clean stream still receives[DONE].Breaking changes
Related issues
Closes #5546
Security considerations
None.
Checklist
docs/contributing/README.mdand followed the guidelines