mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-27 16:07:02 +00:00
When OpenAI Responses streaming has compact keepalive commit 200 headers but no semantic SSE event has been written, upstream 4xx errors were silently swallowed, causing clients to hang until timeout. The fix distinguishes between 'headers committed' and 'meaningful SSE output written'. Compact keepalive may commit headers for heartbeat purposes without writing actual SSE events. In that case, the Responses stream still needs its protocol-correct terminal response.failed event. Preserves existing behavior when a complete upstream response or meaningful SSE payload was already communicated, and preserves image keepalive semantics. Fixes #5289