fix(parsers): tools are leaking in the reasoning content (deepseek) - #32539
Closed
slivanovich wants to merge 8 commits into
Closed
fix(parsers): tools are leaking in the reasoning content (deepseek)#32539slivanovich wants to merge 8 commits into
slivanovich wants to merge 8 commits into
Conversation
added 2 commits
July 27, 2026 17:20
Signed-off-by: slivanovich <skuralenok@172.24.29.171-spb.dhcp.yndx.net>
Signed-off-by: slivanovich <skuralenok@172.24.29.171-spb.dhcp.yndx.net>
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
added 3 commits
July 27, 2026 17:33
Signed-off-by: slivanovich <skuralenok@172.24.29.171-spb.dhcp.yndx.net>
Signed-off-by: slivanovich <skuralenok@172.24.29.171-spb.dhcp.yndx.net>
Signed-off-by: slivanovich <skuralenok@172.24.29.171-spb.dhcp.yndx.net>
Contributor
Author
|
friendly ping @JustinTong0323 |
5 tasks
5 tasks
Collaborator
|
Covered by #34458 (5899674). The merged version does this by passing the argument rather than introducing a shared base class, but the behaviour this PR reported is fixed. You are credited as a co-author on that commit. If I misread what this PR does and part of it is still missing, please rebase on main and reopen — happy to take it. |
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.
Motivation
DeepSeek V4 can start emitting DSML tool-call markup before closing an open
<think>block. When that happens, the reasoning parser should stop treating subsequent text as reasoning; otherwise DSML tool-call markup may be counted or streamed as reasoning content.This PR makes DeepSeek V4 DSML tool section markers explicit reasoning exit points.
Modifications
Python -
python/sglang/srt/parser/reasoning_parser.pyDeepSeekBaseDetectorfor DeepSeek reasoning parsing behavior with optional tool-start markers.DeepSeekV4Detectorand into the DeepSeek base detector.<|DSML|tool_calls>or<|DSML|invoke name=.Python -
test/registered/unit/parser/test_reasoning_parser.py<think>.</think>taking priority over DSML tool-start text already inside reasoning.Where should the reviewer start?
python/sglang/srt/parser/reasoning_parser.py:901-DeepSeekBaseDetectorwith reasoning parsing and optional tool-start handling.python/sglang/srt/parser/reasoning_parser.py:997-1009- Partial tool-start buffering for streaming deltas.python/sglang/srt/parser/reasoning_parser.py:1025-1052- DeepSeek V4 detector configuration with DSML tool-start markers.test/registered/unit/parser/test_reasoning_parser.py:185-244- DeepSeek V4 DSML reasoning-exit regression tests.Related PRs
Checklist
CI States
Latest PR Test (Base): ❌ Run #31493822238
Latest PR Test (Extra): ❌ Run #31493821942