Key findings
- No blocking defect in the changed code.
TmlOutput::call(helios/src/output/tml.rs:329-363) preserves the previous contract exactly in terms of what it accepts, what it rejects, and how it recovers; the raw argument text survives every downstream consumer I could follow (Chat Completions, Responses, streaming, strict validation, truncation). - Should fix (scope of the claim + coverage): the "arbitrary-precision integers preserved end to end" claim holds only for Chat Completions and Responses. The Anthropic Messages encoder still round-trips tool arguments through
serde_json::Value(helios/src/server/protocol/encode.rs:334), so a 30-digit integer is still rounded on that API; the new Python test exercises only/v1/chat/completionsand/v1/responses(tests/server/test_inkling2.py:121-210).strict: trueon Messages is rejected at admission (helios/src/server/protocol/decode.rs:373), so the reported HTTP 500 cannot recur there — the residue is non-strict Messages calls, which is pre-existing and shared with the Qwen/GLM/DSML raw paths. - Nits (2): the emitted text is whitespace-
trim-med rather than byte-verbatim as the description says; duplicate keys insideargsnow pass through to clients byte-for-byte instead of being collapsed last-wins. - Verified-fine areas worth recording for the next reviewer: rejection/fallback semantics, name and recipient-header validation, index allocation, streaming buffering, strict-validator byte identity, truncation behaviour, and the existing TML golden fixtures.
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):
- Syntax validation is preserved.
serde_json::from_str::<RawCall>parses the whole body, and deserialising a&RawValuevalidates thatargsis well-formed JSON (theraw_valuefeature is enabled: helios/Cargo.toml:52). - Object check preserved. After
.trim(),starts_with('{')is equivalent to the removedis_object()for any text that already parsed as a JSON value. - Non-string
namestill rejected (Stringfield), as before (as_str()?). - Unknown wrapper keys still rejected, now via
deny_unknown_fieldsinstead ofobject.len() != 2. - Tool registration / header voting unchanged in meaning: same
tools[].function.namemembership test and sameself.namerecipient-header comparison. - All rejections still fall back to visible text:
call()returnsNone, andcall_or_text(tml.rs:317-327) pushes the span and emitsEvent::Content(body)— the prior TMLv0 recovery semantics.
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)
- Chat accumulator: appends argument text into a JSON string (
helios/src/server/output.rs:83-87), only parses atToolEndto assertis_object(output.rs:113-120), and re-emits the string verbatim (output.rs:140). Responses path mirrors this (output.rs:1371-1414). - Encoders: Chat
tool_calls.function.argumentsand the Responsesfunction_call.argumentscome fromarguments.as_str()(helios/src/server/protocol/encode.rs:313), so the 30-digit integer reaches the client unchanged — matching the new assertions at tests/server/test_inkling2.py:139-141 and :192. - Strict validation sees the same bytes:
Encoder::applyaccumulatesEvent::ToolArgumentstext and validates atToolEnd(encode.rs:517-553), i.e. the exacttrim-med stringTmlOutputproduced, soOutputEncodercan no longer re-serialise and mismatch. The end-to-end Rust test drives exactly this path (grammar::strict::tml_strict_parser_preserves_30_digit_integers, helios/src/grammar/strict.rs diff hunk at +3816). - Truncation: a call body is only published when
cause == Termination::Eos(helios/src/output/tml.rs:377-384), so a call cut by the output limit emits notool_callsand leaves nopending_strict_callsforEncoder::finishto error on (encode.rs:599-603) — consistent with the newmax_tokens/max_output_tokensassertions (tests/server/test_inkling2.py:154-171, 194-209). - Existing TML golden fixtures compare parsed values, not raw argument text (helios/src/server/request/tml_tests.rs:241, 256), so raw preservation does not break them, including the
2.50 → 2.5case generated at tests/frontend/generate_inkling2_fixtures.py:464-467.
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):
- Add a
/v1/messagescase totest_strict_tml_tool_calls_and_truncation(non-strict tool,assert big in json.dumps(tool_use["input"])or equivalent) and, if it fails, either enablearbitrary_precisionfor the Messages encoder or emit the raw arguments text; or - 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
- Whether the Messages rounding can be observed by the new qualification: it needs a live
/v1/messagesrun with a non-strict TML tool whose schema allows large integers. Only a test can settle it; the code path (encode.rs:334 withserde_jsonlackingarbitrary_precision) makes the rounding certain today. - The project's testing rules (docs/design-review.md testing hierarchy) ask for tests at real entry points; the added Rust tests do go through
OutputPipeline+ the compiled strict grammar rather than a synthetic harness, which I judge compliant, but I did not re-read the whole document in this pass.