mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #4078] [Engine] Tool-call markup inside a parameter value is cut silently: the tool runs with truncated arguments #1774
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#1774
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?
Originally created by @ackalker on GitHub (Oct 25, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4078
Area
[Engine] (speed, kernels, models, the server and API)
Engine (
serve/), run from source:serve/server.pystarted aspython serve/server.py --engine strata --config strata-iq3_s.json.Desktop app, Terminal or source?
Source (START-HERE.bat, setup.sh or a build)
Reproduction status
Reproduced locally - deterministic at parser level, no model, no GPU and no
network needed (the script feeds
serve.frontend.OutputParserin 7-character deltas, like a realserver feed). It is not replayed end to end against a live server in this report.
What happened
When a model puts tool-call markup inside a tool argument - which is ordinary content for an agent
that edits a chat template, writes a parser test fixture, or quotes an earlier turn of its own
transcript - the call is still delivered, but its arguments are cut. There is no error, no
unreadcount and no log line, so the client runs the tool with the shortened value and reportssuccess. A
writeoreditcall can therefore save a truncated file with nothing left to trace.Two shapes, both observed against
serve/frontend.py:appears (the closing tag is grammar-valid there,
param_end/call_end,serve/frontend.py:712and:727), and everything the model still intended is emitted asordinary assistant content afterwards. The delivered
tool_callcarries the head of the valueonly.
parser.unreadstays0;parser.unread_namesstays empty.value: the head of the argument is dropped completely, again with
unread == 0.In the real case that triggered this report the argument was a shell heredoc
(
python3 - <<'PY' … PY) whose body contained a quoted tool-call block; the delivered command wascut in the middle of the heredoc and the remainder came back as the answer text.
tool_call_recovery: truedoes not change either shape (case 4b of the attached script).Expected
A nested opener or closer that appears inside a parameter value should be text, the way #210 made
the closing-tag case behave via
param_end/call_end("a value may contain either tag",serve/frontend.py:729); the opener rules that currently decide are_ok_at/_opener_ok(
serve/frontend.py:957,:1084, the #1058 fence rules at:1396-1397).If keeping the current termination is deliberate, then at minimum count it: an
unread-stylecounter plus the
[strata] …line the server already prints for the #3441 case(
serve/server.py:5599-5603), so "my tool ran on half the text" is diagnosable at all. There is noescaping anywhere in
serve/chat_template.jinja(grep -c escapereturns 0), so today there is noway for a client to pass file content containing that markup through a parameter at all.
Smallest steps or command that reproduce it
repro.py(attached below) runs every case against a checkout; from the repository root:Cases 4 and 4b are this problem. The script prints, for each case, the delivered calls with their
arguments, the answer text, the reasoning text, and
unread/rescued/refused. In the scriptthe markup strings are built at runtime from
chr(60)/chr(62); they are never written literallyin the file, so reading the script cannot inject markup into anyone's session or editor buffer.
Case 4 (one parameter with a nested block in its value): the call is delivered as
bashwithcommandcut after the nested closing tag, the rest of the model's text comes back ascontent, and the counters readunread=0 rescued=0 refused=0.Case 4b is the same input with
recover=True: identical output.In prose (the tags are written as
«tool_call»,«/parameter»and so on here;repro.pyprintsthe real strings): the intended command was
and what the client receives is a
bashcall whosecommandstops at the nested«/parameter».Strata version
v0.2.4.2-6-g7dd5cf18(source checkout,git describe), engine 0.1.49.1.Re-verified against
mainas fetched on 2026-10-25 (fa663fab, 136 commits newer):git diff 7dd5cf18 fa663fab -- serve/is empty, i.e. nothing underserve/changed in between, and thescript reproduces identically there.
Graphics card, memory and system
RTX 5080 16 GB · 60 GB RAM · Linux (CachyOS, kernel 7.3.0-5), Python 3.13. The reproduction itself
needs no GPU, no model file and no server.
Model, size and settings
Where it was first seen: Qwen3.8-Flash-Next GGUF, IQ3_S and IQ3_XXS, 131072 context, reached through
llama-swap from an agent client (Pi) with
tool_call_recoveryon.Logs
Nothing at all is logged for this case, which is part of the report. Compare #3441's path: when a
call block is returned as text,
serve/server.py:5599-5603prints a[strata] …line with thenames involved. Here the block is read as a call, so no counter moves and the server says nothing.
Related issues
the nested-opener side, and it survives that fix.
call already, so the fence rule does not apply.
runs with cut arguments, which is the dangerous difference.
Attached: repro.py (self-contained; the markup strings are built at runtime, never literal in the file)
@github-actions[bot] commented on GitHub (Oct 25, 2026):
Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:
Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment
/reopen.Details: CONTRIBUTING.md
@Tsury commented on GitHub (Oct 25, 2026):
Reproduced on hardware and proposed a fix in #4132.
RTX 5090 Laptop GPU, Qwen3.8 Flash-Next IQ3_S, a downstream v0.2.4.1 build (engine 0.1.49.1). The model was asked to copy a literal value into one tool call. Chat, Chat streaming and streaming Responses all lost bytes when the value quoted a whole tool call, repeated
</parameter>+<parameter=content>, or was a heredoc that prints a quoted call. Replaying the raw model output through the parser showed that the model copied correctly and the parser cut the value.With the #4132 change on a v0.2.6 build, those cases came back exact on all three routes (one model copy slip on a streamed heredoc at T=1.0). A bare
</parameter>or</function>inside a value was already exact before and stays exact.#4132 does not cover #4077 (a bare-line closing think tag ends reasoning early); that case still gave no tool call here.
@LispEngineer commented on GitHub (Oct 27, 2026):
Confirmed locally on released v0.2.7, commit
5e8a4cca7d690ac60ca37eb09e7d0e010099ad6d(engine 0.1.52). The same probe also reproduces on v0.2.3, commit5c8dd322528cc84f68f461ad54a506b9da8fa8d4.This is an independent parser-level reproduction, using Linux/Python 3.14.8, with
OutputParser(stream_tools=True, recover=True). No model, GPU request, live HTTP server or tool execution is involved. Both source trees have no tracked modifications.For each value, the input is fed in chunks of 1 character, 7 characters, and the entire call:
In all six failing checks per version, a tool call is emitted and
unreadremains 0. The nested-call case loses the tail of the intended value; the reopened-parameter case loses the first part. The expected result is onewrite_filecall whosepathandcontentexactly match the supplied strings.Here is the small probe used for this confirmation. Save it outside the checkout as
/tmp/strata-parser-repro.py, then run from the Strata checkout using its Python environment:It prints the actual arguments for every case and exits 1 when any argument differs (the observed result on both versions).
Standalone parser probe
This adds released-v0.2.7 confirmation to the existing report. I have not tested the #4132 branch, so this is not validation of that proposed fix, nor a claim that the defect was newly introduced in 0.2.7.
Prepared with Codex for Douglas P. Fields, Jr.
@github-actions[bot] commented on GitHub (Oct 28, 2026):
Thanks, this follows the format now.
@ackalker commented on GitHub (Oct 28, 2026):
Independent parser-level confirmation on the current release, and what PR #4132 does against the same probe. Everything below is my own run; no model, no GPU, no live server and no tool was executed.
Revision and environment.
mainat5e8a4cca(v0.2.7, engine 0.1.52), checkout with no local modifications. Linux (CachyOS, kernel 7.3.0-5), Python 3.14.8, 60 GB RAM. Tags below are written as«tool_call»,«/parameter»and so on; the attached script builds them at runtime fromchr(60)/chr(62)and never contains them literally.Passed - the defect reproduces on released v0.2.7. Both shapes from the report come back with the wrong argument, at chunk sizes 1, 7 and the whole call, with
tool_call_recoveryoff and on:«tool_call» … «/tool_call»block (a heredoc that prints one);«/parameter»and then reopens«parameter=command»with the same name.Expected: one call whose argument equals the input byte for byte. Got: the value cut (tail lost in the first shape, head lost in the second), and
parser.unreadstays0in every case: four combinations (two shapes, recovery off and on) at three chunk sizes, twelve runs, all wrong.Nothing in
serve/touched value termination since the report:serve/frontend.pychanged infa663fab..5e8a4ccaonly infd8d37e9(#3972 namespaced tool spellings),11237f83(#3395 tool-result order) and805ebe17(#3796 undeclared-name wording and the collapsedmcp__a__balias). So the report'sgit diff 7dd5cf18 fa663fab -- serve/finding still holds in effect.Passed - PR #4132 fixes this issue.
git fetch origin pull/4132/head(831bb12b), same probe, same environment: the argument is exact in both shapes at all three chunk sizes, with recovery off and on. The two rules in that PR are enough for what this issue reports.Not run. No model and no GPU, so no end-to-end server confirmation from me (another reporter has that on an RTX 5090). No CUDA, HIP, SYCL or Metal build - the change touches only
serve/frontend.py. Windows not tested.On PR #4132's red CI. Its run fails on one test only,
serve/test_responses.pyNoLeakedSampler.test_server_close_ends_the_sampler, which the author lists under Failed as timing-dependent; the same runner log also showsggml_vulkan: ErrorDeviceLostand engineverify: timed out at layer 18. Nothing in that failure points at this patch.Probe, saved outside the checkout and run as
python3 -B /tmp/strata-parser-probe.pyfrom the repository root:parser probe
Example of the failing output on
5e8a4cca:and on PR #4132:
@Niko1221 commented on GitHub (Oct 29, 2026):
Thank you for the probes. Fixed on our side; the fix ships in the next update (0.2.8). The fix is Tsury's change from #4132, taken as written (both commits, author kept): a value that holds a whole quoted call, or repeats
</parameter>and<parameter=content>, now comes back byte for byte, whole and streamed, at any chunk size. Both shapes are in the corpus test.@ackalker commented on GitHub (Oct 29, 2026):
Thank you all very much for looking into this. I'm looking forward to the fix.
@Niko1221 commented on GitHub (Oct 29, 2026):
Fixed in 0.2.8 with Tsury's change from #4132 (both commits, author kept): a value that holds a whole quoted call, or repeats
</parameter>, now comes back byte for byte, whole and streamed. Runstrata update. Closing.