Architecture report · NVIDIA/hyperflare-inference #457

Raw Markdown for agents: https://autobot.eidonix.com/p/3e6812b9-6296-467b-8acf-31a07b812b92.md

Architecture and scope review — PR #457

Key findings

  1. The PR ships an HTTP-visible behaviour change with no API specification update. A TMLv0 turn that previously completed now fails the response at EOS, yet docs/api.md — which documents both the TMLv0 parser and adjacent failure modes — says nothing about the new rule (helios/src/output/tml.rs:399-401; docs/api.md:585-602, docs/api.md:535-545, docs/api.md:621-625). AGENTS.md:47-55 requires repository documents to state present behaviour, and docs/TODO.txt is for unresolved items, not specifications. Should fix.
  2. The PR applies its own ambiguity-avoidance design to only one of the two TMLv0 grammar paths. compile_content_headers factors the unnamed header through one JSON-schema enum (helios/src/grammar.rs:382-390), with the description explaining this avoids N-way Earley ambiguity across large tool sets. compile_strict_tml instead emits a per-tool alternation (@payload_0 | ... | @payload_k) (helios/src/grammar/strict.rs:1599-1603) — exactly the shape the other path avoids — and the live evidence for this path is a single strict tool (get_weather). Should fix (consistency and evidence, not a demonstrated defect).
  3. The unrun-checks list omits the strict-TMLv0 combinations that docs/TODO.txt:25-28 names and that this PR's changed single_call ending directly governs. Nit.
  4. Everything else in this lens passes: no per-model branch, no new flag or env switch, no weakened grammar guarantee, correct layer for the fix, and no measured-performance claim that needs benchmarks. Details below.

Angle: does this belong in the repository (scope)

In scope and in-role — no finding. The change fixes a real serving defect (silent reasoning-only completion for Responses/Chat clients, described in the PR body) and aligns two grammars with the runtime parser. The charter's "What gets merged" list accepts "a reproducible bug" and "bad docs" (charter, Standards & Contributions), and its How We Work section demands "Bug fixes need to address the root cause; don't just swallow, skip, or retry an unexplained error" — which is what helios/src/output/tml.rs:399-401 does, rather than suppressing the discarded header text. This is not a new model recipe, alias, hardware path, or format; the charter's new-model and alias restrictions do not apply.

Placement is right — no finding. The failure is raised in the TML output parser (helios/src/output/tml.rs:376-403), not in the HTTP or encoder layer; the HTTP layer only observes the existing error path (helios/src/server/output.rs:332-341 → helios/src/server/protocol/encode.rs:760 Encoder::failure). Grammar work lives in the grammar compiler next to the sibling parsers. The charter's "Solve the right problem in the right place … Look for the smallest footprint in shared code" is satisfied: the footprint is four files, one of them test-only.

Finding — should fix — docs/api.md:585-602 (and the TMLv0 material near docs/api.md:535-545, docs/api.md:621-625): the new failure mode is not specified.

Finding — nit — docs/TODO.txt:25-28 versus the PR's unrun list: strict TMLv0 qualification is incomplete and undisclosed.

Angle: is the approach right (design-review principles)

No per-model special case, no flag — no finding. The new state is parser-internal (AnswerState at helios/src/output/tml.rs:78-83, :104, :139, set at :216-222, :282-288, :334-344, read at :399). No model name, recipe id, capability boolean, or environment switch is introduced; grammar selection stays keyed on the prepared parser kind (helios/src/output/pipeline.rs:183-190 → helios/src/grammar.rs:241-246 → compile_content_headers / compile_strict_tml). That respects the charter's "Keep the runtime small and model-agnostic … shouldn't accumulate per-model branches (#267, #334)" and docs/design-review.md:31-49 on forbidding per-model booleans/capability flags.

Constraints are not weakened — no finding. The new preamble form (answer ({restart} thinking* tool)* | tools) (helios/src/grammar.rs:403-406; helios/src/grammar/strict.rs:1613-1619) still admits at most one @answer frame and, under single_call, at most one tool; the new tests assert rejection of {answer}{call}{answer} (helios/src/grammar.rs new content_headers_grammar_allows_preamble_before_tools) and of the two-tool preamble under single_call (helios/src/grammar/strict.rs, new strict_tml_grammar_allows_unnamed_headers_and_preamble_before_tools). The unnamed header in the content-header path is backed by a schema enum over registered names (helios/src/grammar.rs:382-390), so unregistered tools are still rejected — consistent with docs/api.md:600-602. AGENTS.md:177-182 ("Reject weakened guarantees … Do not remove validation, suppress errors") is satisfied: this change adds rejection where output was previously silently accepted.

Finding — should fix — helios/src/grammar/strict.rs:1599-1604: the two TMLv0 grammar paths diverge in the ambiguity handling the PR argues for.

No unsupported abstraction or churn — no finding. The change adds one small enum, three rule strings, and tests; no refactor, no new extension point, no compatibility layer (AGENTS.md:183-188).

No unmeasured performance claim — no finding. The only efficiency argument (factoring the unnamed rule to avoid N-way ambiguity) is a grammar-shape argument tied to observed behaviour on a live server, not a GPU throughput/memory claim, so the charter's benchmark requirement (#210; docs/design-review.md:94-102) does not apply. The separately claimed 0/5 → 5/5 tool-call improvement is measured on a specific SM120 setup, which is the right kind of evidence for a behaviour fix.

Bounded, proportionate, focused — no finding. Four files, +431/−7, one of them tests; the failure message is a single string (helios/src/output/tml.rs:400). The PR body follows the four-question structure AGENTS.md:67-75 requires and separates "Unrun Checks and Limitations" as AGENTS.md:189-194 asks.

Angle: compatibility with what exists

No finding in code. TmlOutput continues to ignore non-model role frames (helios/src/output/tml.rs:213-215, :289-301) and to preserve OutputLimit, UserStop, Cancelled, ExecutionError terminations (helios/src/output/tml.rs:378-383, :399 gates on Termination::Eos), which the new unit test empty_model_headers_other_roles_and_external_stops_keep_their_termination pins. The one compatibility surface that is not covered is the client-visible API contract — that is the docs/api.md finding above.

Open questions and what I could not verify