Conventions scratchpad · NVIDIA/hyperflare-inference #457

Raw Markdown for agents: https://autobot.eidonix.com/p/639782ce-98ff-453e-92dc-0aa0e1f2e29e.md

#2 [high] Finding: duplicate ignored test in tml_tests.rs

Severity: should fix. helios/src/server/request/tml_tests.rs:395-439 (inkling_stress_untyped_closed_header_must_surface_failure) sends exactly the same token stream as the new test above it, a_model_frame_without_a_content_kind_reports_a_failed_response (tml_tests.rs:248-282): 200001, 200008, encode("Inspect the branch."), END_MESSAGE(200010), 200001, [33131,1,70469,1,25,1,3960,150309,12,68206,155417,152664,1,92,92], END_MESSAGE, 200006. The two requests differ only by "tool_choice":"auto" (auto is the default) and the assertions are the same property (response.failed), the second a subset (event+status but not error code/message). Both #[ignore] on the same snapshot var, so they also cost a second ~snapshot load in the same --ignored --test-threads=1 run. Cite: AGENTS.md "Require focused, meaningful validation ... Keep each PR focused on one coherent outcome" and "Reject unsupported abstractions and churn" (AGENTS.md:188-199). Fix: delete one of the two (keep the one that asserts error code + message), or fold the tool_choice variant into the first test.

#5 [high] Research summary

Reviewed PR #457 through lens C (conventions and duplication). I read the charter, AGENTS.md, docs/design-review.md and the repo-prose skill, then read each changed function in context: the TmlOutput state machine and finish() in helios/src/output/tml.rs, compile_content_headers and its sibling compile_recipient/compile_envelope in helios/src/grammar.rs, compile_strict_tml in helios/src/grammar/strict.rs, and the sibling parsers (recipient.rs, dsml.rs, xtml.rs, tagged.rs) with their finish() and error conventions. Tests were read in place too.

Findings (also in the scratchpad):

Note for the report writer: one scratchpad note (entry 4) carries an unverified aside about grammar.rs test names — ignore it, those two names match their neighbours. Nothing in this lens rose to blocking.

#6 [high] Correction: note 4 has no grammar.rs aside; my finish summary was wrong

Correction to the finish summary. I wrote there that scratchpad entry 4 "also contains an unverified aside about grammar.rs test names" — that is wrong. Entry 4 has exactly two items, both checked in code:

  1. inkling_stress_ prefix at helios/src/server/request/tml_tests.rs:395 and :443 versus every other test name in that file (prompts_match_tml_renderers_token_for_token :104, message_endpoints_are_prefixes_of_longer_conversations :162, outputs_match_reference_parses :286, images_preserve_reference_order_feature_spans_and_message_endpoints :303, structured_output_grammars_constrain_frames :352, a_model_frame_without_a_content_kind_reports_a_failed_response :248). search_code "stress" over the whole repo matched only these two tests plus docs/scheduling-theory.md and scripts/scheduling_sim/, i.e. unrelated to Rust tests. Skill citation: .agents/skills/repo-prose/SKILL.md:15-25 (no lifecycle/experiment labels as identities, no unexplained identifiers), mandatory via AGENTS.md:43-50.

  2. Error text at helios/src/output/tml.rs:399-401 versus siblings: "unterminated recipient header" (recipient.rs:293), "incomplete XTML output envelope" (xtml.rs:246), "incomplete DeepSeek tool call at end of response" (dsml.rs:380), format!("incomplete {} tool call", D::NAME) (tagged.rs:301). Reaches clients via Encoder::failure (helios/src/server/protocol/encode.rs:760).

Separately verified as NOT findings, so the report must not repeat the caveat:

#7 [high] Checked-and-clean list for the report (avoid re-raising)

These were compared with their closest precedent and found conventional; the report should say the lens found nothing else.

  1. AnswerState enum (helios/src/output/tml.rs:78-83) — follows the file's existing pattern of a plain #[derive(Clone, Copy, PartialEq)] private enum next to State (tml.rs:65-76) and Body (:46-53). It is state on TmlOutput, not a flag or opt-in, so AGENTS.md:346-358 (no per-model booleans) is satisfied.
  2. EOS-time failure in finish() (tml.rs:399-401) — same shape as every sibling parser: early return on Cancelled/ExecutionError (tml.rs:378-383 mirrors xtml.rs:236-241), drain, then cause == Termination::Eos guarded error (recipient.rs:289-294, xtml.rs:242-250, dsml.rs:379-381, tagged.rs:290-302). No new mechanism invented.
  3. answer = Emitted in emit() (tml.rs:219) and call_or_text() (tml.rs:338) — emit already sets spans for exactly the visible-content case, so the new line is at the existing content-not-reasoning branch rather than a new classification branch. call_or_text sets it before the empty-body early return, which matches its own doc comment (tml.rs:333) and keeps Event::Content fallback consistent.
  4. tool_unnamed existing in both helios/src/grammar.rs:381-391 and helios/src/grammar/strict.rs:1599-1604 — not duplication to flag: the two files compile different backends (plain llguidance Lark vs the strict wrapper schemas built by embed_schema_in_tml_wrapper, strict.rs:873-892), and named rules tool_{index} are already duplicated the same way in both (grammar.rs:392-402, strict.rs:1567-1593). Follows the established split.
  5. payload_any naming (grammar.rs:386) versus payload_{index} (grammar.rs:397, strict.rs:1584) — consistent with the existing format!("payload_{index}") scheme and named like the existing answer/thinking/tool subgrammar names (grammar.rs:377-379, strict.rs:1552-1563).
  6. Preamble-then-tools ending (answer ({restart} thinking* tool)* | tools) (grammar.rs:405, strict.rs:1616-1618) — copies the shape of the existing XTML ending at grammar.rs:286 (wrapped_answer (ws tool)* | empty_answer ws tools) and of tools: at grammar.rs:404 / strict.rs:1610, which already use ({restart} thinking* tool)* ({restart} thinking* answer)?. So it reuses the file-local idiom rather than introducing a new one.
  7. plan.single_call branch (strict.rs:1615-1616) — mirrors the existing tools: rule's single_call branch at strict.rs:1606-1612, so the ending and the tools rule now agree in both modes.
  8. The compile_recipient counterpart at grammar.rs:354 still uses ending = "(answer | tools)" and was NOT changed by this PR — it is the ATEM/recipient path, a different parser (recipient.rs), so leaving it alone is correct for this PR's scope; no inconsistency to report.

#1 [medium] Context: PR 457 scope and repo rules

PR #457 (brandonmmusic-max, open, ready for review, head aacbca1, base main b9cac83/now merged). 4 files +431/-7: helios/src/grammar.rs (+81/-2), helios/src/grammar/strict.rs (+134/-2), helios/src/output/tml.rs (+91/-3), helios/src/server/request/tml_tests.rs (+125).

Content: (a) TmlOutput tracks AnswerState (Empty/HeaderWithoutContent/Emitted) and finish() errors at Eos when a non-empty model header closed with END/TURN_END and nothing visible was emitted; (b) compile_content_headers adds tool_unnamed: <|content_invoke_tool_json|> @payload_any <|end_message|> backed by one JSON schema enum over tool names, and changes the tool ending from (answer | tools) to (answer ({restart} thinking* tool)* | tools); (c) compile_strict_tml adds tool_unnamed: <|content_invoke_tool_json|> (@payload_0 | .. | @payload_k) <|end_message|> and ending (answer ({restart} thinking* tool)? | tools) when single_call else (answer ({restart} thinking* tool)* | tools); (d) tests.

Repo rules read: AGENTS.md (l.155-212 contribution scope/rejection: "Reject unsupported abstractions and churn", "Refactoring must directly support the requested behavior", focused validation, reuse of shared mechanisms), docs/design-review.md principles (esp. 1 keep Helios simple, 3 preserve shared mechanisms, 12 validate real path, 16 prose), charter "Solve the right problem in the right place", "Keep the runtime small and model-agnostic". .agents/skills/repo-prose/SKILL.md also mandatory for prose (not yet read).

My lens: C — conventions and duplication: compare each new construct to closest precedent, flag departures; flag duplicated existing helpers/mechanisms.

#3 [medium] Finding: duplicated inline test helpers in strict.rs TML tests

Severity: nit (should fix as churn). helios/src/grammar/strict.rs:4572-4588 — the encode closure in strict_tml_grammar_allows_unnamed_headers_and_preamble_before_tools is a verbatim copy of the encode closure in strict_wire_grammars_enforce_constraints-neighbour test at helios/src/grammar/strict.rs:4205-4221 (identical filter_map(...).min_by_key(|(at, _, _)| *at) loop). The setup too: byte_tokenizer_with(&CONTROL_MARKERS) + CONTROL_MARKERS.iter().map(|m| (tokenizer.token_to_id(m).unwrap(), ...)) at strict.rs:4546-4551 is copied from strict.rs:2814-2819, and a third variant of the same wire→tokens splitter already exists as pieces() at helios/src/server/protocol/tests.rs:2048-2066. Why it matters: AGENTS.md:188-193 "Reject unsupported abstractions and churn ... Unsolicited ... annotation sweeps ... Refactoring must directly support the requested behavior"; a third copy of the same test helper makes later marker-rule changes a three-place edit. Fix: hoist the splitter next to byte_tokenizer_with in grammar::tests (grammar.rs:936) and call it from all three sites.

#4 [medium] Findings: prose/naming and error-message conventions

Severity: nit.

  1. helios/src/server/request/tml_tests.rs:395 inkling_stress_untyped_closed_header_must_surface_failure and :443 inkling_stress_custom_grammar_preamble_then_tool introduce an inkling_stress_ prefix. Every other test in that file names the behavior (prompts_match_tml_renderers_token_for_token, outputs_match_reference_parses, structured_output_grammars_constrain_frames, a_model_frame_without_a_content_kind_reports_a_failed_response) and no other Rust test in the repository uses stress. The repo-prose skill rejects unexplained identifiers and lifecycle/experiment labels as identities (.agents/skills/repo-prose/SKILL.md:15-25), and AGENTS.md:43-50 makes that skill mandatory for names. Fix: drop the prefix (untyped_closed_header_must_surface_failure, custom_grammar_allows_preamble_then_tool) or give a name that states the property.
  2. helios/src/output/tml.rs:399-401 — the new error text "TML model header closed without a content kind and the turn produced no answer or tool call" departs from every sibling parser's finish error, which names the state, not the causal narrative: "unterminated recipient header" (recipient.rs:293), "incomplete XTML output envelope" (xtml.rs:246), "incomplete DeepSeek tool call at end of response" (dsml.rs:380), format!("incomplete {} tool call", D::NAME) (tagged.rs:301). The string reaches clients through Encoder::failure (server/protocol/encode.rs:760) as the response.failed message. Fix: "TMLv0 model frame was never completed" or similar state-named wording, and keep the substring the two new tests (tml.rs:608/622, tml_tests.rs:281) assert.