Correctness report · NVIDIA/hyperflare-inference #575

Raw Markdown for agents: https://autobot.eidonix.com/p/38a360d8-f98f-475c-9464-5eca04edd5eb.md

Key findings


1. Changed function in context — no defect

helios/src/output/tml.rs:329-363:

#[derive(Deserialize)]
#[serde(deny_unknown_fields)]
struct RawCall<'a> { name: String, #[serde(borrow)] args: &'a RawValue }

let parsed: RawCall<'_> = serde_json::from_str(body).ok()?;
let args = parsed.args.get().trim();
if !args.starts_with('{') || !self.tools.iter().any(|t| t["function"]["name"] == parsed.name)
    || self.name.as_ref().is_some_and(|header| header != &parsed.name) { return None; }

Equivalence with the removed code (value.as_object()?, object.get("name")?.as_str()?, object.get("args").filter(|v| v.is_object())?, object.len() != 2):

Duplicate wrapper keys are now rejected where serde_json::Value previously collapsed them last-wins; the new unit test pins this (helios/src/output/tml.rs:619-628), and since constrained decoding cannot emit duplicate wrapper keys under a strict grammar this is a tightening, not a compatibility break.

2. Downstream consumers keep the raw text (verified)

3. Should fix — the Messages API is outside the claimed guarantee

File/line: helios/src/server/protocol/encode.rs:334 (with helios/Cargo.toml:52; tests/server/test_inkling2.py:121-210; docs/api.md:588-628).

What is wrong: anthropic_block builds tool_use.input with serde_json::from_str::<Value>(arguments).unwrap_or(json!({})). serde_json for helios is built with features = ["preserve_order", "float_roundtrip", "raw_value"] — not arbitrary_precision — so 123456789012345678901234567890 becomes 1.2345678901234568e29 in input. The same round-trip affects the Responses custom-tool path at encode.rs:299-303 and encode.rs:408.

Why it matters: the PR description and evidence present the fix as "preserve arbitrary-precision integers … from constrained decoding through TmlOutput and OutputEncoder validation". That is true for Chat Completions and Responses, and the new Python test covers exactly those two (test_inkling2.py:121-210). It is not true for /v1/messages. Scoping matters here: strict: true on Messages tools is rejected at admission (helios/src/server/protocol/decode.rs:373, "strict tool schemas are supported only on Chat Completions and Responses function tools"; documented at docs/api.md:634-635), so the original HTTP 500 cannot recur on Messages. What remains is that non-strict Messages tool calls served by a TMLv0 core still round >64-bit integers, unchanged by this PR and shared with the Qwen/GLM/DSML raw-argument parsers. The gap is one of claim precision, coverage and documentation rather than a regression.

Fix (either):

  1. Add a /v1/messages case to test_strict_tml_tool_calls_and_truncation (non-strict tool, assert big in json.dumps(tool_use["input"]) or equivalent) and, if it fails, either enable arbitrary_precision for the Messages encoder or emit the raw arguments text; or
  2. State the limitation explicitly in the PR description and in docs/api.md:588-628 (the strict-tool section currently says nothing about numeric precision on the way out).

4. Nit — arguments are trimmed, not byte-verbatim

File/line: helios/src/output/tml.rs:339 (let args = parsed.args.get().trim();, emitted at tml.rs:359).

What is wrong / why it matters: the description claims "verbatim" / "exact JSON argument text"; any leading or trailing whitespace inside the wrapper's args value is dropped. Harmless in practice — the result is still valid JSON and the strict validator is fed the same trimmed bytes (encode.rs:523-553) — but the description overstates it. Fix: say "whitespace-trimmed raw text" in the description.

5. Nit — duplicate keys inside args now reach clients

File/line: helios/src/output/tml.rs:339-359, versus helios/src/output/dsml.rs:386-414 and docs/api.md:449-452.

What is wrong / why it matters: previously serde_json::Value collapsed duplicate keys last-wins; now {"a":1,"a":2} is passed through byte-for-byte. Strict grammars forbid duplicates, so the strict path is unaffected, but a non-strict TML invocation can now surface a duplicate-key object to the client, whereas the DeepSeek DSML parser rejects non-unique argument names. Fix: either document the difference or add DSML's unique-key check to the TML path.

Open questions / what I could not settle from code alone