mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #5110] [engine 0.1.55]. Replies ending on the stop token in three positions #2388
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#2388
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/5110
Replies ending on the stop token in three positions: two healable, one silent
Environment: strata 0.2.9 / engine 0.1.55 (built locally, gfx1151, ROCm 7.14), model
qwen3.8-flash-next-unsloth-ud-iq4_xs, client = bundled web app (serve/web),stream: true,6 MCP servers / 49 namespaced tools.
Summary
Across ~4 h of ordinary agent use (a long session, thinking on, tool use heavy), replies keep
ending on the end-of-turn token early. The token arrives in one of three positions and each has a
different observable:
thinkreasoning_close_retry: true(#1053)All three report
finish_reason: "stop"andcancel=False, which is the common defect: nothing inthe response distinguishes "the model finished" from "the model stopped early", and cases 2 and 3
produce no log line at all.
The number I'd most like the maintainers to look at: the #1053 recovery fired twice in ~1 hour
of normal use (
the reply ended inside its thinking with no answer). A healthy model should not beEOS-ing inside its own reasoning twice an hour. So I suspect the root cause is below the HTTP layer
— model/numerics/sampling — and the three symptoms above are just where that lands.
Case 1 — EOS inside the thinking (confirmed, and it has a fix)
Journal, twice (20:26:22, 20:27:04 in one session):
…followed by a correct tool call / answer in the same round. Two things this proves: the behaviour is
real on this model, and
reasoning_close_retryworks as documented. Before enabling it the samerounds simply returned the reasoning text with an empty answer.
Case 2 — EOS inside a tool call ("Not run")
Chain, as far as I can read it:
if t in self.stop_ids: … finish = "stop"; raw_ids.append(t); breakOutputParser.finish()declines to emit the half-written call — its docstring: an alreadyannounced call "stays unfinished: its JSON is not closed and no
tool_callfollows it, #211"tool_callevent exists → the tool-execution entry points (ev.kind == "tool_call") arenever reached → MCP is not involved anywhere in this path (a real MCP-side failure logs
tool <name>: error, …; this logs nothing, which is how I finally separated them)stream_tools=True, sotool_startwas already sent when the name wasdecoded — the client is left holding a card it then sweeps:
for (const t of m.tools || []) if (t.state === "writing" || …) { t.state = "skipped"; … }Refusing to execute truncated arguments is right; my objection is that the turn is silently dead and
unmeasurable.
Note: some truncated shapes are recovered. In a harness test a call cut after a complete
</function>still arrived as a normaltool_calls(the nativefunction_done/tool_args_repairedpath), so what reaches "Not run" is what that path can't close.Case 3 — EOS inside answer content
The answer just ends mid-sentence. The user's observation, repeatedly: it stops right after an
inline code span. I tested the obvious theory (a stop word) and it is wrong — see below. I am
reporting the pattern, not a cause.
Analysis process (mostly things I ruled out)
stopparameter — refuted. Direct SSE request whose text contained backticks,thinking on and off: full text arrived,
finish_reason: stop. Alsostop_strings()only applieswhen the client sends
stop; our config sends none, andStopMatcheris not in play.OutputParserwithholding text around backticks — refuted by unit test: text with paired andunpaired backticks, chunked at 5 chars,
thinkingboth ways → zero loss,bufempty atfinish().break, and raw SSE replay in the same browserarrives complete.
My node harness measured the wrong object; the real
codeBlock()renders an unterminated blocknormally. Worth naming because it is a tempting false positive.
tunnel). One user, one browser page.
done: N tokens in T s (stop, cancel=False), no exception, nocancel=True.localStorage, and once thechat passes the ~5 MB quota
setItemthrows and the page swallows it — so after a reload therestored history is the last version that fitted. That looks exactly like a truncated answer.
Fixed locally (try progressively smaller shapes, then say so), but flagging it because it will
bite anyone with a long chat and it muddies exactly this investigation.
Hypotheses for the early EOS, with a knob each
Ordered by how cheap they are to falsify. All untested.
usageblocks report real draft activity(
predicted_n: 136, draft_n: 114, draft_n_accepted: 96). If a draft can be accepted across aposition where the target would not have emitted EOS, early termination is exactly the symptom.
Knob: disable speculative decoding and re-run the same session.
HC_Q8(8-bit hyper-connectionprojections used on the verify read) is on by default for gfx1151, plus "19 exact speed
switches on by default", and states output is no longer bit-identical. If EOS logits shift
slightly under verify-path quantisation, an early stop is a plausible first-order effect, and it
would explain why this is much more visible here than in CI. Knob:
STRATA_HC_Q8=0, andSTRATA_GFX1151_DEFAULTS=0as a bisect.concentrate in the structured regions (inside
think, inside<tool_call>), which is where thetemplate's grammar decides "this turn is over". Knob: replay one failing prompt through the
template with a different model card, or dump the logits at the cut position.
then this is a model-quality report, not a server one.
The deliberate probe I could run — 12 completions forced to emit four inline code spans each — ended
at a backtick 1/12 times. So inline code is a correlate, not a cause; anyone writing "backticks
stop the model" will chase nothing.
What I'd like
finish == "stop"and the parser isin a call state and nothing visible has been streamed yet, drop the half-call out of
prompt + segand write the turn once. The "nothing visible yet" guard is what keeps it fromrepeating text on the wire. Prefix-cache reuse should make it cheap.
(I tried the obvious alternative — continue from the half-call as an assistant prefix — 6/6
times the model narrated "the command ran, output:
CONT_OK" instead of closing the call,because in the history the command already looks executed. So it has to be without the cut call.)
strata_truncated_tool_callsnext tostrata_rejected_tool_calls, and a/metricscounter. Case 3's only current symptom is anabsent log line, which is why this took so long to attribute.
finish_reason(or a flag) so a client can render"incomplete" instead of "the model had a short answer". I know nothing general can tell "finished"
from "cut" mid-content — that's why I'm asking for signal, not for a heal.
Honest limits of this report
Verified: case 1 (server's own log line, twice); that case 2 bypasses MCP entirely; that #1053 works;
the ruled-out list above. Not verified: the
parser.stateat a real case-2 cut (no log fieldrecords it), any trustworthy frequency for cases 2–3 (every journal-side counting method I tried is
biased — the last progress line of a successful call round also reads
writing a tool call), andany of the four hypotheses.
Happy to run a bisect on 1 and 2 — with this session length, a difference shows up within an hour.
@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