Repository navigation
fix: prevent duplicated post-think text - #15651
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe pull request updates the streaming text processor to correctly track position when ChangesThink tag processing
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15651 +/- ##
==========================================
- Coverage 94.56% 93.16% -1.40%
==========================================
Files 10 10
Lines 717 717
Branches 118 118
==========================================
- Hits 678 668 -10
- Misses 25 29 +4
- Partials 14 20 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
chat-internals port (route-independent; fork keeps /chats contract + parallel gather + cache + infiniflow#12689). Replaced fork's think-stream helper block (_ThinkStreamState / _next_think_delta / _stream_with_think_delta) with upstream v0.26's final version, which folds in: - infiniflow#15745 refine think stream parsing (big refactor; min_tokens 1->16) - infiniflow#15891 remove think text buffering (real-time reasoning) - infiniflow#15651 prevent duplicated post-think text - infiniflow#15582 think stream tail handling - infiniflow#14271 normalize think tags in final answer (adds _extract_visible_answer; removes _next_think_delta) Plus applied infiniflow#14271's 2 consumer wraps: async_chat + async_ask now call decorate_answer(_extract_visible_answer(...)). SKIPPED infiniflow#13917 (remove final["answer"]=""): conflicts with fork's deliberate answer-clearing — async_chat explicitly caches the full answer then blanks it for the streaming client ('preserve full answer for caching before clearing'). Touching it risks fork's cache/stream contract. Verified: call convention unchanged (3 consumers); _next_think_delta fully removed (0 refs); _extract_visible_answer logic correct (5 cases); fork customs intact (parallel gather x8, cache x5); py_compile. Live SSE smoke -> batch F.
What problem does this PR solve?
This fixes duplicated post-think text in streamed chat responses. When the model emits text immediately after
</think>, the stream state now advances its cursor correctly so the same visible prefix is not emitted twice.Type of change