PR #573 case file — helios: tolerate omitted closing tags on complete tagged tool calls at EOS
Author: lukealonso (COLLABORATOR; one of three "priority contributors" named in the charter) · open, ready for review, 2026-11-28, head 09cc524, base main · 9 files, +1423 / −70 · no reviews, no comments, no labels, CI on head passed.
Key findings
- No linked issue, no captured model output, no reproduction. The description cites no issue or PR at all and offers no log, no request capture, no frequency figure for any of the five dialects it changes. The only prior tracker statement of the problem is the competing PR #514 (2026-11-25), which makes the same GLM claim with the same absence of evidence. Searches for a user-facing report of "unclosed tagged tool call at EOS" found none.
- The behaviour it removes was deliberate, documented, and pinned by the same author. Issue #133 records that the error-at-EOS / drop-at-limit asymmetry "was introduced deliberately in
99cfcd5be, pinned by the testoutput_limits_allow_incomplete_tools_but_eos_rejects_themin03074c11, and restated in #67", and concludes that changing it "is a maintainer policy decision that would editdocs/api.md, not a defect fix". Both commits are by lukealonso. This PR is exactly that policy revision — which makes it an intentional change of contract rather than a regression fix, and the reviewer question is "is this the right shape and scope", not "is this a bug". - An open competitor already occupies the same two files with the opposite design. #514 (jannerchang, +61/−0) does the GLM half with a per-model
LENIENT_EOS_CLOSEboolean and was halted by flare-autobot with "It is low value or does not align with the project charter". #573 is the superset, explicitly rejects flags, and does not mention #514 anywhere — no "supersedes", no cross-link. Merging #573 closes #514 as redundant. - Scope is wider than "at EOS". Two things change outside natural end-of-sequence: (a)
FunctionTags::parse_candidateandMiniMaxXml::parse_candidatereceive the lenient flag unconditionally, so a call missing</function>/</invoke>but closed by</tool_call>is accepted mid-stream too — disclosed parenthetically in the description and indocs/api.md, but it is not an EOS-only widening; (b)outer_tool_pendingbecomes conditional on which closer ended the call (tagged.rs:593-596), altering how a following tail tag is consumed on the ordinary streaming path for Qwen/MiMo/MiniMax. Neither the (b) change nor its blast radius is called out in the description. - Evidence is in-repo tests only, and they are substantial. Roughly 1,230 of the added lines are tests across the five parsers,
server/protocol/tests.rsandserver/logprobs.rs, including every UTF-8 split boundary, all four non-EOS terminations, and the undecided-prefix anti-fabrication cases. Nothing was run against a served model; the description says so under "Unrun checks / limitations" (checkpoint-gated tests and live GPU serving not executed). The "203 passed" figure is plausible but not reproducible from the description (no CI log, no per-binary breakdown). - No opt-out and no new signal. There is no flag, env var, or config for the new leniency, so an operator who relied on the EOS error to notice malformed generations loses that signal for the accepted shapes, and no metric or log line replaces it.
The change
Plain terms: tagged tool parsers buffer a call until its tags close. Previously, if generation ended with an end-of-sequence token while a call was still buffered, the whole request errored with incomplete <dialect> tool call (tagged.rs:317-319 on main). Some models consistently omit the last wrapper tag after a complete argument body. #573 lets those calls through when the opener was genuinely confirmed, the argument body is structurally complete and self-delimited with no trailing non-whitespace, and the target tool is not strict: true.
Files (pr_files): docs/api.md +17/−1; helios/src/output/argument_tags.rs +280/−10; chatml.rs +206/−6; gemma_call.rs +130/−10; minimax_xml.rs +167/−15; pipeline.rs +108/−0; tagged.rs +66/−28; helios/src/server/logprobs.rs +101/−0; helios/src/server/protocol/tests.rs +348/−0.
Mechanism, verified at head 09cc524:
- New required
ToolDialect::parse_eos(body, tools)with no default (tagged.rs:43-45), implemented by all five in-crate dialects (argument_tags.rs:109,chatml.rs:30,gemma_call.rs:147,minimax_xml.rs:203,pipeline.rs:49). There are exactly these fiveToolDialectimpls in the tree; DeepSeek DSML/XTML, TML, and the recipient parser are separate state machines and are untouched (dsml.rs:379-381still errors;xtml.rs:576-596still pins EOS = error). TaggedToolsgainsconfirmedandouter_closed.finish(tagged.rs:302-322) short-circuits all non-EOS causes first (Cancelled | ExecutionError | UserStop | OutputLimitclear the buffer and return empty — unchanged from main), then errors if!self.confirmed || in_json_string, then delegates toD::parse_eos.confirmedis true only onOutputStart::ToolBody(tagged.rs:431) or whenD::starts_callreturnedSome(true)during mode discovery (tagged.rs:715-722). An undecided opener taken whileself.finishinggetsconfirmed = decision == Some(true)= false, which is why<tool_call>run,<tool_call>run<arg,<tool_call>run</toolstill error — asserted inargument_tags.rs:505-548.TaggedOutput::finishnow advancesself.callsby the number ofToolBeginevents it emits (tagged.rs:519-528), so a recovered call gets a correct index;emit_callswas extracted (tagged.rs:224-246) so push and finish share it.RawArguments::is_empty()added (tagged.rs:844-847), used by the chatml condition.
Per-dialect accept rules as implemented (not just as documented):
- GLM / ArgumentTags (
argument_tags.rs:25-94): name must be nonempty and free of<,>, whitespace; rejectsstrict: true; bare name with no argument pair rejected; the ordinary loop then requires<arg_key>…</arg_key>and</arg_value>, so trailing text fails with "GLM tool call requires an argument key". - Qwen / MiMo (wrapped and compact
FunctionTags) (chatml.rs:95-178, condition at:127-129):allow_unclosed_function && !strict && !arguments.is_empty() && rest.is_empty().parse_candidatepassestrueunconditionally (chatml.rs:28), so the</tool_call>-closes-the-call case is accepted at any time, not only at EOS. - Gemma 4 / GemmaCall (
gemma_call.rs:109-136): only new rejection isstrict: true(:127-128); brace balance, no trailing text, and<|"|>closure come from the pre-existingvalue()parser. Explicit{}accepted. - MiniMax XML (
minimax_xml.rs:144-188): missing</invoke>accepted only for a non-strict tool with ≥1 parsed parameter element and no leftover non-whitespace; new guardif allow_unclosed_invoke && calls.is_empty() { Err("XML tool call requires an invoke tag") }.parse_candidatealso passestrue(minimax_xml.rs:200-202), so again mid-stream acceptance. - PlainText (
pipeline.rs:49-51): returns the pre-existing "tool parsing is not configured" error — an unconfigured parser behaves as before.
Description says / change does not do (and vice versa):
- The description's claim that
TaggedOutput"unconditionally setouter_tool_pending = D::FUNCTION.is_some()" is right, and the fix does land attagged.rs:593-596— but the description frames it as part of EOS recovery, whereas it changes the ordinary streaming path for every tagged call that has an inner function closer. - The description's parenthetical "(also accepted when closed by
</tool_call>)" for function-tag and MiniMax is accurate but understates it: that path is not gated on EOS at all. docs/api.md:547("Missing and incomplete calls fail as in required mode", tool_choice section) was not updated, although therequired/namedpaths now behave differently for unclosed-but-complete calls (protocol test cases 1b/2/3 depend on exactly that).- The new doc paragraph at
docs/api.md:514-525sits next to the still-present sentence at:507-508("A tag still undecided when generation ends is parsed as an incomplete call"). Reading the code, both are true (undecided ⇒confirmed == false⇒ error), but the two passages read as contradictory side by side. - Small undeclared detail: a user-facing error string reads "incomplete strict Gemma call tool call" (
gemma_call.rs:128), a doubled word. - Verified NOT changed: no package/contract/protobuf/recipe/GPU changes, no change to
docs/TODO.txt, no change to the strict-wire grammars (helios/src/grammar/strict.rsuntouched).
The why
The motivating problem is stated only generically in the description — GLM omitting </tool_call>, Qwen/MiMo omitting </function></tool_call>, Gemma 4 omitting <tool_call|>, MiniMax XML omitting </invoke></tool_call> — with no captured generation and no frequency.
Tracker archaeology:
- #514 (open PR, jannerchang, 2026-11-25) is the only earlier statement of the problem, for GLM only, also without a log.
- #133 (closed issue) is the record that the current policy is intentional, introduced in
99cfcd5be, pinned byoutput_limits_allow_incomplete_tools_but_eos_rejects_themin03074c11, restated in #67, and changeable only as a maintainer policy decision that editsdocs/api.md— which is what #573 does. - #67 (merged, mark-yong, fixes #30) introduced
starts_calland the rule "an undecided opener at finish is still parsed as a call"; #573 keeps the rule but changes its EOS outcome from unconditional error to conditional recovery, and #573 depends on theconfirmeddistinction #67's design made possible. - #39 / #179 are the adjacent GLM blast-radius family (a single malformed argument killing the whole stream), fixed differently (retaining type-mismatched values), not by closing-tag leniency.
- #32 (open issue) is the policy line the undeclared-tool case follows: return the call rather than fail the turn.
How long wanted: earliest traceable statement is 2026-11-25 (#514), three days before #573; no long-running feature request exists in the tracker.
Related work
| Item | State | Relation |
|---|---|---|
| #514 helios: allow lenient EOS close for GLM argument-tag tool calls | open | Competing / would be superseded. Same two files, same GLM symptom, flag-based (LENIENT_EOS_CLOSE), +61/−0. Auto-review halted: "low value or does not align with the project charter". Textual conflict with #573; #573 does not cite it. |
| #133 GLM-5.3 TP2 live serving trace | closed issue | Records the deliberate EOS policy and its origin commits — the exact rule #573 reverses. |
| #67 Keep prose tool-tag mentions as text | merged | Supplies starts_call and the undecided-opener rule; #573 changes that rule's EOS result. |
| #418 Add strict function-tool schemas for DSML, Qwen, GLM and TML | merged | Most recent large change to these files; supplies the strict semantics #573's parse_eos branch on, and restricts strict tools to DSML/Qwen/GLM/TML (grammar/strict.rs:1483), so Gemma/MiniMax strict branches are unreachable over HTTP. |
| #179 / #39 | merged / closed | GLM argument-type retention; same blast-radius family, different root cause. |
| #102 ignore_eos finish reason | merged | Disclosed the same drop-at-limit / error-at-EOS asymmetry; its review set the precedent that such semantics changes need explicit maintainer acceptance in the description. |
| #405 declared markers as controls | merged | GLM argument markers as controls/delimiters; same file, no behavioural overlap. |
| #578 DeepSeek raw parameter recovery | open | Same "recoverable call shouldn't kill the response" family, different files; #573 deliberately leaves DeepSeek unrecovered, so the pattern stays open on that path. |
Not relevant (followed and dismissed): #548, #560, #562, #552, #554 (metrics/engram/draft), #385/#387, #193, #426, #129, #550, #569, #568, #561, #566, #507, #509, #510, #543, #545, #546, #570, #579 — other subsystems; none touches helios/src/output.
Recent activity
No default-branch commit since the fork point (7cd83f3) touches this PR's files, so there is no rebase or conflict exposure with main. The last change in this code before #573 is #418 (2026-11-22, five days earlier); #573 builds on post-#418 code. The heavy 2026-11-28 churn in helios/src (#579, #570, #569, #568, #561, #566, #550) is entirely outside helios/src/output. Nothing in the change reverses recent work; it reverses a policy older than all of it.
People
- lukealonso — author of the code being changed in both directions:
99cfcd5bintroduced the EOS-error asymmetry,03074c11pinned it, plus the MiniMax M3.1 and recipient-header work and the last several structural changes intagged.rs. Highest commit volume inhelios/src(214 in 180 days) anddocs(373). 10 merged / 0 closed / 0 open in the last 180 days. Charter names them a priority contributor ("carry extra weight — we never close their PRs out of hand"). - mark-yong — #67 (the undecided-opener rule), #179, #102, #94, #162 in the same parser path.
- jcartu — #418, the most recent large change to
argument_tags.rs/chatml.rs/tagged.rs/protocol/tests.rs. - yatesdr — #405, #167, and the
grammar/strict.rsEOS assertions (strict.rs:3335-3348helpers; used at:3402, :3536, :3681, :3689) that sit closest to the changed boundary. Their inputs are prose/partial prefixes with no closed argument body, so they should still hold. - original-el8 — triage and review voice who asked for explicit maintainer acceptance of comparable semantics changes in #102; the same discipline applies here.
- jannerchang — author of #514; no maintainer has responded to it.
Nobody has engaged on #573 itself.
Community
Zero. pr_comments on #573 returns "No comments": no reviews, no inline comments, no labels, no reactions, no bot case file recorded in the local copy. By contrast #514 received a flare-autobot case file ~11 minutes after opening and a "Review Stopped / low value or does not align with the project charter" verdict ~16 minutes after opening. That verdict is about #514's narrow flag design and should not be read as a verdict on #573, but it is the only machine-generated signal about this problem area. Interest drawn by #573: none measurable.
Project fit
- Vision: "people running local models through OpenAI and Anthropic SDK clients", "heavy tool use" — the affected population is exactly the project's target.
- "Keep the runtime small and model-agnostic. Helios … shouldn't accumulate per-model branches (#267, #334)." #573 adds one shared trait method with the per-dialect rules living in the dialect modules, and explicitly rejects per-model booleans (#514's design). That lines up; a reviewer could still ask whether five dialect-specific accept rules is model-specific surface area, and whether the repository wants those rules at all.
- "Bring real evidence … Bug fixes need to address the root cause; don't just swallow, skip, or retry an unexplained error (#397)." #573 narrows acceptance rather than swallowing, and argues the root cause is the model's wire output being complete. The counter-reading available to a reviewer: the evidence for that root cause is assertion, not observation.
- "PR descriptions: Expect four parts: why, what changed, claimed result, evidence" — all four are present, plus an "Unrun checks / limitations" section and the required
Discord: no username providedline (satisfies AGENTS.md's rule for when no handle is given). - "What gets merged: PRs that address a maintainer request, a roadmap item, a reproducible bug, a measured performance/memory issue, or bad docs." No maintainer request is cited, no roadmap item, no reproduction.
- No
Design-Signed-Off-By/ design-review digest appears in the PR record (unlike #418 and #179), though that trailer lives in commit messages the local record does not show. - Docs:
docs/api.md:444-451and:514-525are rewritten/extended;:547is left stale (above);docs/TODO.txtuntouched.
Claims and evidence
| Claim | Backing found |
|---|---|
| Non-strict complete calls recovered at natural EOS across five configurations | Real: new unit tests in all five parser modules; server/protocol/tests.rs::unclosed_tagged_tool_calls_at_eos_match_protocol_and_control_semantics (5 configs × 3 protocols); server/logprobs.rs::unclosed_glm_tool_call_at_eos_preserves_content_logprobs_and_reasoning_tokens (worker × streaming = 4) |
| "across all 5 tagged dialect configurations (glm, qwen, mimo, gemma, minimax)" | Accurate wording, but qwen and mimo are the same ToolParserKind::QwenCoder differing only in wrapping_newlines — four parser kinds, five configurations |
| Undecided openers / bare headers / unclosed args / trailing text / strict still fail | Backed by tests and by reading the confirmed gate (tagged.rs:317-319) and per-dialect guards |
| All non-EOS terminations unaffected | Backed: tagged.rs:302-312 plus explicit tests for OutputLimit/UserStop/Cancelled/ExecutionError in each parser module |
strict: true missing its wire closer still fails |
Backed for Qwen and GLM at the protocol layer (extended strict_tool_wires_reach_encoder_only_after_parser_completion, which has _ => None for other dialects). The Gemma/MiniMax strict rejections exist in code but are unreachable via HTTP because #418 rejects strict tools for those parsers at admission (grammar/strict.rs:1483) — defensive only |
tool_choice auto/required/named, undeclared tools, parallel_tool_calls: false |
Exercised at the encoder layer with hand-fed text (cases 1b/2/3/4), no HTTP round trip |
| "203 passed, 0 failed, 4 ignored" | Plausible from the added test count; not re-runnable from the description (no CI log, no per-binary breakdown). Not re-run for this case file |
| Real-world model behaviour (models omit tags) | No captured output, no frequency, no served run. The description's own "Unrun checks" concedes live GPU serving was not exercised |
Gaps: no evidence for the premise, no test at the HTTP layer, and no verification against the checkpoint-gated suites (reasoning_delimiters, glm_frontend, parser_start — 15 tests — compiled but not run; deepseek_output ran, 14 passed), which is the normal environment limit in this repo (#102, #179, #418 all have the same gate).
Reach
- Five tagged configurations: GLM 5.3 (
ArgumentTags); Qwen 3.8, Qwen dense, Nemotron-H, Step 5 with wrappedFunctionTagsand MiMo V2 with compactFunctionTags; Gemma 4 (GemmaCall); MiniMax M3.1 (MiniMaxXml). Roughly nine recipes by the mapping #67's scope note gives. - Not affected: DeepSeek DSML/XTML, TMLv0, ATEM, recipient-header parsers.
- Runtime-only: no contract, protobuf, recipe, or prepared-core change, so existing deployments pick it up with a new Flare binary — the same conclusion #67 reached for its runtime-only change.
- No kill switch: no flag, env var, or setting. Behaviour is unconditional for non-strict tools, undeclared tools included (undeclared ⇒ treated as non-strict ⇒ recoverable).
- Client-visible: requests that used to die with an SSE error / HTTP error at natural completion now finish as
tool_calls(Chat),tool_use(Messages),completedwith a function_call item (Responses). It can also satisfytool_choice: required/namedwhere the previous behaviour failed "required tool choice was not satisfied". Clients that retried on the error stop retrying. - Diagnostics: no metric or log added; the
incomplete …error strings remain for the still-rejected shapes, so the only lost signal is for the accepted shapes. - Trait surface: making
parse_eosrequired would break external implementors, butToolDialectis inside an unpublished runtime crate (charter: in-process SDK crates "aren't published yet"), so nothing external breaks today. - Cross-cutting constraint: leniency must agree with #418's strict admission. It does by construction (keyed off the declared tool's
strictflag), and #573 asserts the Qwen/GLM strict case at the protocol layer.
Process
Open, ready for review (not draft), head 09cc524, CI passed, 9 files, +1423/−70, opened and last updated 2026-11-28 — no staleness. Description follows the repo's required four-part shape plus limitations and Discord line. No reviews requested or received; no labels; no design-review digest visible; DCO sign-off not visible (lives in commit messages). The author is a priority contributor, so process review will likely be quick — which raises, not lowers, the weight on the two substantive questions: whether the policy reversal is wanted without a maintainer request or a reported reproduction, and whether the two out-of-EOS widenings are intended.
Open questions / not found
- Is there a captured generation or request log for any of the five dialects? None found in the PR, #514, or the tracker.
- Was #514 acknowledged by any maintainer before #573 was opened? No maintainer response exists on #514.
- Is the
outer_tool_pendingchange (tagged.rs:593-596) intended as part of this PR, or a drive-by correctness fix? It is not explained as such in the description. - Should the
</tool_call>-closes-the-call acceptance for Qwen/MiMo and MiniMax be EOS-only? It is currently unconditional. docs/api.md:547("Missing and incomplete calls fail as in required mode") was not updated — oversight or intentional?- Whether
Design-Signed-Off-By/ a design-review digest exists in the commit trailers could not be determined from the local record.