Commit Graph

1 Commits

Author SHA1 Message Date
9b27ee2611 fix(open-sse): treat CommandCode in-stream error events as request failures
Upstream emits AI SDK v5 {"type":"error"} events inside an HTTP 200 stream.
The translator turned them into fake success content ([CommandCode error: ...]
+ finish_reason stop), so account/model fallback never fired and logs showed
Status: success.

- translator: error events now emit an OpenAI-shaped error chunk (chunk.error)
  instead of content; parseSSEToOpenAIResponse already detects chunk?.error
- executor: peek the first events before committing the response; an early
  error event returns 502 so fallback runs before any byte reaches the client
2026-08-04 23:26:37 +07:00