Skip to content

Fix thinking block finalization on stream errors and restarts#1078

Merged
Hmbown merged 1 commit intoHmbown:mainfrom
reidliu41:fix/thinking-collapse-rc1-rc2
May 7, 2026
Merged

Fix thinking block finalization on stream errors and restarts#1078
Hmbown merged 1 commit intoHmbown:mainfrom
reidliu41:fix/thinking-collapse-rc1-rc2

Conversation

@reidliu41
Copy link
Copy Markdown
Contributor

Summary

Fixes RC1 and RC2 from #861.

RC1: engine error cleanup reset the streaming state without finalizing the active thinking entry first. That could
leave the visible thinking block stuck in streaming state.

RC2: a new ThinkingStarted event reset StreamingState even if the previous thinking block still had pending
buffered text. That could silently drop the tail of the previous thinking content.

This change finalizes the active thinking block before stream resets, both on engine errors and when a new
thinking block starts.

Testing

  • cargo test --all-features
  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features

Checklist

  • Updated docs or comments as needed
  • Added or updated tests where relevant
  • Verified TUI behavior manually if UI changes

  Finalize active thinking blocks before resetting stream state.

  This prevents engine errors from leaving thinking entries stuck in streaming
  state, and preserves pending thinking text when a new thinking block starts.
  Adds regression coverage for both paths.
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@Hmbown Hmbown merged commit 3433145 into Hmbown:main May 7, 2026
8 checks 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.

2 participants