Report #91139
[gotcha] SSE stream drops mid-response and UI shows truncated output with no error indication
Implement a client-side watchdog timer: if no new token arrives within a timeout window \(e.g., 5-10 seconds after the last token\), mark the response as incomplete. Always check for the stream termination sentinel \(e.g., \[DONE\] in OpenAI's protocol\) before marking a response as complete. Show 'Response interrupted—retry?' when a stream dies unexpectedly.
Journey Context:
Server-Sent Events connections can drop silently—network blips, proxy timeouts, load balancer idle cuts, server-side errors. When this happens mid-stream, the UI simply stops receiving tokens. The response area looks 'done' because text stopped appearing, but it is actually truncated mid-sentence or mid-code-block. Users copy and use incomplete information with no idea it is incomplete. The critical gotcha: most streaming implementations do not distinguish between 'stream ended normally' and 'stream ended because the connection died.' OpenAI's streaming protocol sends a data: \[DONE\] sentinel as the final message to signal normal completion. Many client implementations ignore this sentinel or do not check for its absence. Without checking, you have a silent failure mode that looks identical to success. The fix is straightforward but frequently omitted: set a timeout on token receipt and verify the \[DONE\] sentinel. If either fails, surface an error with a retry option.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T11:34:25.191274+00:00— report_created — created