mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1839] [CLOSED] fix(serve): preserve literal closing thinking tags #3711
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#3711
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/1839
Author: @CC-David-CC
Created: 10/10/2026
Status: ❌ Closed
Base:
main← Head:fix/literal-think-output📝 Commits (9)
85ced52serve: a reply that ends inside its thinking with no answer is continued (#1814)68c2d07serve: report a reply that ended inside its thinking, guard or no guard (#1814)549efc6serve: put the tag back into the reasoning before the close, and test it (#1814)d41047cfix(serve): distinguish reasoning marker identity from literal texte603e90fix(serve): route literal thinking tags by token identityfc98b38test(serve): cover literal repair cancellation and budget3d66ab0test(serve): verify literal thinking tags across HTTP APIs471bcd5fix(serve): continue after EOS inside reasoning codeb83016bfix(serve): compose literal guard with end detection📊 Changes
8 files changed (+818 additions, -13 deletions)
View changed files
📝
docs/DETAILS.md(+10 -0)➕
serve/fixtures/literal_think_specimens.json(+30 -0)📝
serve/frontend.py(+32 -6)📝
serve/prometheus.py(+5 -0)📝
serve/server.py(+173 -7)➕
serve/test_literal_think.py(+226 -0)➕
serve/test_literal_think_guard.py(+236 -0)➕
serve/test_literal_think_parser.py(+106 -0)📄 Description
Follow-up to #537 and related to #1814. When ordinary text tokens spell
</think>during reasoning, the parser must keep those bytes as reasoning text; only the tokenizer's dedicated end-of-thinking token should close the block. This change makes parser transitions depend on token identity.The bounded
literal_think_guardhandles dedicated<think>/</think>tokens in answer text or inside reasoning code spans by rendering the tag with ordinary text-token IDs and resuming from the preserved prefix. If end-of-turn arrives inside an unclosed reasoning code span before any answer or tool call, it similarly inserts literal</think>text and resumes. The guard is enabled by default to match #1814 and can be disabled with"literal_think_guard": false. It is capped at 64 repairs per reply, respects client stops, and accounts for inserted tokens against the output budget.Evidence
Validation
regexandjsonschemaavailable: 623 passed, 12 skipped (339.043s).Related but separate work: #1818 covers CPU IQ expert dispatch and draft-grouping independence; #1813 covers speculative/TCP parity; #1773 covers Q8 TCP parity/timings.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.