Q87: provider errors keep status and provider code; text never decides recovery

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-08 14:52:31 -04:00
1 parent 7ecffe84e3
commit 4668396f25
28 files changed
+285 -108

No files matched your search

+5
View File
@@ -65,6 +65,11 @@ export async function* mapOpenAiResponseStream(messages: AsyncIterable<ProviderE
export async function* mapOpenAiChatCompletionStream(messages: AsyncIterable<ProviderEventStreamMessage>): AsyncIterable<ProviderStreamEvent> {
let started = false;
for await (const message of messages) {
// A mid-stream failure (OpenRouter) arrives as an error object; it ends the stream with the provider's own words.
if (message.data.error !== undefined) {
yield streamEvent("error", readErrorText(message.data) ?? "Provider stream failed.", message);
return;
}
const delta = readChatDeltaContent(message.data);
if (delta) {
if (!started) {