mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1172] [CLOSED] serve: opt-in recovery of tool calls the model writes next to the template's form ("tool_call_recovery": true) #3284
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#3284
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/1172
Author: @signalnine
Created: 10/6/2026
Status: ❌ Closed
Base:
main← Head:serve-tool-call-recovery📝 Commits (1)
2ef2eabserve: opt-in recovery of tool calls the model writes next to the template's form ("tool_call_recovery": true)📊 Changes
4 files changed (+341 additions, -13 deletions)
View changed files
📝
docs/DETAILS.md(+7 -0)📝
serve/frontend.py(+201 -12)📝
serve/server.py(+6 -1)📝
serve/test_server.py(+127 -0)📄 Description
Replaces #966, which the history rewrite closed. Per your note there, it's opt-in now:
"tool_call_recovery": trueinstrata-<model>.json. Without the key every reply comes back exactly as onmain.With it on, a call of a tool the request declared is the call when the model writes it as:
maintool_call_recovery<tool_call><parameter=NAME>...(the tool's name as a parameter tag)<tool_call>{"name": NAME, "arguments": {...}}</tool_call>(also"parameters", or arguments as a JSON string)<function=NAME>...</function>at the start of a line, no<tool_call>(a stray</tool_call>after it is dropped)<tool_call>(the second may open as<parameter=NAME>)Anything else in those forms comes back as the text it is: an undeclared name, broken JSON, a JSON object that never closes. A bare
<function=only opens a call at the start of a line and outside code. That check uses the parser's own fence/inline-code tracking from #804/#1058, so it follows the same rules as a call inside the reasoning.The last row is the one I'd flag even with the switch off: on
maina batch in one wrapper silently becomes one call with mixed arguments. I kept the fix behind the switch as asked, but it might deserve to be the default on its own.Measured
A corpus of 1,462 agent turns in 176 shapes, captured from Qwen3.8-27B under Claude Code (redacted, from signalnine/q27's drift corpus), each labelled with the calls the model meant, replayed through
OutputParseron v0.1.40:main(v0.1.40)tool_call_recovery: trueStreamed output equals whole output at 1- and 7-character chunks, with and without
stream_tools. The 25 turns still missed are mostly invalid JSON and redaction artifacts. @blange48 ported the earlier version onto v0.1.40 and runs it; this one should drop in the same way.Tests
ToolCallRecovery(serve/test_server.py): every recovered form and every form that must stay text, at steps 1 / 7 / whole withstream_toolson and off. Announced calls' streamed arguments equal their final ones.ToolCallRecoveryOff: without the switch the same inputs give exactly whatmaingives, the batch merge included.ToolCallRecoverySwitch: the config key reaches the parser throughService.run.python -m unittest discover -s serve -p 'test_*.py' -t .: 464 tests OK (452 onmain).docs/DETAILS.md: a paragraph after Streaming.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.