Repository navigation
fix(web): stop marking streamed thinking as complete before </think> arrives (lts/1.17.x) - #45683
Merged
Merged
Conversation
…arrives While a response is streaming, preprocessThinkTag closed the still-open <think> with </think>, which was then rewritten to [ENDTHINKFLAG]. The think block treated the in-flight thought as finished on its first render: the timer froze at 0.0s and the block collapsed while reasoning kept streaming. Balance the trailing block with </details> instead, so the HTML stays well-formed without emitting the end marker. Only the markdown-utils part of the source commit is ported; the rest of it is unrelated to this fix. (cherry picked from commit fd2db63)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## lts/1.17.x #45683 +/- ##
=============================================
Coverage ? 87.74%
=============================================
Files ? 3795
Lines ? 135922
Branches ? 44048
=============================================
Hits ? 119271
Misses ? 16651
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
GareArc
approved these changes
Nov 6, 2026
xhdnoah
approved these changes
Nov 6, 2026
wylswz
approved these changes
Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backport of the
markdown-utils.tspart of fd2db63 (#44165) tolts/1.17.x. Fixes #45682.On
lts/1.17.x,preprocessThinkTagcloses a still-streaming<think>with</think>, which becomes[ENDTHINKFLAG].ThinkBlockthen treats the in-flight thought as finished: the timer freezes at 0.0s and the block collapses while reasoning keeps streaming. This came in with #41764 (first released in 1.17.1).mainfixed it inside the larger #44165, which cannot be cherry-picked as a whole, so this PR ports only that hunk and keeps the provenance line in the commit message:closeUnclosedThinkTagstakes the trailing close tag as a parameter (default unchanged).preprocessThinkTagpasses</details>, so the HTML stays balanced without emitting the end marker. A completed<think>…</think>still produces[ENDTHINKFLAG]as before.main.Screenshots
</think>arrives (covered by unit tests; no new browser screenshot)Validation
vp test run --project unitonmarkdown-utils.spec.ts,think-block.spec.tsx,markdown/index.spec.tsx,streamdown-wrapper.spec.tsx: 4 files, 52 tests passed.markdown-utils.tsand the updated spec, the two think-tag tests fail; with the fix they pass.vp checkon the two changed files: formatting, lint, and types passed..github/scripts/check-hotfix-cherry-picks.shrun locally against this branch: provenance verified.Checklist
make lint && make type-check(backend) andvp staged(frontend) to appease the lint gods