mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #700] [CLOSED] serve: a <tool_call> named in prose before the real call is content, not a malformed call #2773
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#2773
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/700
Author: @T-Crypt
Created: 10/3/2026
Status: ❌ Closed
Base:
main← Head:fix/tool-call-tag-in-prose📝 Commits (1)
be80d6bserve: a <tool_call> named in prose before the real call is content, not a malformed call📊 Changes
2 files changed (+52 additions, -0 deletions)
View changed files
📝
serve/frontend.py(+17 -0)📝
serve/test_server.py(+35 -0)📄 Description
What
OutputParser.feedtreated every<tool_call>in the content as the start of a call. A reply that names the tag in its prose before making the real call, for exampletook everything after the first tag as the call body, and
parse_tool_callraisedValueError("malformed tool call: ..."), which ended the request.A call is the tag followed (after whitespace) by
<function=, which is howserve/chat_template.jinjawrites it. With this change, a<tool_call>followed by anything else is content. While streaming, the tag is held until its follower arrives (the same way a partial tag is held), so streamed and whole output give the same events. A tag at the very end of the output is flushed as content byfinish(), as before.How it was found
I was porting tolerant tool-call recovery from a Qwen engine (ninfer's
--tolerant-tool-calls) and checked its three recovery cases against Strata's parser:</parameter>/<tool_call><tool_call>named in prose before the real callValueError, request endsOnly the third needed a change.
Tests
ToolCallTagInProseinserve/test_server.py: three prose forms (backticks, bare, two tags),stream_toolson and off, steps 1 / 7 / whole; plus a tag alone at the end of the output.mainthe new class fails (3 failures, 18 errors across subtests); with the change it passes.python -m unittest serve.test_server: 120 tests OK (Linux, Python 3.14).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.