#1 [high] F1 should-fix: strict.rs tool_unnamed is an N-way payload alternation, contradicting the factored rule used in grammar.rs
helios/src/grammar/strict.rs:1599-1604 (compile_strict_tml):
tool_unnamed: <|content_invoke_tool_json|> (@payload_0 | ... | @payload_k) <|end_message|>
where each @payload_i is a complete JSON wrapper subgrammar (strict schema or default {name const, args object}), pushed at strict.rs:1581-1586 for every active tool (plan.tools, request.rs:225-241,225 — all tools in the request when tool_choice != None).
Why it matters:
- The same PR deliberately avoided exactly this shape in the non-strict path: grammar.rs:381-391 builds ONE factored
payload_anysubgrammar with"name":{"enum":&envelope.tools}because, per the PR description, it avoids "N-way Earley ambiguity across large tool sets". strict.rs does the N-way alternation the description says to avoid: the Earley parser carries every tool's full JSON grammar in parallel until thenameconst is matched, so per-token parse state grows with the number of strict tools. GrammarCompiler limits are fixed (grammar.rs:176-181: max_grammar_size 131_072, max_lexer_states 32_768), and an over-limit grammar fails admission, i.e. the request is rejected rather than degraded. - Existing strict tool tests cover 2 tools (strict.rs:4570-4640). The PR's live strict verification used a single tool (
get_weather). The prompt/tool counts where the non-strict path was measured (178 tools) were not exercised with"strict": true, so the multi-tool unnamed strict path is unmeasured. Fix: make the unnamed rule share one subgrammar, e.g. a single wrapper whosenameis anenumof the active tool names and whoseargsis the per-tool schema selected without enumerating whole grammars (or reject/measure a documented tool-count bound), and add a test at the tool counts the non-strict path claims (tens to ~178 tools). What would settle it: a test compilingtool_unnamedwith the request's real tool count and asserting admission succeeds and per-token advance stays within limits.
#2 [high] F2 should-fix: TML EOS failure keys on header text, not on "nothing emitted"; empty content body still completes silently
helios/src/output/tml.rs:282-288 records AnswerState::HeaderWithoutContent only when a non-empty model header closes on <|end_message|>/<|content_model_end_sampling|> and answer == Empty. helios/src/output/tml.rs:399-401 raises the EOS error only for that state. answer = Emitted is set in two places: tml.rs:219 (inside emit, which returns early at tml.rs:207-209 when visible == 0) and tml.rs:338 (inside call_or_text, which returns early at tml.rs:335-337 when the call body is empty).
Consequence: the same user-visible defect the PR fixes — response.completed with output=[reasoning], status: "completed" — remains reachable whenever the model does emit a content-kind token but no visible bytes:
<|message_model|><|content_thinking|>plan<|end_message|><|message_model|>bash<|content_text|><|end_message|> → Ok, no error.
<|message_model|><|content_thinking|>plan<|end_message|><|message_model|><|content_invoke_tool_json|><|end_message|> → Ok (call_or_text early-returns on the empty body), no error.
Neither is covered by the new tests: tml.rs:642-654 asserts [MODEL, END] (empty header) is Ok, and tml.rs:626-639 only covers non-empty bodies.
Why it matters: the claimed result is "malformed TMLv0 turns whose non-empty model header closes without a content-kind token and without any visible text or tool call fail at EOS". The guard is stated over the header, but the defect condition users hit is "the turn produced no answer at all". A model that drops the header text but keeps the content-kind token reproduces the original symptom.
Fix: base the EOS check on "no answer was emitted for this turn" (set HeaderWithoutContent/a NoAnswer state whenever the turn ends at EOS with answer == Empty, independent of header text, while still exempting the intentional reasoning-only turn that ends without opening an answer frame — note tml.rs:652-653 deliberately accepts [MODEL, THINK, "t", END, TURN_END], so the two cases must be distinguished explicitly, e.g. by recording that an untyped header was seen). Add unit cases for the empty-text and empty-call bodies above. If maintainers consider an empty answer frame legitimate, that intent should be stated in the PR description, because it contradicts "no visible text or tool call".
Related: the events produced by the same drain() are discarded when the error is returned (tml.rs:387 then 399), so anything flushed only at finish time is dropped; harmless today because no event can be emitted from that path without setting Emitted, but worth keeping in mind if the check moves.