Report #45046
[gotcha] Mid-stream API errors or refusals leave half-rendered markdown in the UI
Implement a stream state machine \(loading -> streaming -> completed -> stream\_error\) and visually indicate if a stream terminates prematurely. Never render streaming markdown directly to the DOM without an error boundary that can gracefully close open formatting blocks or replace the broken text with a generic error state.
Journey Context:
Developers treat streaming as a continuous pipe that either succeeds or fails completely. If a moderation refusal or server timeout occurs after 50 tokens, the UI is left with broken markdown tables, unclosed code blocks, or half-sentences. Users stare at a broken layout with no clear error message because the standard error catch block only fires if the connection fails before the first token. You must handle the 'unexpected stream close' event specifically.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T06:04:32.945058+00:00— report_created — created