From 55b6000374f59d437bbc295028c4917ae49a997b Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Mon, 23 Feb 2026 09:12:40 -0500 Subject: [PATCH] Fix OpenAI streaming returning no output for reasoning models The SSE stream terminated prematurely when a network chunk contained only unhandled event types (e.g. response.in_progress, reasoning output_item.added). dispatch_sse_messages returned an empty vec, which the unfold interpreted as stream-end. Now continues reading when dispatch produces no StreamEvents. Co-Authored-By: Claude Opus 4.6 --- crates/unified-llm/src/providers/openai.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/unified-llm/src/providers/openai.rs b/crates/unified-llm/src/providers/openai.rs index 0340e151e..75f74c02d 100644 --- a/crates/unified-llm/src/providers/openai.rs +++ b/crates/unified-llm/src/providers/openai.rs @@ -527,7 +527,12 @@ async fn process_next_sse_events( loop { let messages = extract_sse_messages(&mut state.buffer); if !messages.is_empty() { - return Ok(dispatch_sse_messages(state, messages)); + let events = dispatch_sse_messages(state, messages); + if !events.is_empty() { + return Ok(events); + } + // All SSE messages were unhandled event types; continue reading. + continue; } match tokio::time::timeout(state.stream_read_timeout, state.byte_stream.next()).await {