Review: PR #573 — helios: tolerate omitted closing tags on complete tagged tool calls at EOS
Lens: architecture and scope (does this belong in the repo, is the approach right), judged against the charter, AGENTS.md and docs/design-review.md.
Key findings
- The approach is architecturally correct and belongs in the repository. The whole change sits in the model-output parser layer (
helios/src/output/*), adds no per-model boolean flag, no environment switch and no configuration knob; it replaces exactly the kind of per-dialect opt-in thatAGENTS.md:356-357anddocs/design-review.md:58-61prohibit with one trait method. No blocking finding. - Should fix (scope/evidence): four dialects' EOS behaviour is relaxed (GLM, function-tag/Qwen+MiMo, Gemma 4, MiniMax XML), but the PR cites no captured model output, checkpoint or reproduction for any of them; the only linked request is #514, which was GLM-only and was stopped by auto-review as low value.
AGENTS.md:103-112anddocs/design-review.md:106-115require claim-to-evidence binding. - Nit:
parse_eoswas added as a required method on the publicToolDialecttrait with no default (helios/src/output/tagged.rs:45), duplicating thePlainTexterror body (helios/src/output/pipeline.rs:49-51) that could simply be the default. - Nit:
docs/api.md:447-451says "tagged tool parsers accept …" generically, while only four of the tagged dialects implementparse_eos; the other tagged parsers remain strict. - Two genuine pre-existing defects are fixed as a side effect (call counting during
finish, andouter_tool_pendingafter an already-consumed</tool_call>), which strengthens the case for merging.
Detail
1. Should fix — four dialects are relaxed on assertion, not on evidence
docs/api.md:447-451 (the new spec text) applies the relaxation to "tagged tool parsers" generally, and the PR description states the omissions as fact: "GLM omitting </tool_call> after </arg_value>, Qwen/MiMo omitting </function></tool_call> after </parameter>, Gemma 4 omitting <tool_call|> after }, or MiniMax XML omitting </invoke></tool_call> after a closed parameter element."
Nothing in the PR description backs those four statements with a model, a checkpoint, a captured generation, or a reproduction command that identifies inputs and configuration. The Evidence section enumerates unit and protocol tests written for the new behaviour — those show the code does what the author decided, not that the models behave that way. The only linked request is #514 ("helios: allow lenient EOS close for GLM argument-tag tool calls"), which is GLM-only and which auto-review assessed as "low value or does not align with the project charter".
Why it matters: the charter's Bring real evidence rule says bug fixes need the root cause and that "hypothetical users aren't enough to justify a change"; What gets merged lists "a reproducible bug". AGENTS.md:103-112 requires each material claim to be connected to the behaviour tested, baseline, configuration, result and limits, and docs/design-review.md:106-115 (principle 12) requires honest evidence and disclosure of unrun checks. The PR does disclose its unrun checks honestly, but the underlying premise — that four model families omit their closers — is unverified in the text. The burden is higher than usual here because the repository already declined a narrower version of this same change (#514), so "we now do it for four dialects" reverses a prior scope decision without adding any evidence.
Fix: attach one captured generation per dialect (prompt + model/checkpoint + observed unclosed output, or an issue link containing it), or narrow the change to the dialect(s) with a demonstrated defect and leave the rest erroring as today. docs/api.md should then describe exactly the dialects covered, not "tagged tool parsers".
Note: #514 also proposed a const LENIENT_EOS_CLOSE: bool per-dialect flag, which would have violated docs/design-review.md:58-61. This PR's single parse_eos method is the right way to express the same capability without a policy flag, so the approach is fine — only the claimed motivation needs evidence.
2. Nit — parse_eos has no default on the public trait
helios/src/output/tagged.rs:43-45:
/// Parse an unclosed call body at natural end-of-sequence (`Termination::Eos`).
/// Accepts only structurally complete, self-delimited, non-strict calls.
fn parse_eos(body: &str, tools: &[Value]) -> Result<Vec<(String, String)>>;
pub trait ToolDialect lives in pub mod tagged (helios/src/output.rs:23), re-exported from the server feature of the helios crate (helios/src/lib.rs:20-21), so every implementor inside and outside the crate must now write this method. The conservative behaviour is expressible from existing trait items, e.g. Err(format!("incomplete {} tool call", Self::NAME).into()) — the identical string TaggedTools::finish already produces at helios/src/output/tagged.rs:317-318, and exactly what PlainText duplicates at helios/src/output/pipeline.rs:49-51 (it repeats its parse error, "tool parsing is not configured").
Why it matters: a default keeps the trait's "safe unless you opt into recovery" shape explicit in the type system rather than in five bodies, and deletes the duplicated impl. Low severity — the charter's roadmap says the crates are not yet published (Roadmap → In-process Rust SDK (#6)), so there is no live external-implementor break today. Fix: add a default body returning incomplete <NAME> tool call and drop PlainText::parse_eos.
3. Nit — documentation over-generalises which parsers recover
The new text at docs/api.md:447-451 states the natural-completion recovery as a property of "tagged tool parsers". Only four dialects implement it: helios/src/output/argument_tags.rs:109, helios/src/output/chatml.rs:30, helios/src/output/gemma_call.rs:147, helios/src/output/minimax_xml.rs:203 (plus the erroring PlainText at pipeline.rs:49). The other tagged/structured parsers — dsml.rs:364-383, xtml.rs:234-250, tml.rs:358-374 (not opened), recipient.rs:264-291 (not opened) — remain strict at EOS. Leaving them alone is correct scope discipline (they are separate state machines with their own contracts), but the doc sentence should name the four dialects or say "the argument-tag, function-tag, Gemma call, and MiniMax XML parsers", so a later reader does not treat the omission as a bug in DSML/XTML/TML/recipient.
4. Positive assessment — layering, flags and preserved guarantees
- Layer: every changed production line is inside the output-parser layer (
helios/src/output/*), which is where model frontend syntax already lives;docs/design-review.md:47-48says native frontend processing stays shared and model-dependent behaviour is expressed through prepared metadata/frontend assets. No scheduling, cache, admission or encoder policy changed.helios/src/server/logprobs.rsandhelios/src/server/protocol/tests.rschanges are tests only. - No forbidden flag: dispatch is a single trait method (
tagged.rs:45), with per-dialect bodies reusing their existing parsers via an internaleos: bool(argument_tags.rs:25-29,gemma_call.rs:107-109,minimax_xml.rs:144-147) or an internalallow_unclosed_functionthreaded throughparse_candidate(chatml.rs:85-131). These are local implementation parameters, not model-identity policy switches; nothing is exposed as configuration, anddocs/design-review.md:89-92(explicit configuration, no env switches) is respected. - Anti-fabrication preserved:
TaggedTools::finish(tagged.rs:302-322) still errors when the opener was never confirmed or the body ends inside a JSON string (tagged.rs:317-318), so<tool_call>run,<tool_call>run<arg,<tool_call>run</tooldo not become calls; every dialect's EOS path rejectsstrict: truetools (argument_tags.rs:45-47,chatml.rs:127,gemma_call.rs:127-129,minimax_xml.rs:165-169); non-EOS terminations still clear and omit (tagged.rs:303-312), keepingdocs/api.md:446("truncated tool envelopes are omitted") true. - Two real defects fixed:
TaggedOutput::finishnow advancesself.callsforToolBeginevents emitted during finish (tagged.rs:522-529), andouter_tool_pendingis only set when</tool_call>was not already consumed (tagged.rs:593-596, with theouter_closedvalue captured attagged.rs:274-292). These are corrections, not churn, and they justify part of the diff independently of the EOS relaxation.
Open questions / not verified
- No captured model output exists in the PR for any of the four dialects; only a reproduction per dialect (or a decision to narrow scope) settles finding 1.
- Whether external crates implement
ToolDialecttoday cannot be settled from this repository; the roadmap statement that the crates are unpublished is what keeps finding 2 at nit level. - I did not re-run any tests; the CI on head
09cc524passed, and the PR's own Evidence section is consistent with the test files it adds, but live GPU serving and checkpoint-gated suites (FLARE_*_TEST_SNAPSHOT,FLARE_TEST_TEMPLATE_DIR) were not executed by the author either, as disclosed.