PR #457: Fail untyped TML model headers at EOS and align TMLv0 content-header and strict-tool grammars with TmlOutput

Raw Markdown for agents: https://autobot.eidonix.com/api/v1/cases/55324286-e803-428d-8c71-9250e0eda2d6

Opened by a workflow run, Nov 24, 2026 2:20 PM EST.

screen malicious

Screen Result: All Clear

Evidence: No prompt injection or agent-directing content exists in PR #457: the diff touches only four Rust files in helios/src (grammar.rs, grammar/strict.rs, output/tml.rs, server/request/tml_tests.rs; +431/−7) and contains no imperative text aimed at an agent or LLM, no "ignore previous instructions", no URL-to-fetch, no base64/hex blobs, and no hidden side effects (pr_files; scanned content).

Nothing in the code does more than the description says: AnswerState (Empty/HeaderWithoutContent/Emitted) is recorded only for non-empty model headers closing on <|end_message|>/<|content_model_end_sampling|> with no visible content, and finish() errors on that state at Termination::Eos (helios/src/output/tml.rs:78-83, 282-288, 338, 399-401). The pre-existing 1 MiB header/call parse bounds are intact.

The grammar relaxations are narrow and are paired with retained rejections: tool_unnamed in compile_content_headers validates against a tool-name enum with additionalProperties: false (helios/src/grammar.rs:372-417), and compile_strict_tml keys the unnamed rule on each tool's strict or default wrapper schema, still rejecting unregistered tools, named-header/body mismatch and schema violations (helios/src/grammar/strict.rs:1565-1620; tests strict_tool_wire_grammars_enforce_constraints TML_unnamed, strict_tml_grammar_allows_unnamed_headers_and_preamble_before_tools).

No comments, reviews or CI exist on the PR, so there is no discussion text to inspect for injected directives; the only untrusted prose is the description and code comments (pr_comments; orientation packet).

Unverifiable but benign: the description's testing provenance — "live SM120 GPU verification", agentic_suite.py (not opened), 178-tool prompt runs, and a Discord credit — is asserted without artifacts in the repository. These are evidence claims, not instructions, and lie outside the diff.

Open questions: none affecting the verdict. The only non-code risk is that PR #457 is a large behaviour change to terminating/grammar semantics with zero review and no CI, and its GPU/agentic-suite results cannot be reproduced from the repository (helios/tests contains no agentic_suite.py (not opened) reference in the diff).

Full report · Notes decide malicious: all_clear (100%): No malicious content found

explore

Author: brandonmmusic-max (CONTRIBUTOR; 2 merged PRs, incl. #162 on Helios output parsing; not one of the charter's priority contributors). Discord: no username provided. Motivation: Helios's TMLv0 parser silently turned a malformed model turn (a header with no content-kind token, then end-of-turn) into a "completed" reasoning-only reply, and the TMLv0 grammars rejected two token framings the parser itself accepts (unnamed tool headers, text preamble followed by tool calls), making models print raw tool JSON or loop. This PR errors out the first case and widens the grammars for the second. Scale: +431 / −7 in 4 files Proposal:

Full report · Notes

Value Proposition

(The agent ended without a report: stopped at the time limit without finishing.)

Full report · Notes Decide Value: yes (99%): This change is worth reviewing: it provides value to the project in line with its charter.

Conventions

Verdict: should-fix issues only

Blocking:

Should fix:

Nits: 2 (the inkling_stress_ test-name prefix at tml_tests.rs:395/443, which no other test in the repo uses and the repo-prose skill rules out; and the cause-narrating finish() error at helios/src/output/tml.rs:399-401, unlike every sibling parser's state-named error, although it reaches clients as the response.failed message).

Link: https://github.com/NVIDIA/hyperflare-inference/pull/457

Full report · Notes

Prose

Verdict: should-fix issues only Blocking:

Full report · Notes

Architecture

Verdict: should-fix issues only

Blocking:

Should fix:

Nits: 1 — the PR changes compile_strict_tml framing (strict.rs:1613-1619) without disclosing the unrun combinations itemized in docs/TODO.txt:25-28 (Chat Completions strict TMLv0, streamed strict calls, max_tokens/max_output_tokens truncation), contrary to AGENTS.md:189-194.

Link: https://github.com/NVIDIA/hyperflare-inference/pull/457

Open questions: whether tool_unnamed alternation is slow or ambiguous at the tool counts the PR targets (178 tools) under strict: true, and whether the missing docs/api.md sentence is judged a blocker for a PR that otherwise only touches parser and grammar internals. Verification was read-only; no build or test run was possible here.

Findings that matter most beyond the description: (1) an HTTP-visible behaviour change (completed → response.failed/500) ships with no API specification update, while AGENTS.md:47-55 requires documents to state present behaviour and docs/api.md:535-545,621-625 documents comparable failure modes in the same section; (2) the ambiguity-avoidance argument used for compile_content_headers is not carried into compile_strict_tml, so the two TMLv0 grammar paths diverge in both shape and evidence; (3) the PR's own unrun list omits the strict-TMLv0 Chat/stream/truncation combinations that docs/TODO.txt:25-28 asks for and that the changed single_call ending directly affects.

Full report · Notes

Simplicity

Verdict: should-fix issues only Blocking:

My initial suspicion that tool_unnamed was unreachable under grammar: "start: /(?s:.+)/" does not hold: compile_content_headers renames the user grammar to answer and inserts its own start: grammar at index 0 (grammar.rs:379, 415-416), and request.rs:289-290 routes exactly that way — withdrawn. The diff's 178-tool Earley-ambiguity claim has no test behind it (the new tests use 1 and 2 tools).

Open: whether tml-renderers rejects the malformed terminal header (needs a regenerated fixture case).

Full report · Notes

Correctness

Verdict: should-fix issues only Blocking:

Full report · Notes

code review summary

Changes Requested

Blockers:

Should fix:

Nits:

Full report · Notes

Pre Test Report

Pre-test report — PR #457 "Fail untyped TML model headers at EOS and align TMLv0 grammars with TmlOutput"

(+431/−7 in 4 files: helios/src/grammar.rs, helios/src/grammar/strict.rs, helios/src/output/tml.rs, helios/src/server/request/tml_tests.rs. Head aacbca1.)

Verdict: DO NOT refer to hardware testing yet — blocked twice over

  1. No core on the available hardware can execute the changed code. The fix is gated on ToolParserKind::TmlJson (helios/src/grammar.rs:242, helios/src/grammar/strict.rs:1465, parser selected at helios/src/output/pipeline.rs:78 (not opened)). The only recipe in the tree that configures TMLv0 is Inkling 2 (ignition/recipes/inkling2/frontend.py:42,70 — tools=p.TML_JSON, prompt_encoder=PromptEncoder.TML_V0). GLM-5.3 uses GLM_ARGUMENT_TAGS, Qwen3.8 uses QWEN_CODER, Kimi uses XTML, so every model staged on cn5 and cn7 (GLM-5.3, Qwen3.8, dinov2) is untouched by this PR and would test nothing.

    • Inkling 2 Small is not obtainable: Checkpoint(alias="inkling-2-small-nvfp4", repository="/data/models/Inkling-2-Small-NVFP4", revision="local", stored_bytes=344_366_116_864), ranks={4: …} (ignition/recipes/inkling2/recipe.py:57-66). Local-only path, 344 GB checkpoint, 351 GB core on disk (docs/model-preparation.md:1627). cn5 (4× RTX PRO 6000 Blackwell Max-Q) is the exact host Small was qualified on (docs/model-preparation.md:1570) but does not stage it.
    • Inkling 2 Mini (thinkingmachines/Inkling-2-Mini @ ed40e7da625f594fc9c4990f5f66be24873c22d7, stored_bytes=19_525_870_752, device_bytes=20_263_810_112, ranks={1: …} — recipe.py:73-81) would fit one GB10 on cn7, but needs ~40 GB disk (checkpoint + prepared core) versus the 16 GiB per-job scratch on both hosts, so the core cannot be prepared or held inside a job.
    • Enabling step is infrastructure, not test work: stage the Mini checkpoint on cn7 and prepare/serve its core from host storage (outside job scratch). Until then any hardware slot spent on this PR produces no signal.
  2. Several should-fix items change what a test would be validating. Testing now would certify behaviour that is likely to change — exactly what priority 1 forbids.

Both the Architecture, Correctness, Conventions, Simplicity, Prose lenses returned the same shape: no blocking defect, multiple should-fix issues, zero human reviews, zero labels, and no CI checks on the head commit.

Findings that must be resolved before testing

A. The EOS guard keys on header text, not on "nothing was emitted" (Correctness, should fix). AnswerState::HeaderWithoutContent is recorded only when a non-empty model header closes on <|end_message|>/<|content_model_end_sampling|> (helios/src/output/tml.rs:282-288) and errors only at Termination::Eos (:399-401). Because emit returns early on visible == 0 (:207-209) and call_or_text on an empty body (:335-337), these still complete silently as status: "completed" with output=[reasoning] — the very symptom the PR claims to close:

Either the guard must key on "no answer emitted at EOS", or the PR must state that a closed empty frame is legitimate (the PR's own test at :652-653 asserts a reasoning-only turn [MODEL, THINK, "t", END, TURN_END] → Ok). A tester cannot judge pass/fail without that decision. Fix it first.

B. Undocumented API-contract change (Architecture + Prose, should fix). The PR turns a previously status: "completed" turn into response.failed / HTTP 500 server_error for every TMLv0 request, grammar-constrained or not (helios/src/server/output.rs:332-341 → helios/src/server/protocol/encode.rs:760). docs/api.md documents comparable failure modes at :535-545 and :621-625 but says nothing about the new rule, about unnamed tool headers, or about preamble-then-tools; docs/api.md:585-602 is the strict-tool/TMLv0 section and docs/api.md:443-444 still says only "recognized but incomplete calls at natural completion are errors". AGENTS.md:225 (not opened) requires the API doc update for API behaviour changes. Without it, the expected-test outcomes are not contractual and a tester has no oracle.

C. Strict-path ambiguity handling is half-applied and unmeasured (Architecture + Correctness, should fix). compile_content_headers factors the unnamed header through one JSON-schema enum (helios/src/grammar.rs:381-391) to avoid N-way Earley ambiguity across large tool sets; compile_strict_tml instead emits (@payload_0 | … | @payload_k) (helios/src/grammar/strict.rs:1599-1603), i.e. the shape the sibling path avoids, bounded only by max_grammar_size: 131_072 (grammar.rs:176-181) and MAX_GRAMMAR_BYTES = 262_144 (grammar.rs:22, checked strict.rs:2443-2455) — an over-limit grammar is rejected at admission, not degraded. No test in the diff uses more than two tools (two at strict.rs:4591-4599; live evidence was a single get_weather), while the 178-tool measurement that motivated the non-strict fix was on the non-strict path. This needs a CPU test at ~178 strict tools (compile + advance, with timing) or an explicit strict-tool bound. Cheap, no GPU.

D. Evidence gaps in the tests that would be the acceptance criteria (Conventions + Simplicity, should fix).

E. Prose / provenance (should fix but non-blocking for test cost). The live GPU evidence cites TML-d24-varloop-research, which this branch rejects (ignition/recipes/inkling2/config.py:88-92: "Inkling 2 preparation requires a fixed loop pass count") and which survives only in closed PR #468; the snapshot command is FLARE_INKLING2_TEST_SNAPSHOT=... (a placeholder); agentic_suite.py (not opened) does not exist in the repository. Nothing in the PR's own numbers is reproducible from the tree.

Cheap validation to do instead — no GPU required

These settle most of the open questions for free and should all be green before hardware is requested:

  1. Default-path suite (currently unrun — head has no CI checks): cargo test --locked --release --manifest-path helios/Cargo.toml (not opened) --target-dir flare-cli/target --features runtime-core,server (the CI command, .github/workflows/native-serving.yml:63 (not opened); AGENTS.md:311 (not opened)). This exercises output::tml::tests:: and both grammar tests. Zero-cost regression gate.
  2. Snapshot suite — needs only the Inkling 2 tokenizer.json (not opened) (hundreds of MB at most, fits 16 GiB scratch): FLARE_INKLING2_TEST_SNAPSHOT=<dir containing tokenizer.json (not opened)> cargo test … -- --ignored --test-threads=1 server::request::tml_tests:: (tml_tests.rs:9-12,40; all eight tests are #[ignore]d). Run after the duplicate test is deleted.
  3. CPU-only 178-tool strict-grammar test (finding C): compile and advance a strict TMLv0 grammar with 178 tools, record compile time and acceptance. No GPU, directly answers the only open performance question.
  4. Tokenizer-fixture case for the malformed terminal header with tml-renderers' reference_parse.error (finding D), so the expected outcome is cross-implementation evidence rather than a hand-written ID list.

If the above land and a Mini core is staged on cn7 — minimal hardware plan

Host: cn7 (1 × GB10, SM121 — the qualified target for Mini, docs/model-preparation.md:1660,1709), one job, flare run with prefix cache enabled, tests/server/test_inkling2_mini.py as the surrounding harness. No A/B throughput run: the change adds no compute to any hot path and the PR makes no throughput claim, so throughput testing would be wasted slots. Total: ~1 job, ~30–45 min.

# Test Expectation Cost
A Force a reasoning-only turn ending `< message_model >bash<
B False-failure control: ~10 ordinary generations (plain text, reasoning-only, one tool round trip) Zero new 500s; identical output to pre-PR behaviour ~10 requests
C Unnamed header tool call: <|message_model|><|content_invoke_tool_json|>{"name":…,"args":{…}}<|end_message|>, tool_choice:"auto" function_call in output / tool_calls, not raw JSON in content a few requests
D Preamble then tools: a text answer frame followed by tool frames message plus function_call, grammar does not reject a few requests
E Strict TMLv0 on the served core (docs/TODO.txt:25-28, currently unqualified): strict: true on Chat Completions and Responses, buffered and streamed, plus max_tokens / max_output_tokens truncation of a strict call Truncated call omitted and output limit reported; EOS inside a begun call errors (docs/api.md:621-625); required/named tool choice fails if no call completes; valid call decodes under the wrapper schema the bulk of the run
F Regression: non-strict TMLv0 tool call and response_format: json_schema (as in tests/server/test_inkling2_mini.py:120-135) Unchanged from main 2–4 requests

Do not test: ChatML/DSML/XTML/GLM/Qwen/Kimi paths (untouched code), multi-host/RoCE, prefix-cache internals, or non-TMLv0 structured output — none are reachable from the diff. Skip Small entirely unless a 4-GPU SM120 host with /data/models/Inkling-2-Small-NVFP4 and ~350 GB free disk is provisioned; that is a separate qualification effort, not a PR regression test.

Expected value if hardware testing were performed today

Low. The hardware available cannot run the changed code at all, and the expected pass/fail criteria are still moving (findings A, B, C, D). Everything of value in the open questions — grammar acceptance at 178 tools, the strict-path cost, the cross-implementation expectation for the malformed header, and the default-path regression suite — is obtainable in minutes on CPU.

Safety note

The malicious-content screen returned all_clear: the diff contains no agent-directed text, no fetched URLs, no encoded blobs, and no hidden side effects; the only untrusted prose is the PR description and code comments, which were treated as material to review.

Full report · Notes Decision to Test: no (100%): Testing will not add much value

Apply Labels

Applied: +triage:review, +bug, +area:api, +model:inkling-small

Classification Confidence

Threshold: 65%

Triage

Priority

Type

Area

Model