fix(server): Parse Bare Tool-Name XML Calls#525
Merged
Conversation
Contributor
Author
|
I encountered this issue twice on long running Pi agent session, so I decided to fix this as it occurs frequent enough. It was using Qwen 3.6 27B Q4 model. I have then run the fix with 10M-20M more tokens and so far no tool call issues. |
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
59054e6 to
3ac6efd
Compare
Contributor
|
Thanks for the fix @jkyamog 🚀 |
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.
Adds a narrow compatibility case for model output that uses the tool name as
the XML tag itself:
Before this change, the C++ server did not parse this as a tool call. The raw
XML stayed in visible assistant text and the turn finished as normal text
instead of
tool_calls/tool_use.Bug
Observed through a Pi agent session using Lucebox as the model runtime.
The session record showed reasoning was already correctly separated:
{ "type": "thinking", "thinkingSignature": "reasoning_content" }But the malformed tool call was left in the visible text content:
The agent therefore displayed the tool XML as assistant text and did not run
the tool.
Change
Adds parser support for bare tool-name XML:
Also accepts a matching generic XML close:
</TOOL_NAME>Keeps the behavior constrained:
toolsare present<parameter=...>tagThis avoids turning arbitrary XML-ish prose into tool calls.
Review follow-up:
</TOOL_NAME>)rather than "any XML close" so the regex cannot stop early on inner tags like
</parameter>.</function>is fully stripped from visible content.