mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
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#2924
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/939
Author: @brxperience
Created: 10/5/2026
Status: ❌ Closed
Base:
main← Head:fix/tool-call-inside-thinking📝 Commits (1)
469bed9serve: a tool call written inside an unclosed thinking span is an implicit think end (#804)📊 Changes
3 files changed (+163 additions, -1 deletions)
View changed files
📝
serve/frontend.py(+64 -1)📝
serve/server.py(+3 -0)📝
serve/test_server.py(+96 -0)📄 Description
Problem
Qwen3-family models sometimes go straight from their reasoning to a tool call without ever emitting
</think>.OutputParseronly leaves thereasoningstate on</think>, so the whole call is channeled out asreasoning_content: the client sees notool_calls,finish_reason: "stop", and its agent loop stops silently with nothing to run. Reported live in #804 (Qwen3.8-Flash-Next, GSQ-RCO IQ3_S; ~4 of 1050 responses in agent use).Fix
A
<tool_call>that ends an unclosed thinking span is an implicit end of thinking, with a strict trigger so quoted markup stays reasoning. In thereasoningstate, it must be:<function=that opens a real call body.The text before it stays
reasoning_content, and the call goes through the normalcallstate, so it is extracted in streaming (stream_tools) and non-streaming paths alike. A candidate whose follower has not arrived is held, so streamed and whole outputs are identical. This follows the proposal in #804 (and vLLM PR #35687's idea, with the stricter trigger).self.bufkeeps its original trimming - the reasoning budget inserver.pyrelies onnot parser.buf- and the reasoning span is tracked separately inself.rseen.Each implicit end is logged:
[strata] implicit end of thinking: N tool call(s) ....Tests
New
ToolCallInsideThinkinginserve/test_server.py:stream_toolson and off: exactly 1 call, the reasoning kept;</think>before the opener is unchanged;</think>);finish_reason: "tool_calls"and the arguments.python -m unittest serve.test_server: 144 tests OK (Python 3.13;jsonschemaand the pack tokenizer absent).Note
The chat template also renders a stranded call from the history in the #804 proposal, but the server loads the template from the pack (
<pack>/tokenizer/chat_template.jinja), notserve/, so that half needs the pack side and is left out here.Fixes #804.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.