Prose review — PR #575 "Preserve raw JSON tool arguments in TmlOutput for strict TMLv0 calls"
Key findings
The description is accurate about the mechanism and the defect it fixes, and it follows the mandatory four-part order (why / what changed / claimed benefit / evidence) that AGENTS.md:72-140 requires. I verified the mechanism claims one by one against the code and they hold (details in "Claims verified true" below). Two prose defects remain, both "should fix", neither blocking:
- The description mislabels a new behaviour as unchanged prior semantics. "Unknown or duplicate wrapper keys fail deserialization and fall back to visible text, matching prior TMLv0 recovery semantics." The duplicate-key half is false: before the change a repeated wrapper key was accepted as a tool call; now it is rejected. That is a user-visible compatibility change and AGENTS.md:88-94 explicitly forbids describing it as if it were preserved.
- The Supporting Evidence section cites test identifiers and a command a reader cannot reproduce.
server::protocol::tests::strictnames no module; the fiveserver::request::tml_testsare all#[ignore]d and cannot pass under the stated command; and the 35/35 live inventory does not say which cases came from the out-of-repo qualification driver versus the much smaller test added in this PR. AGENTS.md:103-112 covers exactly this.
Nothing in the changed comments or the added test prose exceeded its evidence. The Discord: line follows AGENTS.md:142-153 (username woooflet, no leading @).
Should fix
1. helios/src/output/tml.rs:330-347 (behaviour) / PR description, "What Changed", first bullet — duplicate keys are described as prior semantics but are a new rejection
What the description says: "Unknown or duplicate wrapper keys fail deserialization and fall back to visible text, matching prior TMLv0 recovery semantics."
What the code did before (helios/src/output/tml.rs at main, lines 328-341):
fn call(&mut self, body: &str) -> Option<Vec<Event>> {
let value: Value = serde_json::from_str(body).ok()?;
let object = value.as_object()?;
let name = object.get("name")?.as_str()?;
let args = object.get("args").filter(|v| v.is_object())?;
if object.len() != 2
The pre-change path parsed into serde_json::Value, required the map to have exactly two entries, and read name / args out of the map. serde_json's map deserialization keeps the last value of a repeated key, so {"name":"lookup","name":"lookup","args":{}} produced a two-entry map and was accepted as a tool call. The object.len() != 2 guard rejected unknown keys only.
What the code does after (this PR, helios/src/output/tml.rs:330-347): the derived #[serde(deny_unknown_fields)] struct RawCall<'a> { name: String, args: &'a RawValue } rejects a repeated field with serde's "duplicate field" error, so serde_json::from_str(body).ok()? yields None, call_or_text falls through, and the body is emitted as visible content (helios/src/output/tml.rs:318-327).
The PR's own test asserts the new behaviour: helios/src/output/tml.rs:619-628 feeds {"name":"lookup","name":"lookup","args":{}} and asserts the duplicate text surfaces as content (.1, the visible-text field), i.e. the call is refused.
Why it matters: for a TMLv0 core, a model that repeats a wrapper key now yields prose instead of a tool call. Where the request declared a strict tool with require_call, that turns into the "no completed call" failure rather than a call — a real behaviour change for existing cores, and one AGENTS.md:88-94 says must be named as such ("Make the before/after explicit … Identify material numerical, compatibility, and resource-lifetime changes"). AGENTS.md:129-132 additionally forbids assurances that add no technical evidence; "matching prior semantics" is exactly such an assurance, and here it is also wrong. .agents/skills/repo-prose/SKILL.md (not opened):40-43 requires PRs to state the compatibility impact.
Fix: state it as a change, and scope the "prior semantics" claim to the part that is unchanged (unknown keys, and the fall-back-to-visible-text path). Example: "Unknown or duplicate wrapper keys fail deserialization and fall back to visible text. Unknown keys were already rejected by the previous two-entry length check; a repeated key was previously accepted, because the map-based parse kept the last value, and is now rejected." If the rejection of duplicates is not wanted at all, drop deny_unknown_fields and keep the two-entry check — but then the test at tml.rs:619-628 must change too.
2. Supporting Evidence section — three unreproducible items
(a) server::protocol::tests::strict: 2/2 passed names no module. search_code "mod strict" over helios/src returns only helios/src/grammar.rs:20. The two strict protocol tests are plain functions in helios/src/server/protocol/tests.rs: strict_function_tools_decode_and_gate_streaming_and_buffered_output_across_protocols (line 1751) and strict_tool_wires_reach_encoder_only_after_parser_completion (line 2026). A reader cannot map the cited filter onto anything runnable.
(b) server::request::tml_tests::: 5/5 passed against the Inkling 2 checkpoint tokenizer — all five tests in helios/src/server/request/tml_tests.rs carry #[ignore = "requires FLARE_INKLING2_TEST_SNAPSHOT with the Inkling 2 tokenizer"] (lines 103, 161, 247, 264, 313). Under the stated command (cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server) they are reported as ignored, not passed. They only run with --ignored and FLARE_INKLING2_TEST_SNAPSHOT pointing at a snapshot containing tokenizer.json (not opened) (the module docs at tml_tests.rs:9 and the read at line 40 say so). AGENTS.md:103-112 requires that passed-versus-skipped differences be explained so they do not look contradictory, and that reproduction commands identify required inputs directly.
(c) The live 35/35 inventory does not say where it ran from. The only in-repo test added by this PR is tests/server/test_inkling2.py:121-209, gated by FLARE_RUN_CUDA_TESTS=1 and FLARE_INKLING2_TEST_URL (tests/server/test_inkling2.py:23-26) and it asserts far fewer cases than the 35 listed — one buffered Chat Completions call, one streamed, two truncation cases, one Responses call (verified in the diff). The remaining listed coverage (parallel and single-call enforcement, multi-turn roundtrips, mixed strict plus non-strict tools, the six HTTP 400 admissions, nested/recursive $ref, the four 30-digit runs) has no reference at all, so it came from the out-of-repo qualification driver. AGENTS.md:110-112 ("Reproduction commands must identify the required inputs and configuration directly or through a precise reference; placeholder arguments alone do not explain a measurement") and AGENTS.md:194-199 (identify missing inputs and unrun checks).
Fix: name the two protocol test functions (or give a filter such as server::protocol::tests::strict_ that actually matches them), state that the tml_tests were run with --ignored and FLARE_INKLING2_TEST_SNAPSHOT set, and split the live inventory into "tests/server/test_inkling2.py::test_strict_tml_tool_calls_and_truncation" versus "out-of-repo qualification driver (five cases …)" so the reader knows what the repository can reproduce.
Claims verified true (no action)
- "deserializes the wrapper into a
#[serde(deny_unknown_fields)]struct containingname: Stringand#[serde(borrow)] args: &'a serde_json::value::RawValue" —helios/src/output/tml.rs:330-336; import at:23. - "verifies that
parsed.args.get()starts with'{'(JSON object)" —helios/src/output/tml.rs:339-340(trim, thenstarts_with('{')). - "validates the tool name and optional recipient header, and emits
args.to_owned()verbatim" —helios/src/output/tml.rs:341-347(tool-name lookup andself.nameheader check) and:351-360(Event::ToolArguments { text: args.to_owned() }). - The claim that the old path rounded >64-bit integers: the removed code emitted
args.to_string()from aserde_json::Value, andhelios/Cargo.toml:52enablespreserve_order, float_roundtrip, raw_valuebut notarbitrary_precision(the only occurrence of that name in the tree is the new test athelios/src/output/tml.rs:608), so a 30-digit integer round-tripped throughValuebecomes a binary64 float. Consistent with the described failure. - The error string quoted in "Why":
OutputEncodervalidates buffered strict arguments athelios/src/server/protocol/encode.rs:538-541, andhelios/src/grammar.rs:631-653maps subject "strict tool arguments" to the message "{subject} does not match its grammar". The exact string "strict tool arguments does not match its grammar" therefore exists. - "No model core format, Protobuf schema, or re-export is required": the diff touches only
helios/src/output/tml.rs,helios/src/grammar/strict.rs, andtests/server/test_inkling2.py. The Rust test additions are as described:call_preserves_raw_json_arguments_including_arbitrary_precision_integersathelios/src/output/tml.rs:607-629(AC: covers raw args with 30-digit positive and negative integers plus a nested object, and the duplicate-key fallback) andtml_strict_parser_preserves_30_digit_integersathelios/src/grammar/strict.rs:3819-3880+(schema at:3828-3847has top-level,anyOf,$refvia$defs.BigInt, and nested object/array integers, matching the description). - "
grammar::strict::…1ignored DeepSeek checkpoint fixture" matches the tree: the only#[ignore]inhelios/src/grammarisstrict.rs:4448(FLARE_DEEPSEEK_TEST_SNAPSHOT). This one item of the evidence section is correctly disclosed. docs/TODO.txt:5-8is the tracked item, and the PR references it without claiming to close it: the text is still[ ]and says "Close when a served TMLv0 core passes those checks and the result is recorded."Discord: wooofletpresent, no leading@, per AGENTS.md:142-153.- Scope: no per-model branch is added in the runtime (
helios/src/output), consistent with the charter's "Keep the runtime small and model-agnostic" line. - The added test prose in
tests/server/test_inkling2.py:121-209is comment-level and accurate — each comment names the protocol, the transport, and the property asserted, and nothing in it claims more than the assertions check.
Open questions / not verified
- Commit message body. The head commit is
c7fae93b"Preserve raw JSON tool arguments in TmlOutput for strict TMLv0 calls" (subject only as listed in history)..agents/skills/repo-prose/SKILL.md(not opened):40-43 asks commits to state problem, resulting behaviour, technical reason, compatibility impact, and validation; AGENTS.md:29-38 requires the staged-diff andcommit-msghook review. I did not read the commit body, so I cannot say whether it covers the compatibility impact (the duplicate-key change) — if it does not, the same wording fix as finding 1 applies there. Readinggit log -1 --format=%B c7fae93bsettles it. docs/api.md(TMLv0 strict-tool section) says TMLv0 strict tools are accepted but does not state that arguments are returned verbatim. Making the new guarantee a documented contract rather than a PR-only claim would be a follow-up, not a defect in this PR.- The 35/35 live result and the 6/6 HTTP 400 admissions cannot be checked from the repository at all; only a re-run on the stated four-Spark TP4 configuration would confirm them, which is why the fix for finding 2 is disclosure rather than evidence.
Rules applied
AGENTS.md:72-140 (required four-part description, explicit before/after, reproduction inputs, disclose skipped checks), :142-153 (Discord line), :43-70 and :29-38 (prose review and commit review), :512-517 (TODO.txt as the home for follow-ups); docs/design-review.md principle 16 (four-part scheme and explicit transition) and principle 17 (Discord line); .agents/skills/repo-prose/SKILL.md (not opened) (whole file: describe the system as it exists, no changelog, implementation versus qualification, evidence as conditions/measurement/result/conclusion, commits state compatibility impact).