Review of PR #457 — lens C: conventions and duplication
Reviewed at head aacbca1 against main (b9cac83). I read the charter, AGENTS.md (contribution scope and rejection criteria, required prose review), docs/design-review.md, .agents/skills/repo-prose/SKILL.md (not opened), then each changed construct in its surrounding code: TmlOutput's state machine and finish() (helios/src/output/tml.rs), compile_content_headers beside compile_recipient (helios/src/grammar.rs), compile_strict_tml beside its tools: rule (helios/src/grammar/strict.rs), and the sibling parsers recipient.rs, xtml.rs, dsml.rs, tagged.rs. Nothing in this lens rises to blocking.
Key findings
- The PR ships a second copy of a test it already has.
inkling_stress_untyped_closed_header_must_surface_failure(helios/src/server/request/tml_tests.rs:395-439) sends byte-for-byte the same token sequence asa_model_frame_without_a_content_kind_reports_a_failed_response(tml_tests.rs:248-282), added in the same PR, and asserts a subset of the same events. The description presents both as distinct regression coverage and credits the second to a contributor; it establishes nothing the first does not. This is the one finding I would hold the PR on. - The description's "align with TmlOutput" framing overstates what the grammar tests pin down. The new grammar tests assert acceptance of wire strings, but the same refactor copies a wire-splitting helper a third time instead of reusing the existing one — see below.
- The two functional grammar changes (
tool_unnamed, preamble-then-tools ending) follow the file-local idioms already present for XTML and for named tools; I found no convention departure in the production code. - The rest of the diff (state enum, EOS-time failure, encoding of
Emitted) matches existing precedent in the same files; details in "Checked and clean".
Conventions and duplication
1. Should fix — duplicated ignored test adds no coverage
helios/src/server/request/tml_tests.rs:395-439, versus helios/src/server/request/tml_tests.rs:248-282.
The request is the same (Protocol::Responses, input "Inspect the branch.", one bash function tool); the only difference is the explicit "tool_choice":"auto" at tml_tests.rs:403, which is the default the first test already gets. The token stream is identical:
- first test:
[200001, 200008]+encode("Inspect the branch.")+[END_MESSAGE, 200001]+[33131, 1, 70469, 1, 25, 1, 3960, 150309, 12, 68206, 155417, 152664, 1, 92, 92]+[END_MESSAGE, 200006](tml_tests.rs:265-270); - second test:
[200001, 200008]+ the same encode +[END_MESSAGE]+[200001, 33131, 1, …, 92, 92, END_MESSAGE, 200006](tml_tests.rs:418-424).
The asserted properties are the same response.failed / status: "failed" pair (tml_tests.rs:437-438 versus :278-279); the first test additionally checks error.code == "server_error" and the message substring (:280-281), so the second's assertions are a strict subset.
Why it matters: AGENTS.md:189-194 requires tests that exercise the affected behavior and "each PR focused on one coherent outcome"; AGENTS.md:183-188 rejects churn. Both tests are #[ignore]d on FLARE_INKLING2_TEST_SNAPSHOT (tml_tests.rs:247, :394) and are run with --ignored --test-threads=1, so the duplicate also pays a second snapshot load for no additional signal. The PR description's "Supporting Evidence" lists both as separate passing checks, which makes the suite look broader than it is.
Fix: delete inkling_stress_untyped_closed_header_must_surface_failure; if the tool_choice: "auto" variant is meant to be covered, add it as a second request inside the first test's body rather than as a new ignored test. Nothing about the captured 18-token suffix (tml_tests.rs:421-424) is lost — it is the same suffix as tml_tests.rs:268-270.
Aside, same family: the two new #[ignore] messages read "with an Inkling 2 tokenizer" (tml_tests.rs:394, :442) while every other ignored test in the file reads "with the Inkling 2 tokenizer" (:103, :161, :247, :285, :302, :351). Fold into the same cleanup.
2. Nit (churn) — a third copy of the wire-to-token splitter in tests
helios/src/grammar/strict.rs:4572-4588.
The encode closure in strict_tml_grammar_allows_unnamed_headers_and_preamble_before_tools is character-for-character the closure at helios/src/grammar/strict.rs:4205-4221 (same filter_map(...).min_by_key(|(at, _, _)| *at) scan, same rest[..at].bytes().map(u32::from) expansion, same control-token push). A functionally identical helper already exists one module over as pieces() at helios/src/server/protocol/tests.rs:2048-2066, and a fourth ad-hoc copy of the same scan sits at helios/src/server/protocol/tests.rs:469.
The setup is copied too: byte_tokenizer_with(&CONTROL_MARKERS) plus the CONTROL_MARKERS.iter().map(|m| (tokenizer.token_to_id(m).unwrap(), (*m).to_owned())) control list at helios/src/grammar/strict.rs:4546-4551 repeats helios/src/grammar/strict.rs:2814-2819 verbatim, and the GrammarCompiler::new(&tokenizer, 320, &[256, 257], &controls) line appears at grammar.rs:1178, grammar.rs:1948 and strict.rs:2819/4551.
Why it matters: the splitter encodes the invariant "control markers become one token each, everything else is bytes" that several suites depend on; a marker-rule change now means editing three copies, and AGENTS.md:183-188 says refactoring must support the requested behavior or remove a defect source — an added copy does the opposite.
Fix: hoist one splitter next to byte_tokenizer_with (helios/src/grammar.rs:936) and call it from strict.rs:4205, strict.rs:4572 and protocol/tests.rs:2048. Optional but cheap: a small compiler_with_controls(&tokenizer) helper beside it.
3. Nit — inkling_stress_ prefix is a label, not a behavior name
helios/src/server/request/tml_tests.rs:395 and :443.
Every other test in the file names the property under test: prompts_match_tml_renderers_token_for_token (:104), message_endpoints_are_prefixes_of_longer_conversations (:162), outputs_match_reference_parses (:286), structured_output_grammars_constrain_frames (:352), a_model_frame_without_a_content_kind_reports_a_failed_response (:248). So do the two new grammar tests (content_headers_grammar_allows_preamble_before_tools, grammar.rs:1932; strict_tml_grammar_allows_unnamed_headers_and_preamble_before_tools, strict.rs:4526), which is why only the request-side pair stands out. stress appears nowhere else among Rust tests in the repository.
Why it matters: .agents/skills/repo-prose/SKILL.md:15-25 (not opened) forbids lifecycle/experiment labels as identities and unexplained identifiers, and AGENTS.md:38-45 makes that skill mandatory for names. A name carrying stress tells a later reader nothing about what must hold.
Fix: untyped_closed_header_must_surface_failure and custom_grammar_allows_preamble_then_tool (the latter also drops the false suggestion that the test is about load or stress).
4. Nit — the new finish() error narrates cause instead of naming the state
helios/src/output/tml.rs:399-401.
The new message is "TML model header closed without a content kind and the turn produced no answer or tool call". Every sibling parser's terminal error names the incomplete state in a few words: "unterminated recipient header" (helios/src/output/recipient.rs:293), "incomplete XTML output envelope" (helios/src/output/xtml.rs:246), "incomplete DeepSeek tool call at end of response" (helios/src/output/dsml.rs:380), format!("incomplete {} tool call", D::NAME) (helios/src/output/tagged.rs:301).
Why it matters: the string is not internal. It reaches clients as the response.failed message through Encoder::failure (helios/src/server/protocol/encode.rs:760), so its wording is user-visible prose, and it is the only one of the family that explains causality rather than the state. repo-prose SKILL.md:13-14 ("describe the system as it exists … do not narrate the journey") and :38-39 point the same way.
Fix: something in family, e.g. "TMLv0 model frame never reached a content kind" or "incomplete TML model frame". Note the two new assertions pin the current wording: helios/src/output/tml.rs:608/:622 (unit tests) and helios/src/server/request/tml_tests.rs:281 assert the substring "without a content kind", so update those three assertions together.
Checked and clean (deliberately not raised)
AnswerState(helios/src/output/tml.rs:78-83) follows the file's existing private-enum pattern used byBody(:46-53) andState(:65-76); it is parser state onTmlOutput, not a per-model flag or opt-in, soAGENTS.md:171-176(no bypass via flags/optional paths) is satisfied.- The EOS-time failure in
finish()(helios/src/output/tml.rs:399-401) has the same shape as every sibling: early return forCancelled/ExecutionError(tml.rs:378-383 mirrorsxtml.rs:236-241), drain, then acause == Termination::Eos-guarded error (recipient.rs:289-294,xtml.rs:242-250,dsml.rs:379-381,tagged.rs:290-302). No new mechanism invented. answer = Emittedinemit()(tml.rs:219) andcall_or_text()(tml.rs:338) sits at the existing visible-content branch rather than adding a new classification branch; incall_or_textit is set before the empty-body early return, consistent with that function's own doc comment (tml.rs:333).tool_unnamedappearing in bothhelios/src/grammar.rs:381-391andhelios/src/grammar/strict.rs:1599-1604is not flagged as duplication: the two compile different backends (plain llguidance Lark versus the strict wrapper schemas built byembed_schema_in_tml_wrapper, strict.rs:873-892), and the namedtool_{index}rules are already duplicated the same way in both (grammar.rs:392-402, strict.rs:1567-1593).payload_any(grammar.rs:386) versuspayload_{index}(grammar.rs:397, strict.rs:1584) is consistent with the existingformat!("payload_{index}")scheme and named like the adjacentanswer/thinking/toolsubgrammar names (grammar.rs:377-379, strict.rs:1552-1563).- The preamble-then-tools ending
(answer ({restart} thinking* tool)* | tools)(grammar.rs:405, strict.rs:1618) copies the shape of the existing XTML ending at grammar.rs:286 (wrapped_answer (ws tool)* | empty_answer ws tools) and oftools:(grammar.rs:404, strict.rs:1609-1610), which already use({restart} thinking* tool)* ({restart} thinking* answer)?. It reuses the file-local idiom rather than introducing one. - The
plan.single_callbranch (strict.rs:1615-1616) mirrors the single_call branch of thetools:rule (strict.rs:1606-1612), so ending and tools rule now agree in both modes. compile_recipient's ending at grammar.rs:354 still reads"(answer | tools)"; that is the ATEM/recipient path served by a different parser (recipient.rs), so leaving it untouched is correct scope, not an inconsistency.- Test names in the two grammar files match their neighbours (
content_headers_grammar_allows_preamble_before_tools, grammar.rs:1932, besideprefixed_dsml_tool_body_preserves_json_and_lark_answer_constraints, grammar.rs:1884;strict_tml_grammar_allows_unnamed_headers_and_preamble_before_tools, strict.rs:4526, besidetml_json_strict_grammar_rebases_root_ref_and_parses_end_to_end, strict.rs:2812).
Open questions / not verified
- Whether the maintainers consider a second, weaker copy of a test a rejection-worthy scope finding or just cleanup —
AGENTS.md:189-194says validation must be meaningful and the PR focused, but does not address redundancy explicitly. A maintainer ruling would settle it. - I did not run the
--ignoredsnapshot suite (noFLARE_INKLING2_TEST_SNAPSHOThere), so my claim that the two tests produce identical token streams rests on reading the code, not on an executed run; running both with--ignored --test-threads=1 server::request::tml_tests::and comparing would confirm it definitively. - The GPU and
agentic_suite.py(not opened) results in the description are outside this lens and were not checked.