mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #5105] Tool calls cut by an end-of-turn token render as "Not run" and execute nothing #2384
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#2384
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 @Freedominmyheart on GitHub (Nov 3, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5105
Tool calls cut by an end-of-turn token render as "Not run" and execute nothing
(HTTP 200,
finish_reason: "stop", no log line)Environment
BUILD.json, built locally for gfx1151 / ROCm 7.14)qwen3.8-flash-next-unsloth-ud-iq4_xsserve/web),stream: true, 6 MCP servers / 49 namespaced toolsWhat the user sees
Mid tool-use, a round produces a tool card whose arguments never fill in (the argument area stays at
"(being written)") and whose status ends as Not run. The tool never executes, the assistant's visible text
is empty, and the turn is over — the user has to re-send. Nothing about the response looks like a failure:
HTTP 200,
finish_reason: "stop", noerrorchunk, and the journal for that round ends atdone: 625 tokens in 25 s (stop, cancel=False).This is hard to tell apart from an MCP/bash fault from the outside; an actual MCP-side failure does log
tool <name>: error, …, and this one logs nothing at all, because the tool is never reached.Where it happens
The turn ends because the model emits an end-of-turn token while still inside a tool call, and the generation
loop stops on it:
OutputParser.finish()then refuses to emit the half-written call, and says so in its own docstring: analready-announced call "stays unfinished: its JSON is not closed and no
tool_callfollows it, #211". So notool_callevent exists, and the server's tool-execution entry points (ev.kind == "tool_call") are neverreached — MCP is not involved anywhere in this path.
Meanwhile the request runs with
stream_tools=True, sotool_startwas already sent the moment the tool namewas decoded. The web app is left holding a card in
writing, which it sweeps at stream end:That sweep is the "Not run". To be clear: I think refusing to execute a call with truncated arguments is
correct — running half a command is worse. My complaint is that the resulting turn is silently dead: the
client cannot distinguish "the model decided to stop" from "the harness lost a call", and there is no log line
or counter to measure it. Some truncated shapes are recovered natively (the
tool_args_repaired/function_donestreaming path — I verified that a call cut after a complete</function>still lands as anormal
tool_calls); what reaches "Not run" are the shapes that path cannot close.What I have and have not verified
Verified: the
finish_reason/ event behaviour above; that the cut is not a stop-word and not the client'sreading loop (raw SSE replays arrive complete); and that
reasoning_close_retry(#1053) fires on this model —the reply ended inside its thinkingappeared twice in ~1 h of normal use and those rounds continued correctly.Not verified, and I'd rather flag it than assert it:
parser.stateat the cut for a real "Not run" (callvsrcall). The journal doesn't record it, so thetrigger condition in fix 1 below is inference from the
finish()docstring, not an observation.successful call round also reads
writing a tool call— so I have no trustworthy rate, which is itself partof the problem.
Possible fixes
trigger. When the loop ends with
finish == "stop",parser.stateis a call state, nothing visible has beenstreamed yet, and no retry has happened: strip the half-call out of
prompt + seg, log it once, continue.Prefix-cache reuse should make this cheap. The "nothing visible sent yet" guard matters — retrying after
content was streamed would repeat text on the wire.
strata_truncated_tool_callsalongsidestrata_rejected_tool_calls, plus a/metricscounter. Even if you decide a retry is wrong, this makes theevent measurable and lets a client label the round differently than a user cancellation.
symptom is an absent
toolline, which took me a long time to even attribute to this code path.One data point against the obvious fix: I tried continuing from the half-call as an assistant prefix — 6/6
times the model narrated a finished command ("the command ran, output:
CONT_OK") instead of closing the call,because in the history the command looks already executed. So a retry has to be without the cut call (fix 1),
not after it.
Workaround we're running:
"reasoning_close_retry": trueremoves the sibling case (EOS insidethink).The tool-call case falls outside that branch's conditions, so it remains.
Happy to test patches or a counter build against this model — the round volume here makes it easy to spot.
@github-actions[bot] commented on GitHub (Nov 3, 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