Commit Graph
1 Commits
Author SHA1 Message Date
lukaszraczyloandGitHub c89df4bc6a fix(openai): treat a stream cut before its finish as an upstream failure (#20)
An OpenAI-compatible stream that ended with neither a finish_reason nor
[DONE] counted as a finished answer. When the d1 model server died
mid-reply, the gateway sent the client an empty stream with no
finish_reason, and the smart router did not try its next tier.

forwardStream now returns errStreamTruncated for such a stream, wrapped
in errUpstream. Before any output reaches the client, the request fails
over or escalates to the next tier. After output, the client gets an
error event and no [DONE]. A stream with [DONE] but no finish_reason
keeps its old behaviour.
2026-11-27 11:55:52 +00:00