Report #52294
[gotcha] AI response cuts off mid-sentence during streaming due to safety filter
Buffer the last complete sentence or paragraph before rendering to the DOM, and implement a graceful 'stop' UI state with a specific error message rather than just halting the stream.
Journey Context:
Developers assume the API will return a refusal before streaming starts. However, content moderation often runs concurrently on token chunks. If a violation is detected mid-stream, the connection drops. If you render token-by-token, the user sees half-toxic or half-formed sentences before the freeze. Buffering prevents displaying broken or unsafe text and allows the UI to transition cleanly to an error state.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T18:16:11.215652+00:00— report_created — created