mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1886] [CLOSED] serve: preserve literal </think> across reasoning parsing #3735
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#3735
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/1886
Author: @CC-David-CC
Created: 10/10/2026
Status: ❌ Closed
Base:
main← Head:fix/literal-think-output-combined📝 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
Summary
Builds on the end-of-thinking recovery and captured real-world specimens from #1840, then makes parser transitions depend on the actual special-token identity. This keeps an ordinary
</think>string in reasoning when it is quoted or appears mid-line, including when the model continues reasoning afterward.Reproduction and fix
With #1840's end-of-turn recovery alone, a deterministic token-stream test puts a literal
</think>in ordinary prose and then continues reasoning. The parser switches to answer mode at the string; the remaining reasoning and quoted tag are routed to the answer. A second test emits the special close token inside an unclosed inline-code span and stops. The recovery continuation preserves the backtick boundary, but the close token is exposed as a structural close instead of quoted reasoning text.This branch adds token-aware parser signaling and bounded continuation handling. In the same streams, the full prose and quoted tag stay in reasoning, and the answer remains
42. The original #1840 empty-reasoning / no-answer recovery and its real-turn specimens remain included.Validation
main: 735 tests passed, 12 skipped.git diff --check upstream/main...HEAD: clean.These are deterministic service/parser tests; no live Qwen3.8 / dual-3090 rerun is claimed. The recovery/continuation guard remains opt-in, while token-identity parsing is always used.
Supersedes the standalone draft in #1839 and combines its parser-ambiguity fix with #1840's reproduction and recovery.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.