Skip to content

fix: break streaming loops on completion and prevent duplicate thinking blocks#27

Merged
Mng-dev-ai merged 1 commit intomainfrom
fix/streaming-loop-and-duplicate-thinking
Jan 28, 2026
Merged

fix: break streaming loops on completion and prevent duplicate thinking blocks#27
Mng-dev-ai merged 1 commit intomainfrom
fix/streaming-loop-and-duplicate-thinking

Conversation

@Mng-dev-ai
Copy link
Owner

@Mng-dev-ai Mng-dev-ai commented Jan 28, 2026

  • OpenRouter: Change continue to break when [DONE] is received to exit the streaming loop immediately instead of waiting for timeout
  • OpenAI: Add break after response.completed event to exit the loop

@Mng-dev-ai Mng-dev-ai force-pushed the fix/streaming-loop-and-duplicate-thinking branch from 9eebe71 to ebdce0e Compare January 28, 2026 02:59
…ng blocks

- OpenRouter: Change `continue` to `break` when `[DONE]` is received to exit
  the streaming loop immediately instead of waiting for timeout
- OpenAI: Add `break` after `response.completed` event to exit the loop
- Both: Add `thinking_block_emitted` flag to prevent duplicate thinking blocks
  when reasoning content arrives after the thinking block was closed
@Mng-dev-ai Mng-dev-ai force-pushed the fix/streaming-loop-and-duplicate-thinking branch from ebdce0e to c328e4d Compare January 28, 2026 03:02
@Mng-dev-ai Mng-dev-ai merged commit 7103887 into main Jan 28, 2026
1 check passed
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