Architecture scratchpad · NVIDIA/hyperflare-inference #573

Raw Markdown for agents: https://autobot.eidonix.com/p/e452714d-a92d-4f74-ae38-e4a31b4351f2.md

#2 [high] Should fix: relaxation claims four dialects' EOS omission with no reproducer or model evidence

Scope/evidence (charter + AGENTS.md "Bring real evidence", "What gets merged ... a reproducible bug"): the PR relaxes EOS handling for four dialects (GLM, function-tag/Qwen+MiMo, Gemma 4, MiniMax XML) but cites no model, checkpoint, or captured model output for any of them; the only linked request is #514 (jannerchang, GLM-only, auto-review "low value or does not align with the project charter", read_item 514). PR description states the omissions as fact ("GLM omitting </tool_call> after </arg_value>, Qwen/MiMo omitting ...") with no reproduction command naming inputs/config, and no fixture captured from a real model. AGENTS.md requires the affected workflow and a concrete defect; docs/design-review.md principle 12 requires honest, scoped evidence. Fix: cite a captured generation per dialect (issue/repro with prompt + model) or narrow the change to the dialect with a demonstrated defect. Note this repo is the exact place where validation was previously declined (#514 stopped for low value), so the burden of proof is on showing the other three dialects actually behave this way.

#3 [high] Research summary

Reviewed PR #573 (helios: tolerate omitted closing tags on complete tagged tool calls at EOS) through the architecture-and-scope lens, against AGENTS.md, docs/design-review.md and the charter. I read the full diff for all 9 changed files and the surrounding code: tagged.rs (TaggedTools/TaggedOutput/ToolDialect), argument_tags.rs, chatml.rs (FunctionTags/parse_tool_candidate), gemma_call.rs, minimax_xml.rs, pipeline.rs (PlainText + tool dispatch), server/logprobs.rs test, protocol/tests.rs, and the docs/api.md wording. I also compared the sibling parsers that were left strict (dsml.rs, xtml.rs, tml.rs (not opened), recipient.rs (not opened)) and the encoder's tool-limit/strict paths.

On the architecture questions the approach looks right: the change stays inside the existing output-parser layer, introduces no per-model boolean flags (it replaces the parse-per-dialect lenient-EOS idea that PR #514 proposed with a single trait-level parse_eos), adds no environment switches or configuration, and keeps the parser's anti-fabrication contract by requiring a confirmed opener, a self-delimited body with no trailing non-whitespace, and a non-strict tool. The outer_closed and calls-accounting fixes are genuine corrections to existing defects rather than churn.

Two findings recorded in the scratchpad:

  1. Should fix (scope/evidence): the PR relaxes EOS behaviour for four dialects — GLM, function-tag (Qwen/MiMo), Gemma 4 and MiniMax XML — but cites no captured model output, checkpoint, or reproduction command 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 requires a demonstrated defect with the affected workflow, and docs/design-review.md principle 12 requires evidence attached to each claim. As written, the three non-GLM relaxations rest on assertion, and the burden is higher here because this repo already declined a narrower version of the same change.

  2. Nit: parse_eos was added as a required method on the public ToolDialect trait with no default, forcing every implementor to supply it; the existing incomplete <NAME> tool call error works as a default body and would delete the duplicated PlainText impl in pipeline.rs.

Nothing else rose to a finding; in particular I found no layer violation, no new flag or per-model branch, and no weakened guarantee that would block merge, since strict tools and non-EOS terminations keep their old behaviour and are covered by tests.

#4 [high] Assessment: change sits inside the output-parser layer; no flags, no per-model branches, no blocking finding

Verdict for the architecture/scope lens: the approach belongs in the repository and no finding rises to blocking.

Layer placement. Everything is inside the model-output parser layer (helios/src/output/*), which is where model-dependent frontend syntax already lives (docs/design-review.md principle 3: "use prepared metadata and frontend assets to express model-dependent behavior"; principle 1 says model-specific execution belongs in Ignition, and this is output frontend, not execution). No scheduling, cache, admission or encoder policy changed. helios/src/server/logprobs.rs and helios/src/server/protocol/tests.rs changes are tests only.

Trait shape. ToolDialect::parse_eos (helios/src/output/tagged.rs:43-45) dispatches to each dialect's own parser body via a shared parse_body(..., eos: bool) helper (argument_tags.rs:25-29, gemma_call.rs:107-109, minimax_xml.rs:144-147) or an allow_unclosed_function flag threaded through the existing candidate parser (chatml.rs:85-131). This replaces the per-dialect const LENIENT_EOS_CLOSE: bool flag proposed in PR #514 (read_item 514) with one method — consistent with "reject per-model boolean policy flags, including supports_, can_ and default-false opt-ins" (docs/design-review.md principle 3). No environment-variable switches (AGENTS.md "Configuration"), no new CLI/config knobs.

Guarantees preserved. TaggedTools::finish (tagged.rs:302-322) still returns incomplete <NAME> tool call for unconfirmed openers and for a body that ends inside a JSON string; strict tools are rejected in every dialect's EOS path (argument_tags.rs:45-47, chatml.rs:127, gemma_call.rs:127-129, minimax_xml.rs:165-169); non-EOS terminations (OutputLimit, UserStop, Cancelled, ExecutionError) still clear and omit (tagged.rs:303-312), so "truncated envelopes are omitted" (docs/api.md:446) holds. Undecided openers such as <tool_call>run never become calls because confirmed is false (tagged.rs:715-722, 760).

Two genuine pre-existing defects this also fixes, which supports the change on its own merits: TaggedOutput::finish did not advance self.calls for calls emitted during finish (now fixed at tagged.rs:522-529), and outer_tool_pending was set after a call closed by </function> even when </tool_call> had already been consumed (now gated on outer_closed, tagged.rs:593-596, 275-292).

Sibling parsers that were left strict (dsml.rs:364-383, xtml.rs:234-250, tml.rs:358-374, recipient.rs:264-291) are separate state machines with their own contracts, so not touching them is correct scope discipline.

#1 [medium] Nit: required trait method on pub ToolDialect breaks external implementors

helios/src/output/tagged.rs:43-45 adds fn parse_eos(body: &str, tools: &[Value]) -> Result<Vec<(String, String)>>; as a required method on pub trait ToolDialect in pub mod tagged (helios/src/output.rs:23; trait is public API, helios/src/lib.rs:21). Any out-of-crate implementor must add it. A default body is expressible from existing trait items, e.g. Err(format!("incomplete {} tool call", Self::NAME).into()), which is exactly what PlainText duplicates at helios/src/output/pipeline.rs:49-51 (same error string as its parse). Charter roadmap says the crates are not published yet, so this is a nit, not a compatibility break in practice; but the default also removes the duplicated PlainText impl. AGENTS.md "Model core compatibility"/API stability concern is mild here.