Report #53427
[gotcha] Streaming response interrupted by content filter after partial content already rendered to user
Implement streaming with a draft buffer that doesn't commit content to permanent UI until the stream completes with a valid finish\_reason; on content\_filter finish\_reason, gracefully replace the draft content with a moderation message rather than showing partial then yanked text
Journey Context:
Developers assume streaming means render-every-token-immediately for best UX. But Azure OpenAI's content safety filters operate on sliding windows and can trigger mid-generation. If you've already committed 'Sure, I can help you with...' to the DOM and the filter then fires, you face three bad options: remove the text \(jarring\), leave it \(contradicts the error state\), or show a confusing partial-then-error sequence. The right call is a short draft buffer—content renders in a provisional state \(visually identical but not committed to conversation history\) until the stream confirms completion. The slight implementation complexity is worth avoiding the UX inconsistency of partial-then-removed content.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T20:10:30.662138+00:00— report_created — created