fix(server): accept malformed Qwen tool-call variants#552
Open
jkyamog wants to merge 1 commit into
Open
Conversation
jkyamog
force-pushed
the
fix-funcname-tool-call-compat
branch
from
July 21, 2026 12:15
4f7ecb4 to
66c5afa
Compare
Contributor
Author
|
Discovered a few more issues with the parser this is over 100-200M tokens generated in the last few days. 2 of the issues has happened more than 2x. |
Contributor
There was a problem hiding this comment.
All reported issues were addressed
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
jkyamog
force-pushed
the
fix-funcname-tool-call-compat
branch
2 times, most recently
from
July 22, 2026 08:15
647b35c to
1afae9e
Compare
Contributor
Author
|
encountered more parser issues, so I have directed codex add more test cases, after which refactor the parsing instead small patches. |
jkyamog
force-pushed
the
fix-funcname-tool-call-compat
branch
from
July 22, 2026 09:46
1afae9e to
189f167
Compare
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.
Some Qwen agent responses contain recognizable tool calls but vary from the
documented
<function=NAME>XML form. The server previously streamed thesevariants as visible assistant text instead of returning structured
tool_calls.This change adds strict compatibility for three observed forms:
The streaming detector now holds each opener until parsing completes, so tool
syntax does not leak into assistant content.
Streaming and final parsing now share one opener scanner. It recognizes the
fixed compatibility forms plus
<DECLARED_TOOL>for valid request-declaredtool names, avoiding a separate hard-coded streaming list that can drift from
the final parser.
Safety
syntax are rejected rather than partially parsed or guessed.
Reproduction
The newest failure was a two-call response emitted as visible text:
After this change, the preamble remains assistant content and the two blocks
become ordered
readandbashtool calls.