mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-17 20:52:15 +03:00
Issue #10443: when the upstream kills an SSE stream mid-generation (antigravity/Gemini does this under its own rate enforcement), OmniRoute closed the stream silently for OpenAI-format clients - HTTP 200, a few content chunks, no finish_reason. The client sees a truncated turn. resolveSilentCloseReason() only flagged that shape for Claude clients (#7699). Extend it to OpenAI chat completions guarded on sawContent(), and teach hasClientTerminalSseMarker() that a non-null finish_reason chunk is a terminal marker (some providers omit data: [DONE]). Every known OpenAI-producing path ends with one of the two, so content forwarded without either is an upstream drop and now surfaces the in-band 502 error chunk + [DONE] instead of a silent close. TDD: tests/unit/silent-sse-close-openai-10443.test.ts - core case RED before / GREEN after, plus guard cases for finish_reason-only close, [DONE] close, empty-content (#8649 verdict preserved), and literal finish_reason text inside model content (JSON escaping keeps the raw bytes from matching the unescaped-field regex). Signed-off-by: Minxi Hou <houminxi@gmail.com>
27 KiB
27 KiB