fix(openai): gracefully handle stream endings

- The Responses API ends streams without a final '[DONE]' message.
- This causes reqwest_eventsource to return Error::StreamEnded.
- Previously, this was treated as a premature termination, triggering an error probe.
- We now explicitly match and break on Err(StreamEnded) for normal completion.
This commit is contained in:
2026-03-18 15:39:18 +00:00
parent 7c2a317c01
commit 24a898c9a7

View File

@@ -524,6 +524,7 @@ impl super::Provider for OpenAIProvider {
}
}
Ok(_) => continue,
Err(reqwest_eventsource::Error::StreamEnded) => break,
Err(e) => {
// Attempt to probe for the actual error body
let probe_resp = probe_client
@@ -887,6 +888,7 @@ impl super::Provider for OpenAIProvider {
}
}
Ok(_) => continue,
Err(reqwest_eventsource::Error::StreamEnded) => break,
Err(e) => {
// Attempt to probe for the actual error body
let probe_resp = probe_client