Report #40196
[gotcha] Streaming SSE connections silently drop, leaving UI in a hanging state with partial response
Implement a client-side watchdog timeout \(e.g., 15-30 seconds of no new tokens\) that detects a stalled stream and surfaces an error with a retry option. Always show a definitive 'stream complete' indicator when the stream finishes normally. Use the DONE sentinel in SSE streams to confirm completion rather than relying on the connection closing.
Journey Context:
SSE connections can drop due to network issues, proxy timeouts, load balancer idle timeouts, or server-side errors that do not send an error event. The UI shows a partial response with what looks like an active stream, and the user has no idea whether the AI is still generating or the connection died. The naive approach—relying on the EventSource error event—misses the common case of silent drops where the connection simply goes stale. The fix is a dual approach: \(1\) a client-side watchdog timer that triggers if no tokens arrive within N seconds \(reset on each new token\), and \(2\) explicit stream completion signaling using the DONE marker that OpenAI and compatible APIs send at the end of a stream. Without both, you will get reports of 'the AI just stopped mid-sentence' with no actionable error state.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T21:56:36.193936+00:00— report_created — created