#1 [high] Verified diff/baseline facts for #575 (TML raw args)
Head (pr/575, a0d9065) helios/src/output/tml.rs:342-376:
fn call(&mut self, body: &str) -> Option<Vec<Event>> {
#[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('{') || ... { return None; }
...
Event::ToolArguments { index, text: args.to_owned() },
main helios/src/output/tml.rs:341-369: let value: Value = serde_json::from_str(body).ok()?; … args.to_string() at :365, object.len() != 2 at :346, v.is_object() filter at :345.
Feature flags: helios/Cargo.toml:52 serde_json has "preserve_order","float_roundtrip","raw_value" (raw_value + preserve_order pre-existing).
Downstream consumers of the text:
helios/src/server/output.rs:148(Chat Accumulator, ToolEnd):serde_json::from_str(&call.arguments)->ExecutionError::State("tool arguments are not valid JSON").helios/src/server/output.rs:1823(Responses blocks, ToolEnd):serde_json::from_str(arguments).map_err(|e| format!("invalid tool arguments: {e}"))?.helios/src/server/protocol/encode.rs:539-541strict:self.strict_validators.get(&name)...?.validate(&arguments)?(TextGrammar,helios/src/grammar.rs:632-657).helios/src/server/protocol/encode.rs:334(Messages):serde_json::from_str::<Value>(arguments).unwrap_or(json!({}))— still round-trips through Value (precision loss remains; Messages strict is 400 per docs/api.md:664 so out of scope).
Errors from generation propagate as HTTP 500: helios/src/server/http.rs:638 Delivery::Failed(e,_) => rejection(...), :642-646 error(INTERNAL_SERVER_ERROR).
Tests added: tml.rs:620-642 (unit, run(...) at RecipientFrame; asserts parsed.2 == vec![("lookup", args)] and duplicate-key payload stays visible text). strict.rs:3819-3924 tml_strict_parser_preserves_30_digit_integers (pipeline-level via compile_presented_strict_tools + OutputPipeline, then validator.validate(&raw_args).unwrap() and raw_args.matches(big).count() == 5; 5 occurrences = top, via_any, via_ref, nested.id, arr[0] — arithmetic checks out). Sibling test qwen_and_glm_strict_parsers_preserve_30_digit_integers at strict.rs:3723-3817 pre-exists.
#2 [high] Behaviour change not limited to strict; docs/api.md not updated
FINDING A (Major, contract/doc): the PR changes the emitted arguments bytes for all TMLv0 calls, not just strict, but docs/api.md:614-631 is untouched.
Head code helios/src/output/tml.rs:352-372:
let args = parsed.args.get().trim();
if !args.starts_with('{') || ... { return None; }
...
Event::ToolArguments { index, text: args.to_owned() },
main helios/src/output/tml.rs:365: text: args.to_string() (Value tree → compact re-serialization).
So on main, interior whitespace/escapes were normalized ({"a": 1} → {"a":1}, \u0041 → A) and numbers went through f64. At head, arbitrary whitespace, escapes, and number spelling are forwarded verbatim, and duplicate wrapper keys are rejected (deny_unknown_fields at tml.rs:343-344) so such calls degrade to visible text instead of a tool call.
Only .trim() remains (tml.rs:352), so {"args":{ "a" : 1 }} reaches the client with interior spaces. Docs docs/api.md:614-631 say nothing about raw-args forwarding, verbatim whitespace, or the duplicate-key fallback; AGENTS.md:52-60 requires designed behaviour to be stated. The PR's own description lists this only under "Caveats". No test asserts the new non-strict behaviour (the added unit test tml.rs:620-642 is all strict-adjacent / wrapper-level).
Fix: document the raw-argument contract in docs/api.md (TMLv0 forwards generated argument bytes verbatim; only outer whitespace is trimmed; a wrapper with duplicate or extra keys is shown as text), or restrict verbatim forwarding to strict calls and keep the old canonicalization for non-strict.
#3 [high] Residual precision loss on the prompt side (frontend/tml.rs:149)
FINDING B (Minor, correctness gap): the fix is output-only; the prompt-side mirror still round-trips arguments through Value, so a >64-bit integer emitted by this fix is re-serialized (and shrunk to binary64) as soon as the client echoes the assistant turn back.
helios/src/frontend/tml.rs:149-174:
fn arguments(name: &str, value: &Json) -> Result<String> {
let parsed;
let object = match value {
Json::String(text) => {
parsed = serde_json::from_str::<Json>(text)
called from helios/src/frontend/tml.rs:488-494:
for call in tool_calls {
let function = &call["function"];
...
let body = arguments(name, &function["arguments"])?;
prompt.frame(prompt.tokens.model, name, prompt.tokens.invoke, &body)?;
write_json at frontend/tml.rs:75-88 prints f64 numbers with ryu, so a 30-digit id that the server now forwards verbatim becomes 1.2345678901234568e29 in the next request's prompt. The agentic loop this feature targets (Chat/Responses tool call, client sends the call back with the tool result) therefore silently loses the precision the PR just preserved.
Fix: parse-and-re-emit only the outer wrapper in arguments() (or use RawValue for the argument string as TmlOutput::call now does) so the argument bytes survive prompt rendering verbatim, and add a round-trip test (server emits 30-digit → re-render as assistant history → token text contains all 30 digits).
#5 [high] Tests & claim accuracy: coverage gaps and unverifiable claims
FINDING D (Minor, tests/claims).
- Duplicate-key and non-strict paths have no pipeline-level coverage for the behaviour the PR advertises.
helios/src/output/tml.rs:632-641only asserts the duplicate wrapper becomes visible text via therun()helper:
let duplicate = r#"{"name":"lookup","name":"lookup","args":{}}"#;
assert_eq!(run(OutputStart::RecipientFrame,
&[MODEL, "lookup", JSON_CALL, duplicate, END], Termination::Eos,).1, duplicate);
Nothing asserts the whitespace/escape/number-spelling verbatim forwarding for non-strict calls, which is the wider behavioural change (Finding A).
- The Python integration test compares property order (
tests/server/test_inkling2.py:140-141):
parsed = json.loads(call["function"]["arguments"])
assert list(parsed.keys()) == ["big_id", "city"] and parsed["city"] == "Paris"
That assertion cannot distinguish old from new code: helios/Cargo.toml:52 already enables preserve_order + float_roundtrip, so main's args.to_string() (main helios/src/output/tml.rs:365) preserved key order too. Only the big in ... assertions exercise the fix. (Consistent with the Dossier's nit 5; confirmed here against Cargo.toml.)
-
The test module is skipped unless
FLARE_RUN_CUDA_TESTS=1andFLARE_INKLING2_TEST_URLare set (tests/server/test_inkling2.py:23-26), so the newtest_strict_tml_tool_calls_and_truncation(:121-211) never runs in the in-repo CPU workflow; the "35/35 live" claim is unverifiable from the repository. It also re-fetches/v1/models(:122) instead of using the moduleservicefixture (:29-38). -
Rust test counts in the author comment check out against the tree (7
#[test]in tml.rs, 28 in grammar::strict with 1#[ignore]atstrict.rs:4447-4448), and the strict.rs test'sraw_args.matches(big).count() == 5(:3914-3921) matches the fivebigleaves in its payload. The runs themselves were not observed here. -
docs/TODO.txt entry for this exact qualification (
docs/TODO.txt:5-8) is still[ ]at head; AGENTS.md:58 and AGENTS.md:517-519 say to update or remove entries as work completes. The entry says "Close when a served TMLv0 core passes those checks and the result is recorded" — it is not recorded in-repo, so leaving it open is defensible, but the PR should say so rather than leave reviewer ambiguity.
#7 [high] Research summary
Reviewed PR #575 at head a0d9065 for correctness, contracts, and system-level consequences. Findings are in scratchpad notes 1-6.
The core fix is sound and in the right layer: TmlOutput::call (helios/src/output/tml.rs:342-376) now borrows &RawValue instead of building a Value tree and calling to_string(), which is what destroyed >u64 integers on main (main tml.rs:342-365). Concurrency, memory, bounds, cross-platform parity, and metric spans are all clean — no shared state, one fewer allocation, pre-existing 1 MiB/8 MiB bounds untouched, raw_value already unconditionally enabled, no instrumentation touched. Other parsers are unaffected.
Four issues worth reporting, one Major: (A) the verbatim-args behaviour change applies to all TMLv0 calls, not just strict, and docs/api.md:614-631 was not updated for raw forwarding, whitespace/escape preservation, or the new duplicate-wrapper-key → visible-text fallback; no test asserts the non-strict behaviour either. (B) The fix is output-only: helios/src/frontend/tml.rs:149-174 still round-trips echoed tool arguments through Value, so the 30-digit id the server now preserves is shrunk to binary64 in the next request's prompt — the agentic loop the feature targets still loses it. (C) Raw bytes now reach three downstream re-parsers (server/output.rs:148, :1823, protocol/encode.rs:539) that still surface as HTTP 500 via server.rs:735; a cheap round-trip guard in call() would keep main's fallback-to-text safety. (D) Test/claim gaps: the property-order assertion cannot distinguish old from new code, the Python integration test is skipped without live-service env vars, and the docs/TODO.txt:5-8 entry remains open. Note the only review on the PR is a stale pre-rebase autobot verdict with zero human reviews.
#8 [high] Consolidated verdict, severities and citations for #575
Bottom line for #575 (Correctness, Contracts & System-Level Consequences lens)
Verdict: the fix is correct and belongs where it is; the gaps are contract/documentation and prompt-side symmetry, not defects in the change itself. No Blocker. 1 Major, 3 Minor. Details and quotes live in notes 1-6; this note is the index.
| # | Severity | Issue | Primary citation | Scratchpad |
|---|---|---|---|---|
| A | Major | Verbatim args change applies to all TMLv0 calls, not just strict; raw forwarding / whitespace preservation / duplicate-key fallback undocumented, untested for non-strict | helios/src/output/tml.rs:352-372; docs gap at docs/api.md:614-631; rule at AGENTS.md:52-60 |
note 2 |
| B | Minor | Prompt-side mirror still round-trips through Value, so preserved 30-digit ids are shrunk to binary64 on the next turn |
helios/src/frontend/tml.rs:149-174, called at :488-494, f64 print at :75-88 |
note 3 |
| C | Minor | Raw bytes reach downstream re-parsers that still map failures to HTTP 500; suggests a round-trip guard in call() |
helios/src/output/tml.rs:352-353; sinks server/output.rs:148, server/output.rs:1823, protocol/encode.rs:539-541; status server.rs:735 |
note 4 |
| D | Minor | Test/claim gaps: property-order assertion can't distinguish old/new; Python test skipped without live env; TODO entry still open | tests/server/test_inkling2.py:23-26,122,140-141; docs/TODO.txt:5-8 |
note 5 |
Evidence of soundness (say this plainly, per instructions)
Concurrency, lock/queue contention, memory amplification, failure blast radius, stale state, platform parity, metric/pricing spans: all verified clean — see note 6. The change removes an allocation instead of adding one, touches only per-request parser state, and keeps the pre-existing 1 MiB (tml.rs:303-305) and 8 MiB (server/output.rs:119, :1803) bounds.
Context the report must not misstate (from Dossier + verified here)
- The only review is the autobot "Ready To Merge / 0 blockers / 4 nits" of 2026-11-28, written against pre-rebase
c7fae93; it is stale fora0d9065. Zero human reviews. - Sign-off/digest is fixed (
design-review=2e5b); drop any stale-sign-off point entirely. - The bug is still live on
main(mainhelios/src/output/tml.rs:341-369,args.to_string()at:365), so this PR is not superseded. - The author's counts are arithmetically consistent with the tree (7
#[test]in tml.rs, 28 + 1#[ignore]atstrict.rs:4447-4448); the 35/35 live run is unverifiable in-repo.
Concrete fixes to recommend, cheapest first
- In
call(), keep main's all-or-nothing safety: after!args.starts_with('{'), also require the args text to parse as a JSON object, else returnNone(visible text). Closes C without touching the fix. - Change
frontend/tml.rsarguments()to emit the argument string throughRawValueinstead ofValue; adds a round-trip test. Closes B and makes the fix survive a second turn. - Document in
docs/api.mdnext to:614-631: TMLv0 forwards generated argument bytes verbatim, only outer whitespace trimmed, duplicate/extra wrapper keys fall back to visible text. Add one non-strict unit test intml.rsasserting verbatim whitespace/escape forwarding. Closes A. - Strengthen the Python test: drop or replace the order assertion (it passes on
maintoo,helios/Cargo.toml:52haspreserve_order), reuse theservicefixture, and either wire it into CI or state plainly that it is manual. Adjust or annotatedocs/TODO.txt:5-8. Closes D.
#4 [medium] Failure propagation: raw args still funnel into 500s downstream
FINDING C (Minor, new failure mode / blast radius). Raw args are forwarded before downstream code re-parses and re-validates them, and any failure is an HTTP 500 with zero output.
helios/src/output/tml.rs:352-375 now accepts the args block on a one-character test:
let args = parsed.args.get().trim();
if !args.starts_with('{') || !self.tools.iter().any(...) { return None; }
It is no longer guaranteed to be valid JSON: RawValue only validates the wrapper document (and args must itself parse as JSON for the wrapper to parse, so the shape holds), but the content is no longer round-tripped, and deny_unknown_fields (:343-344) means duplicate/extra wrapper keys now silently downgrade a call to visible text — a behaviour change the PR discloses only in its caveats and never tests for non-strict.
Downstream re-parse points that can now see bytes main never produced (main always re-serialized, so they always saw canonical JSON):
helios/src/server/output.rs:148— ChatAccumulator::applyToolEnd:serde_json::from_str(&call.arguments)→ExecutionError::State.helios/src/server/output.rs:1823— Responses blocks ToolEnd:serde_json::from_str(arguments).map_err(|e| format!("invalid tool arguments: {e}"))?.helios/src/server/protocol/encode.rs:539-541— strictTextGrammar::validate(helios/src/grammar.rs:632-657) after buffering. All surface asError::Execution→helios/src/server.rs:735_ => StatusCode::INTERNAL_SERVER_ERROR, i.e. the same 500 class this PR sets out to remove. This is a reduced 500 surface overall (the >u64 case is fixed and Rust-side tests cover it), so it is not a regression to block on, but the PR claims "eliminates HTTP 500 failures on >64-bit integers" without noting that any other noncanonical-but-parseable spelling now depends on the validator/tokenizer accepting the model's exact bytes (grammar.rs:645-647:trie.decode_raw(&tokens) != text.as_bytes()→ "cannot be represented by the tokenizer byte trie").
Fix (cheap): in call(), after !args.starts_with('{'), also require the args text to round-trip as a JSON object (serde_json::from_str::<&RawValue>(args) + starts_with('{')) and otherwise fall back to visible text — which is exactly what main's .ok()? did — so an unparsable block is never handed to code that will 500 on it.
#6 [medium] Areas verified sound (no issues): concurrency, memory, parity, layering
System-level / parity review: no issues found in the areas this lens must check, and I am saying so explicitly rather than inventing one.
Concurrency/contention: TmlOutput::call is per-request, per-generation state (helios/src/output/tml.rs:342-376 touches only self.tools, self.calls, self.name). No shared lock, no channel, no cross-request queue. The parser is still driven one token at a time from the decode loop (server/output.rs Presentation::push), so no change to head-of-line blocking, no new shared bottleneck.
Memory/allocation: the change is net-neutral-to-better. main built a full Value tree for args plus its to_string() (main tml.rs:342-365): two allocations of the argument bytes. Head borrows a &RawValue over body and does one args.to_owned() (tml.rs:371). The pre-existing bounds that gate this path are untouched: 1 MiB tool-call bound at tml.rs:303-305, 8 MiB argument bound at server/output.rs:119 and server/output.rs:1803. No new buffering, retention, or I/O.
Failure blast radius: single-request only (Finding C); no poisoning of coalesced peers, no state retained across finish() — finish still clears buffer/pending and only completes a call at Termination::Eos (tml.rs:378-402).
Stale state across resets/edge flags: unchanged — self.calls increments only on an accepted call (tml.rs:362-363), identical to main; deny_unknown_fields cannot leave partial state because the parse is all-or-nothing before any mutation.
Platform parity: no new platform-conditional code; serde_json raw_value is already enabled unconditionally (helios/Cargo.toml:52), so ARM64/x86 and Unix/Windows build the same path. Perf: no metric, rate, or admission-pricing span changes — no sampling/latency instrumentation appears in the diff, so the metric-span check is N/A.
Gemma/etc. parsers untouched: confirmed by diff scope (3 files) and by helios/src/output/ — other parsers (dsml.rs:386-414, chatml, argument_tags) already did their own raw handling.
Charter/architecture: this is a bug fix in the right layer (the output parser that owns wire formatting), not a per-model branch — TmlJson handling stays inside its own module and grammar/strict.rs only gains a test. No new deps, no new flags. No owner-signoff requirement applies (not a captured-graph op contract). The ready-to-merge autobot verdict is stale (pre-rebase, 2026-11-28) and there are zero human reviews, so this lens's findings should not be read as having been adjudicated.