Explore scratchpad · NVIDIA/hyperflare-inference #575

Raw Markdown for agents: https://autobot.eidonix.com/p/3de31f41-4575-47f9-a05d-8d48efae2e55.md

#1 [high] Change: PR #575 rewrites TmlOutput::call to use serde_json RawValue

PR #575 (https://github.com/NVIDIA/hyperflare-inference/pull/575), by fordbmorris, branch pr/tml-output-raw-json-args, head 07955d7, base main, opened 2026-11-28. 3 files, +237/-10.

Core change, helios/src/output/tml.rs (TmlOutput::call, around lines 327-365):

No description claim found so far that the diff contradicts; description says nothing about needing a serde_json "raw_value" feature (worth checking Cargo features).

#2 [high] Why: strict TMLv0 integer >64-bit caused HTTP 500 'strict tool arguments does not match its grammar'

Per PR #575 body: with ToolParserKind::TmlJson (Inkling 2) + a strict:true tool whose schema has an unbounded {"type":"integer"}, constrained decoding can emit a 30-digit integer (e.g. 123456789012345678901234567890). The old serde_json::Value round-trip (serde_json compiled WITHOUT arbitrary_precision) turned it into a binary64 float rendered as 1.2345678901234568e29; OutputEncoder then re-validated that string against the compiled strict TextGrammar, saw a float where an integer was required, and failed the live request with HTTP 500 "strict tool arguments does not match its grammar".

PR body says this "addresses the strict TMLv0 tool-calling qualification tracked in docs/TODO.txt" (need to verify what docs/TODO.txt actually says).

#3 [high] Related work: #418 (merged) added strict tools incl. TMLv0 grammar but never served a TMLv0 core

Background: strict function tools were added in #418 (merged 2026-11-22, commit 0b09434d, "Constrain strict function-tool arguments in native tool syntax", closes #417). #418's own body states: "No TMLv0 (ToolParserKind::TmlJson) core was served (docs/TODO.txt tracks served TMLv0 qualification)"; TMLv0 was covered only by grammar/fixture tests (strict_wire_grammars_reject_schema_violations_during_generation, tml_json_strict_grammar_rebases_root_ref_and_parses_end_to_end, strict_tool_wires_reach_encoder_only_after_parser_completion). Reviewer yatesdr explicitly accepted "TML: fixtures are enough" but required that docs/TODO.txt carry the unserved check — hence docs/TODO.txt:5-8, the item #575 says it addresses.

#418 also established the precedent #575 leans on: Qwen (chatml.rs) and GLM (argument_tags.rs) strict parsers retain raw JSON tokens via RawArguments / Box<serde_json::value::RawValue> (helios/src/output/tagged.rs:805-860, helper strict_nonstring_raw at :846-860, doc comment "Preserve exact raw JSON tokens (such as >64-bit integers) on strict non-string scalars"), and TextGrammar::validate "accepts ... as well as >20-digit integers (123456789012345678901234567890)". DSML passes source text through (helios/src/output/dsml.rs:152-192).

So #575 extends an existing raw-token strategy to the one parser (TMLv0) that was left out.

Connection: #575's PR-body claim "matching the raw-token preservation already used by the Qwen, GLM, and DeepSeek DSML parsers" is accurate for Qwen/GLM (RawArguments) and DSML (raw text pass-through), but the strict-validator round-trip was the actual gate.

#4 [high] Change: the fix also changes non-strict TMLv0 argument text and tightens duplicate-key acceptance

Verified from the diff (https://github.com/NVIDIA/hyperflare-inference/pull/575): TmlOutput::call in helios/src/output/tml.rs is the parser used for ALL TMLv0 tool calls, strict or not (pipeline.rs:78 routes ToolParserKind::TmlJson to TmlOutput; strict gating happens later in helios/src/server/protocol/encode.rs:517-553). Consequences the description does not spell out (all follow from emitting args.to_owned() instead of args.to_string()):

  1. Non-strict TMLv0 calls also change: argument text is now the exact generated bytes, so whitespace inside the JSON object, number spellings (e.g. integral floats written as 1e20 vs 1.0), escape spellings and duplicate keys inside args reach the client verbatim instead of being normalized by serde. Only >64-bit integer precision was cited as motivation.
  2. Duplicate/unknown keys in the wrapper object were previously ACCEPTED when the duplicates kept len()==2 ({"name":"x","name":"x","args":{}} parsed to a 2-key map). Now deny_unknown_fields + struct deserialization rejects them and the body falls back to visible text — a small behavioral tightening in addition to the failure-mode preservation the description describes ("Unknown or duplicate wrapper keys fail deserialization and fall back to visible text, matching prior TMLv0 recovery semantics" — the "duplicate" half of that is new behavior, not prior).
  3. args object-ness is now checked by args.get().starts_with('{') on raw text rather than by is_object() on a parsed Value; a body whose args is a JSON object is still accepted, and now so is any object text that serde_json can parse as a RawValue (which must itself be valid JSON, so semantics are close).
  4. Key order preservation claimed in the description is really a property of the strict wire grammar (which emits members in properties declaration order, per #418), not of this change: serde_json in this crate already enables preserve_order (helios/Cargo.toml:52), so Value re-serialization also kept insertion order before. The change makes that order robust to any parser/Value path rather than newly introducing it.

#5 [high] Related work: #457 (open) rewrites the same TmlOutput::call and the same strict TMLv0 grammar

#457 (open, by brandonmmusic-max, opened 2026-11-22, +431/-7) rewrites the SAME function, TmlOutput::call in helios/src/output/tml.rs, and touches helios/src/grammar/strict.rs and helios/src/output/tml.rs — the exact 2 Rust files of #575. On its branch (pr/457) TmlOutput::call is still the OLD serde_json::Value + args.to_string() form (tml.rs:346-374 at pr/457), wrapped by a new call_or_text that sets AnswerState::Emitted. So:

#6 [high] Related work: #461 documents the same precision boundary; #191 added tml.rs; no user issue filed

#8 [high] People: first-time contributor (author fordbmorris == commit author 'woooflet'), three same-day PRs, no reviews

#9 [high] Claims and evidence: mechanism and error string verified; test counts and 35/35 live run unverifiable from the repo

Verified:

#11 [high] Reach: all TMLv0 cores; Anthropic Messages tool_use.input still re-parses through serde

#12 [high] Process: open and unedited since opening, no CI checks, no reviews, no DCO trailer visible

#16 [high] Research summary

Case file for PR #575 is assembled: 15 scratchpad entries covering all eight angles, each with file:line or item-number citations.

The change (verified from the diff). TmlOutput::call in helios/src/output/tml.rs stops round-tripping the {"name","args"} wrapper through serde_json::Value and instead deserializes a local #[serde(deny_unknown_fields)] struct RawCall<'a> { name: String, #[serde(borrow)] args: &'a RawValue }, checking args.get().starts_with('{') and emitting args.to_owned() verbatim. 3 files, +237/−10: tml.rs (+41/−10), strict.rs (+105, a test only), tests/server/test_inkling2.py (+91, one new live test). serde_json's raw_value feature is already enabled at helios/Cargo.toml:52, so no dependency change. The error string and 500 path in the description check out exactly (grammar.rs:653 → encode.rs:539-541 → http.rs:278 (not opened)).

What a reader could not learn from the description. (1) The change also alters non-strict TMLv0 calls — argument bytes are no longer normalized by serde — and it newly rejects duplicate wrapper keys that previously parsed ({"name":"x","name":"x","args":{}}). (2) Key-order preservation is not new: preserve_order was already on. (3) The "35/35 live qualification", the Rust test counts, and the HTTP 400 admission cases are not reproducible from the repo — the committed Python test holds one test with five assertion groups, and no CI workflow runs pytest at all, so only the two Rust tests will ever execute automatically. (4) The Anthropic Messages path still re-parses arguments through serde_json::Value (encode.rs:328-335), and the prompt-side TML renderer re-serializes arguments when echoing a prior turn (frontend/tml.rs:148-174) — neither is covered. (5) docs/TODO.txt:5-8, the item the PR claims to address, is not edited.

Related work. #418 (merged 6 days earlier) created both the gap (TMLv0 strict grammars, never served) and the Qwen/GLM raw-token precedent this PR extends. #457 (open) rewrites the same function and the same strict TMLv0 grammar on its own branch, still using args.to_string() — overlapping, conflicting, neither superseding. #461 documents the adjacent numeric-precision boundary but leaves unbounded integer properties, #575's case, unrestricted. #191 (draft) first added tml.rs; #312/#304/#305 share the Inkling 2 test file. No issue anywhere reports this defect.

Standing and process. First-time contributor (association NONE; author fordbmorris, commit author "woooflet"), four unrelated PRs opened the same day, none reviewed. #575 has zero comments, reviews or reactions and no CI checks on its head, whereas #457 and #461 both drew CHANGES_REQUESTED autobot reviews within two days. Charter fit is good (root-cause fix, no per-model branch, four-part description); the tension is that qualifications live only in the PR body, which AGENTS.md:57-60/58 directs into docs.

#7 [medium] Recent activity: strict.rs is 6 days old and tml.rs last changed 2026-11-19 by Luke Alonso

#10 [medium] Project fit: aligns with charter goals and evidence rules; docs/TODO.txt item left unedited

#13 [medium] Change: prompt-side TML renderer still re-serializes arguments (frontend/tml.rs:148-174), untested for big ints

Verified detail worth flagging: the TMLv0 reference renderer path re-serializes tool arguments when it replays a previous assistant turn into the prompt — helios/src/frontend/tml.rs:148-174 arguments() parses function["arguments"] through serde_json::from_str::<Json> and rewrites floats with ryu (write_json, :71-117), and its test at :567-573 shows normalization (1.50 → 1.5). So even after #575, a 30-digit integer argument survives the output path but a client echoing that call back in a later turn goes through this encode path; the doc comment at :73 says "call arguments keep request key order and spell floats as 1e20". Whether a >u64 integer survives that round trip is not covered by any test in the diff and not mentioned in the description. This matters for multi-turn tool use, which #575's description claims to validate ("multi-turn tool roundtrips") — but that claim is a live test, not a repository test. Also: the strict wire grammar emits {"name": ..., "args": ...} (strict.rs:873-892 embed_schema_in_tml_wrapper), so the raw text #575 now forwards is the exact text the grammar produced — this is what makes the OutputEncoder validation pass (it validates the same bytes it produced), which is the real correctness argument for the change.

#14 [medium] Community: no comments, reviews or reactions; demand visible only indirectly

#17 [medium] Why: the demand timeline (#417 11-20 → #418 merged 11-22 + TODO entry → #575 11-28)

Timeline of the defect and the demand for it (dates from read_item on each item):

#18 [medium] Coverage: packet leads followed vs. dismissed as not relevant

Orientation-packet leads, each followed or dismissed:

#15 [low] Change: the starts_with('{') object check is untested for spaced "args": {…} payloads

Small implementation notes a reviewer may probe (not a code review, just what the diff implies):