Skip to content

Conversation

@alanost
Copy link

@alanost alanost commented Feb 6, 2026

When streaming models that emit thinking tokens (e.g. qwen/qwen3-8b via OpenRouter), transition chunks contain an empty reasoning field alongside the start of the actual content.

hasReasoningDelta() uses isset(), which returns true for empty strings. The unconditional continue on line 187 then skips content extraction for these chunks, truncating the first characters of the response.

Fix: Move continue inside the $reasoningDelta !== '' check so that chunks with empty reasoning fall through to content processing.

…ransition

When streaming models that emit thinking tokens (e.g. qwen/qwen3-8b),
OpenRouter sends transition chunks where the `reasoning` field is an
empty string and `content` contains the start of the actual response.

Because `hasReasoningDelta()` checks for field existence via `isset()`,
these chunks match even when reasoning is empty. The unconditional
`continue` then skips the content extraction, truncating the first
characters of the response.

Move `continue` inside the `$reasoningDelta !== ''` check so that
chunks with empty reasoning fall through to content processing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant