Opened by a workflow run, Dec 2, 2026 5:58 AM EST. decide malicious: all_clear (100%): No malicious content found
explore
Author: brandonmmusic-max (GitHub association CONTRIBUTOR; not on the charter's priority-contributor list; Discord "Brandonmusic"). One prior merged PR in the same file (helios/src/output/tagged.rs, #162).
Motivation: OpenAI-compatible Chat Completions clients were losing earlier reasoning turns because Helios only read the reasoning_content field, and were getting HTTP 400 (or silently maximum effort) when they sent effort levels like "none", "minimal" or "medium", which never went through the same resolution Responses and Messages use. Separately, a tagged tool call whose argument value happened to contain the literal outer closing tag (e.g. a grep pattern </tool_call>) split the call and made the whole request fail with HTTP 500.
Scale: +791 / −59 lines in 6 files
Proposal:
- Read the first non-null of
reasoning_content/thinking/reasoningon Chat messages (non-string values now 400). - Normalize Chat top-level
none→enable_thinking:false,minimal→Effort::Minimal,medium→Effort::Highthroughoptions.effort, withholding the raw string from the template; accept nestedreasoning.efforton Chat. - Replace
ToolDialect::parse_candidate'sOptionwith a three-stateCandidate(Complete/InJsonString/IncompleteValue); onlyInJsonStringenters JSON quote-skipping. - Return
IncompleteValuefor open GLM<arg_value>, ChatML<parameter=…>and Gemma<|"|>values during streaming; directparse/parse_eosstill reject. - Add split-boundary and single-character streaming tests for GLM, ChatML/CompactChatML, Gemma and MiniMax, plus two decode tests. Touches:
helios/src/output/tagged.rs(shared streaming parser state machine; also rewritten by open PR #670)helios/src/server/protocol/decode.rs(request decoding for all four protocols)helios/src/output/{argument_tags,chatml,gemma_call,minimax_xml}.rs(per-dialect candidate parsing) Related items:- #670 feat(helios,ignition): parameterize THINK_TAGS reasoning, add TAGGED_JSON tool parser (open): rewrites the same
tagged.rspush/parse_candidateregion; likely textual conflict - #172 [Fix] Document: GLM 5.3 Flash always uses thinking (open): documents the pre-#677 effort behaviour; states named-effort resolution as Responses/Messages-only
- #596 (merged): the
declared_value/strict_nonstring_rawlineage #677 builds on - #573 (merged):
parse_eos/EOS rejection, which #677 preserves verbatim - #133 (closed): GLM tool-parse rejections, explicitly deferred malformed-output parsing as "a separate parser/API concern"
Link: https://github.com/NVIDIA/hyperflare-inference/pull/677
Autobot comments: Three deltas are not in the description: Chat
"medium"on TMLv0 native encoders (Inkling 2) now renders effort 0.9 instead of 0.7 (frontend/tml.rs:18-29vsrequest.rs:518-527);"high"is still forwarded raw, so templates that rejecthigh(Qwen3.8,tests/frontend/qwen38.json:3089-3099) still fail; unknown nestedreasoning.effortrejects while unknown top-level strings still pass through. No docs file is touched althoughdocs/api.md:955-995and:596-628specify both halves and AGENTS.md:230 requires updating it. The two independent fixes are bundled on one branch with zero comments, reviews, labels or CI checks on head; the SM120/BFCL/agentic_suite.py(not opened) evidence has no in-repo harness, core id or log (same gap Autobot flagged on the author's #457), while the new Rust tests are self-contained and do support the behavioural claims.
Value Proposition
Value Proposition — PR #677 (helios): Chat reasoning aliases, effort normalization, literal closing tool tags
Charter alignment
Both halves sit inside the stated goal of supporting "the documented Chat Completions, Completions, Responses, and Messages APIs." The decode half implements "Don't silently ignore API fields… either implement it according to the spec or reject it" — today thinking/reasoning history and nested reasoning.effort are dropped, and none/minimal/medium are forwarded raw into options.template. The output half fixes a parser failure in the shared layer via a general Candidate enum, not per-model branches. No proto, core-format, config, or dependency change; no new model recipe, alias, or format is proposed, so the recipe-ownership rule doesn't apply.
Novelty and status
Not obsolete, not superseded. No merged commit covers either defect; #596/#573/#418/#67 are preserved, not reversed. #670 touches the same tagged.rs/parse_candidate region for contract-supplied delimiters — conflict risk, not coverage. Genuinely additive; the only real issue is merge order with #670.
Value vs cost
Beneficiaries are real: Chat clients echoing reasoning under thinking/reasoning, and GLM/ChatML/Gemma tool-call parsers. The new Rust tests are self-contained and sweep every two-part split and single-character streaming while asserting unterminated values still reject at EOS — solid evidence for the parser half. The SM120/BFCL/agentic_suite.py claims have no harness, core id, command or log in the tree, and the same weakness was flagged on the author's #457.
Costs are not trivial. The decode half is an undeclared behaviour change: Chat medium on TMLv0 moves 0.7→0.9 (frontend/tml.rs:19-27), shifting prompt tokens and therefore prefix-cache keys; high is left unnormalized, so Qwen3.8-style templates still reject it; unknown nested effort errors while unknown top-level does not; two unrelated fixes are bundled; and docs/api.md (:955-995, :539-547, :596-628) is untouched despite AGENTS.md:230, while open docs-only PR #172 still records pre-#677 GLM behaviour.
Required changes
- Update
docs/api.md; reconcile with #172. - Disclose the TMLv0
medium0.7→0.9 shift (or exclude it) and justify leavinghighunnormalized. - Split decode and output into separate PRs.
- Settle merge order with #670 and rebase accordingly.
- Supply a reproducible core id/command/log for the reported HTTP 500.
Verdict
Worth it with changes — the parser fix is a genuine, well-tested bug fix and the decode half closes a documented-API gap, but it should not land as-is given the undocumented effort shift, incomplete high handling, missing docs, and the #670 conflict.
Full report Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.
Classify intake
Selected: triage:review, priority:P2, bug, area:api
Threshold: 65%
Triage
- [✓]
triage:review: 99.8% -
triage:design-review: 0.1% -
triage:partial: 0.0% -
triage:validation: 0.0% -
triage:integration: 0.0% -
triage:investigate: 0.0% -
none: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Priority
- [✓]
priority:P2: 74.1% -
none: 14.6% -
priority:P1: 11.4%
Type
- [✓]
bug: 93.2% -
enhancement: 43.8% -
community: 29.4% -
duplicate: 26.9% -
performance: 24.5% -
documentation: 0.1%
Area
- [✓]
area:api: 98.9% -
area:preparation: 16.5% -
area:engram: 1.8% -
area:selene: 1.8% -
area:memory: 1.4% -
area:orbit: 1.2% -
area:caching: 0.4% -
area:rocenante: 0.4% -
area:scheduling: 0.2% -
area:kernels: 0.2% -
area:packaging: 0.0%
Model
-
model:glm-5.3: 53.1% -
model:inkling-small: 40.7% -
model:deepseek-v4.1: 34.9% -
model:deepseek-v4: 22.3% -
model:gemma4: 14.8% -
model:qwen3.8-27b: 9.5% -
model:qwen3.8-flash-next: 6.8% -
model:kimi-k3.1: 4.7% -
model:mimo-v2.6: 3.3% -
model:muse-glimmer: 2.3% -
model:nemotron-3.5-bolt: 0.6%
Apply Labels (Intake)
Applied: +triage:review, +priority:P2, +bug, +area:api
Subtraction and simplicity
PR #677 is mostly lean; the findings are spare-part removal, not redesign.
- chatml.rs:91-96 + :103 + :168-174 —
allow_incomplete_valuemakes theCandidate::IncompleteValuearm unreachable (bothparse:25 andparse_eos:31 passfalse) and duplicates "unterminated tool parameter value". Drop the 5th parameter;else { return Ok(Candidate::IncompleteValue) }keeps the identical message. - gemma_call.rs:150-159 + :127 — same flag;
parse:175-182 andparse_eos:186-193 already mapIncompleteValueto the same string, so collapse the 10-line match to 4. - argument_tags.rs:85-91 —
eos-conditional Err is redundant withparse_eos:121-128; returnOk(Candidate::IncompleteValue)(only the EOS message changes). Together 1-3 give one rule for three dialects. - decode.rs:590-592 re-implements
present()(:38-40), andnormalized_chat_effortis assigned in three match arms (:613/:617/:622) to be read once at :684; onewithheldbool computed after the match removes both. - Convention: docs/api.md untouched although AGENTS.md:230 requires it; api.md:960-965 scopes named levels to Responses/Messages and :970 renders Chat effort as DeepSeek's numeric score only. Open docs PR #172 describes the pre-#677 behaviour. The one item I would not merge without.
- LOW: chatml.rs:1408-1430 duplicates the push/finish block across
compactalthoughHarness(:412-437) exists; decode.rs:2540-2557 and :2621-2638 closures differ only in the frontend triple.
Clean: the Candidate enum (tagged.rs:31-39) and its 12-line consumer (:336-347), the trait-default parse_candidate (:50-52), MiniMax's 2-line mapping, the single find_map alias lookup (decode.rs:184-193). No dead code, no new knobs or dependencies.
Open: whether the three mode flags had a future consumer (none found); whether the argument_tags EOS message change is acceptable; merge order vs #670, which conflicts in the same region.
Correctness and contracts
Reviewed PR #677's six changed files with their direct callers (request.rs effort ladder, frontend/mod.rs resolve_effort, tml.rs, inference.rs, docs/api.md, AGENTS.md, kani_proofs.rs). No concurrency, contention, or metric-span change exists in the diff; memory retention and EOS rejection semantics are preserved. Four Major and two Minor issues:
- Major — undocumented prompt shift (TMLv0): Chat
reasoning_effort:"medium"now yieldsEffort::Highwith the raw string withheld (decode.rs:621-624, :684-686), and request.rs:521's ladder pickshighfirst, so TMLv0 renders 0.9 instead of 0.7 (tml.rs:19-27, frontend/mod.rs:829-835). Disclosed only for "Jinja templates". - Major — fix incomplete for
"high": nonormalized_chat_efforton that arm (decode.rs:625), sohighstill reaches the template verbatim and still 400s on templates that reject it (tests/frontend/qwen38.json:3089-3099). - Major — quadratic rescan on the output hot path:
Candidate::IncompleteValueloops and re-runsparse_candidate(&self.buffer[..end])from offset 0 per literal inner closer (tagged.rs:306-347, with parsers restarting at the body head: argument_tags.rs:25-27, chatml.rs:105-109), up to K× up to 1 MiB inside the unchanged bound at tagged.rs:303-305. - Major — docs contract unmet: AGENTS.md:230 requires docs/api.md; no docs file in the diff, and docs/api.md:960-965 still scopes named-level resolution to Responses/Messages.
- Minor — aliases read on every role (decode.rs:184-194), so a
toolmessage withthinking/reasoninginjects a stray content-less frame via inference.rs:303-311. - Minor — public API break (
Candidate+parse_candidatesignature, tagged.rs:31-52) colliding with open PR #670's rewrite of the same functions.
Verified sound: main's None really did set in_json_string for every non-Some; EOS still rejects open values in all four dialects; MiniMaxXml's Complete mapping is a no-op (its CLOSE starts with the reserved sentinel); 1 MiB bound and Kani struct fields unchanged.
Open questions: whether the TMLv0 shift is intended; why high was left raw; merge order vs #670; docs follow-up vs #172.
Final review
Recommendation: Changes Requested
Both core problems are real—the three-state Candidate split in helios/src/output/ cleanly fixes literal closing tool tags inside non-JSON argument values without weakening EOS rejection or strict-tool validation, and the Chat Completions alias lookup preserves multi-turn reasoning history across reasoning_content, thinking, and reasoning. However, this PR should not merge as-is: withholding Chat "reasoning_effort": "medium" and mapping it to Effort::High silently shifts TMLv0 (Inkling 2) effort from 0.7 to 0.9 and breaks the existing in-repo golden test prompts_match_tml_renderers_token_for_token (tests/frontend/inkling2_tml.json:318-341). In addition, Candidate::IncompleteValue introduces an O(K·N) full-prefix reparse on the output presentation hot path, "high" remains unnormalized for Qwen3.8-style templates, and docs/api.md is not updated.
Merge Risk
Level: Medium
- Silent prompt/prefix-cache shift and golden-test breakage on TMLv0 (
Inkling 2): Chat requests with"reasoning_effort": "medium"change from0.7to0.9, breakinghelios/src/server/request/tml_tests.rs:104-114(tests/frontend/inkling2_tml.json:318-341) and shifting prompt token IDs and prefix-cache keys on upgrade. - Output presentation hot-path CPU regression:
TaggedTools::push(helios/src/output/tagged.rs:306-348) restartsD::parse_candidatefrom byte 0 on every literal inner closer inside an open value (O(K·N)up to the 1 MiB buffer bound), risking stalls on the Tokio response task for tag-heavy or repetitive tool arguments. No new locks, threads, shared caches, or cross-request failure blast radius are introduced. - Multi-PR collision surface: Open PR #670 (lukealonso) modifies the same
ToolDialect/TaggedTools::push/parse_candidateregion ofhelios/src/output/tagged.rsandargument_tags.rsand addsTaggedJsonimplementingToolDialect::parse_candidate; landing order and rebase must be coordinated.
Walkthrough
helios/src/server/protocol/decode.rs:chat_messages(:184-193) reads the first non-null ofreasoning_content,thinking,reasoningand rejects non-string values naming the offending key.options(:590-638,:677-690) accepts nestedreasoning.efforton Chat Completions when top-levelreasoning_effortis absent or null, normalizes top-level"none","minimal", and"medium"viaenable_thinking: false/options.effortwhile withholding those raw strings fromoptions.template, preserves numeric/unknown top-level passthrough andchat_template_kwargsprecedence, and rejects unsupported nestedreasoning.effortvalues.- Added isolated unit tests (
:2429-2656) exercising realdecode+prepare_inferenceon Jinja andDeepseekV41encoders.
helios/src/output/tagged.rs:- Introduced
pub enum Candidate { Complete(Vec<(String, String)>), InJsonString, IncompleteValue }(:31-39) and updatedToolDialect::parse_candidate(:50-52) to returnResult<Candidate>. - Updated
TaggedTools::push(:336-347) to setself.in_json_string = trueonly onCandidate::InJsonStringand keep scanning past the inner closing tag onCandidate::IncompleteValue, preserving the 1 MiB buffer limit (:303-305) andeos_decision(:257-271).
- Introduced
helios/src/output/{argument_tags.rs,chatml.rs,gemma_call.rs,minimax_xml.rs}:- Updated
ArgumentTags,FunctionTags(ChatMlOutput/CompactChatMlOutput), andGemmaCallto returnCandidate::IncompleteValuefor open argument/parameter/<|"|>-quoted string values during candidate evaluation while retainingparse/parse_eoserrors for unterminated values; adaptedMiniMaxXml(minimax_xml.rs:200-202) toCandidate::Complete(its closer is namespace-prefixed). - Added exhaustive two-part UTF-8 split, single-character streaming, strict-tool, and EOS/non-EOS termination unit tests across all four dialects.
- Updated
Pre-merge Checks
- [PASS] Security / malicious screen: No unsafe code, secret/exfiltration vectors, or prompt-injection paths; malformed/unterminated calls still fail closed at EOS and the 1 MiB parser buffer bound is preserved (
O(K·N)CPU rescan tracked under Should Fix). - [WARN] Charter & value fit: Aligned with documented OpenAI API support and keeping Helios model-agnostic, but bundles two independent fixes in one PR, omits required
docs/api.mdupdates (AGENTS.md:230), and does not disclose the TMLv00.7 → 0.9shift in the PR description (docs/design-review.mdPrinciple 16). - [WARN] Related / duplicate / conflict check: Not a duplicate, but directly conflicts with open PR #670 (
helios/src/output/tagged.rsandargument_tags.rs, plustagged_json.rs(not opened)'sToolDialect::parse_candidatesignature) and interacts with open docs PR #172 (docs/api.mdGLM effort wording). - [WARN] Tests & verification evidence: All new Rust unit tests are isolated, mutate no process-global state, and exercise real production entry points;
helios/src/output/tagged/kani_proofs.rstargets are structurally unchanged. However, the#[ignore]d Inkling 2 golden testprompts_match_tml_renderers_token_for_token(helios/src/server/request/tml_tests.rs:104-114) is broken by this change, and the external SM120/BFCL/agentic_suite.py(not opened) claims have no in-tree harness, core ID, command, or log (agentic_suite/BFCLdo not exist in-repo).
Blockers
- Chat
"reasoning_effort": "medium"silently shifts TMLv0 (Inkling 2) effort from0.7to0.9and breaks the existing golden testprompts_match_tml_renderers_token_for_token- Location:
helios/src/server/protocol/decode.rs:621-624,:684-686;helios/src/server/request.rs:515-527;helios/src/frontend/mod.rs:828-835;helios/src/frontend/tml.rs:19-35,:55-61;helios/src/server/request/tml_tests.rs:104-114;tests/frontend/inkling2_tml.json:318-365. - Verified behavior & impact: Because
decode.rs:621-624maps Chat"medium"toEffort::Highand setsnormalized_chat_effort = true,:684-686withholds"medium"fromoptions.template.request.rs:515-527then resolvesEffort::Highwithcandidates = &["high", "medium"]viaFrontend::resolve_effort. ForPromptEncoder::TmlV0(frontend/mod.rs:829-834),tml::effort_levelaccepts both"high"(0.9) and"medium"(0.7), so"high"wins first and renders0.9instead of0.7. This directly breaks the existing#[ignore]d golden testprompts_match_tml_renderers_token_for_token(tml_tests.rs:104-114), which feedstests/frontend/inkling2_tml.json:318-341("name": "effort_medium", Chat"reasoning_effort": "medium") throughProtocol::Chatand asserts token-for-token equality witheffort = 0.7(token22, vseffort_high0.9token24). It also silently shifts prompt tokens and prefix-cache keys for TMLv0 Chat clients without disclosure (the PR description scopes themedium → highnote to Jinja templates only). - Note on non-fixes: Simply reordering
Effort::Highto&["medium", "high"]does not work—it would breaktests/frontend/inkling2_tml.json:3383-3391(equivalent_requestsasserts Responses{"reasoning": {"effort": "medium"}}maps toeffort_high=0.9) and would regress GLM-5.3 itself, becauseresolve_effort(frontend/mod.rs:853-864) probes Jinja templates only via.render(...).is_ok(), and GLM-5.3's template does not raise on"medium"(it falls back to"max"), soacceptedincludes"medium". - Fix: Preserve native Chat
"medium"on encoders that explicitly define a distinct"medium"level—for example, keep top-level Chat"medium"inoptions.template(or pass it as an advisory effort thatTmlV0resolves to"medium"while encoders without native"medium"resolve to"high"), and add a unit test indecode::native_prompt_testsverifying Chat"reasoning_effort": "medium"throughPromptEncoder::TmlV0produces0.7while Responses{"reasoning": {"effort": "medium"}}still produces0.9. (If maintainers instead explicitly want Chat"medium"to become0.9on TMLv0 as well, updatetests/frontend/generate_inkling2_fixtures.py(not opened) andtests/frontend/inkling2_tml.jsonand disclose the TMLv0 breaking change in the PR description anddocs/api.md.)
- Location:
Should Fix
-
Candidate::IncompleteValueintroduces anO(K·N)full-prefix reparse on the output presentation hot path- Location:
helios/src/output/tagged.rs:303-348,helios/src/output/argument_tags.rs:25-98,helios/src/output/chatml.rs:98-188,helios/src/output/gemma_call.rs:123-167. - Verified behavior & impact: On
main,TaggedTools::pushcalledparse_candidateat most once before switching to linear JSON quote-skipping (in_json_string = true). WithCandidate::IncompleteValue => {}, theloopintagged.rs:306-348advancesself.search_frompast each literal closing tag and re-invokesD::parse_candidate(&self.buffer[..end], &self.tools)from byte 0 ofself.bufferon every subsequent inner closing tag. All three dialects restart from the beginning ofbody, re-parsing and re-validating every completed argument and rescanning the entire open value up toendeach time. Within the 1 MiB buffer bound (tagged.rs:303-305), an argument containingKoccurrences of a 12-byte</tool_call>(worst caseK ≈ 87,381) triggers triangularO(K·N)scanning (~K·N/2 ≈ 4.5 × 10^10byte inspections, ~45 GB of scanning plus repeated JSON/schema validation) on the Tokio response presentation task—the exact sameO(k·n)rescan pattern flagged on #670. - Fix: Avoid re-running
parse_candidateuntil the currently open value can actually terminate—analogous to howInJsonStringskips directly to the next unescaped"inTaggedTools::push(tagged.rs:307-323). For example, letIncompleteValuecarry or advance to the dialect's value terminator ("</arg_value>"forArgumentTags,"<|\"|>"forGemmaCall, nextparameter_end/parameter_start/</function>forFunctionTags) so scanning an open value isO(N)total across the 1 MiB buffer. If this adds a state field toTaggedTools, updatehelios/src/output/tagged/kani_proofs.rs:100-110and verify withcargo kaniperdocs/design-review.md:221-251.
- Location:
-
Chat
"high"(and"max") are left unnormalized, leaving the same HTTP 400 open on Qwen3.8 templates- Location:
helios/src/server/protocol/decode.rs:625-626,:684-686;helios/src/server/request.rs:515-527;tests/frontend/qwen38.json:3089-3099. - Verified behavior & impact:
decode.rs:625-626maps"high"and"xhigh" | "max"toEffort::High/Effort::Maxwithout settingnormalized_chat_effort, so:687-688still copies them verbatim intooptions.templateandrequest.rs:515skipsfrontend.resolve_effort. While keeping"xhigh"raw is necessary so DeepSeek V4.1 retains score75instead ofmax's100(verified atdecode.rs:2650-2654andhelios/tests/deepseek_requests.rs:460), leaving"high"(and"max") raw causes strict templates like Qwen3.8 (tests/frontend/qwen38.json:3089-3099:"Unexpected reasoning effort high. Supported types are xhigh (default), medium, and low.") to keep returning HTTP 400. Normalizing"high"and"max"throughresolve_effortstill resolves to"high"/"max"on DeepSeek V4/V4.1, GLM-5.3, Kimi K3 (helios/tests/fixtures/templates/kimi3/chat_template.jinja:83-85), and TMLv0, while resolving to"medium"/"xhigh"on Qwen3.8. - Fix: Include
"high"and"max"in Chat normalization (leaving"xhigh"raw so DeepSeek V4.1 preserves75vs100) and add a Qwen-vocabulary (['low', 'medium', 'xhigh']) test case indecode::native_prompt_tests.
- Location:
-
Update
docs/api.mdfor the observable API behavior changes (AGENTS.md:230)- Location:
docs/api.md:539-547,:599-628,:960-995;AGENTS.md:230. - Verified behavior & impact:
AGENTS.md:230requires updating the relevantdocs/api.mdsections when changing API behavior, and no file underdocs/is modified.docs/api.md:960-987currently scopes named effort resolution strictly to Responses and Messages and documents Chatreasoning_effortonly as the DeepSeek numeric score; it does not mention Chat named-level normalization, nestedreasoning.efforton Chat, message-levelthinking/reasoningaliases and their non-string HTTP 400 validation, or that literal outer closing tool tags inside non-JSON argument values remain argument text. Open docs PR #172 also edits this same GLM effort paragraph with pre-#677 behavior. - Fix: Update
docs/api.md:960-995and the tagged tool parsing section (:599-628) in this PR to document the exact shipped behavior, and coordinate wording/merge order with #172.
- Location:
Subtract / Simplify
-
Delete the redundant
allow_incomplete_value/eosincomplete-value mode flags and dead match arms across all three dialects- Locations:
helios/src/output/chatml.rs:91-104,:168-174;helios/src/output/gemma_call.rs:123-128,:150-159,:175-193;helios/src/output/argument_tags.rs:85-91,:111-128. - Detail: In
chatml.rsandgemma_call.rs, non-streaming callers (parseandparse_eos) passallow_incomplete_value = false, so the inner helpers returnErr(...)directly and make theCandidate::IncompleteValuearms inparse_tool(chatml.rs:94) andGemmaCall::{parse,parse_eos}(gemma_call.rs:178,189) completely unreachable while duplicating identical error strings. Deletingallow_incomplete_valuein both files and unconditionally returningOk(Candidate::IncompleteValue)preserves exact behavior and exact error messages. Inargument_tags.rs:85-91,parse_bodysimilarly branches onif eoseven thoughparse(:115) andparse_eos(:124) already mapCandidate::IncompleteValue(making:124'sIncompleteValuearm unreachable; noteeositself is still needed for:32,:41,:44). Always returningOk(Candidate::IncompleteValue)at:86(and mapping it to"unterminated GLM argument value"or"incomplete GLM tool call"inparse_eos) unifies all three dialects onto one rule.
- Locations:
-
Reuse
present()and replace the mutablenormalized_chat_effortflag indecode.rs- Location:
helios/src/server/protocol/decode.rs:38-40,:590-592,:606-629,:684-686. - Detail:
:590-592open-codes!present(body, "reasoning_effort") && present(&body["reasoning"], "effort")despitepresent()already existing at:38-40. Likewise,let mut normalized_chat_effort = false;mutated across three separate match arms can be replaced by a single immutablelet withheld_chat_effort = ...;computed once before the:677loop.
- Location:
Nits
helios/src/server/protocol/decode.rs:184-194: Reasoning aliases are read before theRole::Toolbranch on every message role. Whilereasoning_contentwas already outside the role check onmain, expanding it to generic keys"thinking"and"reasoning"means atoolmessage carrying those keys causeshelios/src/server/inference.rs:303-332,358to flush a stray content-less{"role":"tool","content":"","reasoning_content":...}message before the tool result (which templates like Kimi K3 reject athelios/tests/fixtures/templates/kimi3/chat_template.jinja:42-49), andsystem/developermessages fail atinference.rs:258-261. Consider restricting the alias lookup torole == Role::Assistant.helios/src/output/tagged.rs:31-39: Add#[derive(Debug, PartialEq, Eq)]topub enum Candidateto match sibling enumsOutputStart(:15) andEosDecision(:234).- PR scoping: The Chat decode changes (
0b042e56) and tagged output parser changes (f439f744) are completely independent; splitting them into two PRs would allow the output parser fix to rebase/land alongside #670 without being held up by the effort-normalization contract.
Dropped on verification
- Out-of-tree semver breaking-change warning on
ToolDialect::parse_candidate/Candidate(tagged.rs:31-52): Dropped as low-signal—per the project charter roadmap (#6), the Helios Rust crates are not published yet; the actual merge hazard is the in-repo conflict with open PR #670, tracked under Merge Risk and Pre-merge Checks. - Proposed fix to reorder
Effort::Highto&["medium", "high"]: Dropped as incorrect—verified againsttests/frontend/inkling2_tml.json:3383-3391(Responsesmediummust resolve toeffort_high=0.9) andhelios/src/frontend/mod.rs:853-864(GLM-5.3's template does not raise on"medium", so&["medium", "high"]would send"medium"to GLM and cause it to fall back to"max"). - Asymmetry between rejecting unknown nested
reasoning.effortvs passing through unknown top-levelreasoning_effort(decode.rs:627-628): Dropped as intentional and required—top-level Chatreasoning_effortmust continue reaching native encoders/templates to preserve padded values like" low "(tests/frontend/inkling2_tml.json:759) and encoder-specific validation/error messages (tests/frontend/inkling2_tml.json:3530,helios/tests/deepseek_requests.rs:470-480), whereas nestedreasoning.effortfollows Responses validation. - Minor upstream inaccuracies corrected rather than repeated: Corrected the worst-case scan estimate in
TaggedTools::pushfrom~90 GBto the triangular sumK·N/2 ≈ 45 GB, and corrected theargument_tags.rseosnote (eosstill guards lines:32,:41, and:44, not only strict calls). - Test-scaffolding deduplication (
chatml.rs:1408-1430vsHarness,decode.rs:2540-2638): Dropped as low-signal—chatml.rs:412-437'sHarnessis hardcoded toChatMlOutput(not generic overToolDialect), and thedecode.rsclosures follow the existing style innative_prompt_tests.
Full report Decision to Test: no (100%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.
Classify triage
Selected: triage:review
Threshold: 65%
Triage
- [✓]
triage:review: 100.0% -
triage:design-review: 0.0% -
none: 0.0% -
triage:partial: 0.0% -
triage:integration: 0.0% -
triage:validation: 0.0% -
triage:investigate: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Apply labels
No label changes decide malicious: all_clear (100%): No malicious content found
explore
Author: brandonmmusic-max (CONTRIBUTOR; Discord "Brandonmusic") Motivation: Chat Completions clients send reasoning settings and reasoning history that the server silently dropped or forwarded raw, so models either lost context between turns or ran at the wrong effort (or rejected the request). Separately, a literal tool-closing tag appearing inside an argument made the parser never finish the call, returning HTTP 500. Scale: +1089 / −80 lines in 11 files (was +791 / −59 in 6 files at the previous head) Proposal:
Effort::Mediumadded between Low and High, so Chatmediumkeeps TMLv0's native 0.7 while Responsesmediumstill renders 0.9- Chat
reasoning_effortnow normalized fornone|minimal|low|medium|high|maxagainst the template vocabulary;xhighand numeric scores deliberately pass through (DeepSeek 75 vs 100) - Assistant messages read prior reasoning from
reasoning_content, thenthinking, thenreasoning; nestedreasoning.effortaccepted; non-string values are now a HTTP 400 - New
Candidate::{Complete,InJsonString,IncompleteValue}plusToolDialect::scan_value_endkeeps literal</tool_call>/<tool_call|>inside non-JSON argument values as text, under a linear scan docs/api.mdupdated (+25/−5) for both behaviours; Kani proofs extended with thein_valuefield Touches:helios/src/output/tagged.rs+argument_tags.rs/chatml.rs/gemma_call.rs(not opened) (streaming parser state machine, highest risk)helios/src/frontend/mod.rs(resolve_effortnow probes templates six times with a sentinel render)helios/src/server/protocol/decode.rs(+359 lines; API compatibility surface) Related items:- #670 parameterize THINK_TAGS reasoning, add TAGGED_JSON tool parser (merged): the earlier textual conflict, gone after rebase; #677 now consumes its
JSON_BODY/with_tool_delimiters - #172 docs-only GLM effort records (open): states named-effort resolution as Responses/Messages-only, now stale
- #596 strict tagged arguments (merged): #677 builds on its helpers
- #573 parse_eos and EOS rules (merged): preserved and re-tested
- #133 GLM tool-parse rejections (closed): the parser concern #677 addresses
Link: https://github.com/NVIDIA/hyperflare-inference/pull/677
Autobot comments: All four prior blockers are addressed in-tree with tests, so the PR moves from changes-requested toward mergeable-with-nits. Two things a reviewer should still press: (1)
ToolDialect::scan_value_enddefaults toOk(0)andTaggedTools::pushthen clearsin_valuewithout advancing, an infinite-loop footgun safe only because all threeIncompleteValuedialects override it; (2)resolve_effortdetects fallback-branchmediumby rendering the template with a__flare_unknown_effort__sentinel six times, a heuristic undocumented indocs/api.mdand tested only for raise-on-unknown templates. Still standing: two independent fixes in one PR, no linked issue for either defect, no maintainer review, and unverifiable test counts/Kani-idiom gap. External SM120/BFCL/agentic_suite evidence was removed from the description rather than substantiated.
Classify intake
Selected: triage:review, priority:P2, bug, performance, area:api, model:inkling-small
Threshold: 65%
Triage
- [✓]
triage:review: 99.9% -
triage:design-review: 0.0% -
none: 0.0% -
triage:integration: 0.0% -
triage:investigate: 0.0% -
triage:partial: 0.0% -
triage:validation: 0.0% -
triage:superseded: 0.0% -
triage:verify-for-closure: 0.0%
Priority
- [✓]
priority:P2: 98.2% -
priority:P1: 1.2% -
none: 0.5%
Type
- [✓]
bug: 92.4% - [✓]
performance: 75.5% -
community: 29.4% -
enhancement: 29.4% -
duplicate: 24.5% -
documentation: 0.5%
Area
- [✓]
area:api: 99.0% -
area:preparation: 2.6% -
area:engram: 1.8% -
area:selene: 1.0% -
area:kernels: 0.6% -
area:caching: 0.3% -
area:orbit: 0.2% -
area:memory: 0.2% -
area:rocenante: 0.1% -
area:scheduling: 0.0% -
area:packaging: 0.0%
Model
- [✓]
model:inkling-small: 65.1% -
model:glm-5.3: 43.8% -
model:qwen3.8-27b: 29.4% -
model:qwen3.8-flash-next: 20.2% -
model:deepseek-v4: 14.8% -
model:gemma4: 14.8% -
model:deepseek-v4.1: 10.7% -
model:muse-glimmer: 0.7% -
model:kimi-k3.1: 0.5% -
model:nemotron-3.5-bolt: 0.2% -
model:mimo-v2.6: 0.1%
Apply Labels (Intake)
Applied: +performance, +model:inkling-small
Subtraction and simplicity
Subtraction/Simplicity review of PR #677 (head c897437): the parser half is lean; the effort half carries all the removable complexity.
scan_value_end's trait defaultOk(0)(helios/src/output/tagged.rs:56-63) is speculative generality — only 3 dialects ever emitIncompleteValueand all override it — and wrong:pushtreatsOkas "value ended" (tagged.rs:350-361), so it would spin forever and the 1 MiB bound (tagged.rs:329) can't catch it. Fix: defaultErr(0), or drop the default.- Chat effort normalization duplicates its six-name vocabulary (decode.rs:677-682 vs the match at :613-629) and its
Chat && !chat_nested_effortpredicate four times (:596-598, :622, :627, :677). Collapse to onechat_top_levelbinding and a match returning(native, normalized). Effort::Medium(inference.rs:121-122, ladder request.rs:521) is a shared-enum variant whose only distinguishable consumer isTmlV0, sinceresolve_effortrestricts other encoders to low|high|xhigh|max (frontend/mod.rs:836-841). Expressible by keeping ChatmediumatHighand preferring"medium"for TmlV0 in request.rs.- The
Candidate→Errmapping is hand-copied six times (gemma_call.rs:166-188 twice, argument_tags.rs:107-113 & :124-131, chatml.rs:129-134); oneCandidate::into_callsmethod deletes ~30 lines. - ChatML has two implementations of "where the parameter value ends" (chatml.rs:30-47 vs :197-208); fold into one
find_value_end, and share theparameterprefix ladder behindpossible_parameter_start/_end(chatml.rs:85-119).
Lower priority: ~250 lines of triplicated parser test scaffolding (argument_tags.rs:766-935, chatml.rs:1426-1580, gemma_call.rs:367-469); the PR still bundles two independent defects.
Open: whether Err(0) is the intended no-override semantic; whether the TMLv0 medium preference belongs in request.rs rather than a shared variant; whether the possible_parameter_* duplication is deliberate. Kani/mutants and the stated test counts unverified (not run).
Correctness and contracts
#677 (head c897437) is close to mergeable, but two Major correctness/robustness issues remain in the new code.
Major — scan_value_end fails open. The trait default returns Ok(0) (helios/src/output/tagged.rs:56–63) and push treats Ok as "value ended" and adds nothing (:350–361), so any dialect returning IncompleteValue without overriding it silently reverts to one full body re-parse per inner closing tag (O(N·K)) — no compile error, no test or Kani failure. It is not a hang (:377 always advances), so the dossier's "spins forever" wording should be corrected. Fix: make the method required, or treat advance == 0 as Err.
Major — effort resolution is a sentinel-render heuristic. helios/src/frontend/mod.rs:863–879 drops medium when its render equals the __flare_unknown_effort__ render, so a template clamping unknowns to a medium default loses a level it lists; Effort::Medium then resolves to "high" (request.rs:521). The acting path is untested (the only vocabulary test, frontend/mod.rs:1742–1777, uses raise-on-unknown templates where the filter never fires) and undocumented (docs/api.md:988–991).
Minor — unknown/non-string top-level Chat reasoning_effort is forwarded verbatim (decode.rs:606–607, 627, 677–682) while the nested spelling 400s, contradicting docs/api.md:984–987 and charter #417.
Minor — top-level vs nested medium yields different prompts for the same Chat request on Inkling 2 (decode.rs:622–625, request.rs:521–522).
Minor — truncation inside an open argument value now omits the call silently on OutputLimit/UserStop (tagged.rs:283–296), documented at docs/api.md:636–638 but missing from the PR's compatibility notes.
Tests — no Jinja Effort::Medium test, no unknown top-level effort test, kani_proofs.rs (not opened) not executed, stress tests don't pin asymptotics.
Sound: no wire/graph contract change (inference.rs:117–125, 153), 1 MiB bound and drain discipline intact (tagged.rs:328–331, 397, 416), strict rejection and EOS Reject preserved (:292), six probes run once per Frontend behind OnceLock — no hot-path contention or metric-span change.
Open: startup probe cost; whether to require scan_value_end; docs PR #172 collision.
Re-review
Recommendation: Ready To Merge
All Round 1 blockers, should-fix items, and the #670 rebase conflict are resolved cleanly at head c897437: Chat top-level "medium" preserves TMLv0 (Inkling 2) native 0.7 via Effort::Medium while normalizing across GLM fallback and Qwen3.8 strict templates, non-JSON tagged argument scanning now runs in linear O(N) time via ToolDialect::scan_value_end and TaggedTools::in_value without weakening EOS rejection or the 1 MiB buffer cap, and docs/api.md plus Kani proofs are updated to match. No new correctness, safety, or hot-path regressions were introduced; the remaining items below are optional follow-up cleanups and minor nits.
Merge Risk
Level: Low
- Output parser hot path (
helios/src/output/):TaggedTools::pushretains the 1 MiB buffer bound (helios/src/output/tagged.rs:329-331), preserves strict-tool and EOS rejection (in_valueparticipates inEosDecision::Rejectattagged.rs:292), and scans open non-JSON values monotonically inO(N)with UTF-8 char-boundary safety across all threeIncompleteValuedialects (ArgumentTags,FunctionTags,GemmaCall). No shared state or locks are added. - Request decoding & effort resolution (
helios/src/server/protocol/decode.rs,helios/src/frontend/mod.rs): Template vocabulary probing runs once perFrontendinsideOnceLock::get_or_init(frontend/mod.rs:799, 843), adding zero per-request template renders or contention. TMLv0 Chat"medium"(0.7), Responses"medium"(0.9), and DeepSeek-V4.1"xhigh"(75) vs"max"(100) and numeric scores are preserved without shifting existing prompt contracts. - Cross-PR surface: Cleanly rebased over merged
#670(TaggedJson/JSON_BODY/with_tool_delimiters). Open docs PR#172(already inChanges Requestedwithdocs/api.mdmerge conflicts) will need to align its GLM effort wording when it rebases, which does not block#677.
Walkthrough
helios/src/server/protocol/decode.rs:chat_messages(:184-199) reads the first non-null ofreasoning_content,thinking, orreasoningonRole::Assistantmessages (keeping non-assistant roles onreasoning_contentonly) and returns HTTP 400 naming the offending key for non-string values.options(:596-638,:677-696) accepts nestedreasoning.efforton Chat Completions when top-levelreasoning_effortis absent or null, maps top-level Chat"medium"toEffort::Medium(leaving nested/Responses"medium"onEffort::High), and withholds normalized top-level Chat names (none,minimal,low,medium,high,max) fromoptions.templatewhile preserving passthrough for"xhigh", numeric scores, unknown top-level strings, explicitenable_thinking, andchat_template_kwargs.- Adds isolated unit tests (
:2436-2759) exercising realdecode+prepare_inferenceacross Jinja (GLM fallback & Qwen3.8 strict),TmlV0(Inkling 2), andDeepseekV41.
helios/src/server/inference.rs,helios/src/server/request.rs,helios/src/frontend/mod.rs:- Adds
Effort::Medium(inference.rs:121-122) with candidate ladder&["medium", "high"](request.rs:521). - Updates
Frontend::resolve_effort(frontend/mod.rs:853-880) to probe Jinja templates with sentinel"__flare_unknown_effort__"and exclude fallback-only"medium"when the template renders distinct levels, so GLM-stylelow/highelsemaxtemplates resolveEffort::Mediumto"high".
- Adds
helios/src/output/{tagged.rs,tagged/kani_proofs.rs,argument_tags.rs,chatml.rs,gemma_call.rs,minimax_xml.rs}:- Replaces
Optionwith#[derive(Debug, PartialEq, Eq)] pub enum Candidate { Complete(...), InJsonString, IncompleteValue }(tagged.rs:31-37), addsToolDialect::scan_value_end(tagged.rs:61-63) andTaggedTools::in_value(tagged.rs:241, 292, 350-361, 400, 406, 419), and updatestagged/kani_proofs.rs:99-136to coverin_valueineos_decision. - Implements linear value-end scanners for
ArgumentTags(argument_tags.rs:117-123),FunctionTags(chatml.rs:30-47, 100-119), andGemmaCall(gemma_call.rs:176-181), adaptsMiniMaxXml(minimax_xml.rs:200-202), removes redundant mode flags, and adds split-sweep, single-char streaming, strict-tool, EOS/non-EOS, and 40,000-tag stress tests.
- Replaces
docs/api.md:- Documents literal closing tool tags inside non-JSON argument values (
:621-625) and assistant reasoning aliases, nestedreasoning.effort, Chat named effort normalization, and encoder vocabularies including TMLv00.7vs0.9(:975-995).
- Documents literal closing tool tags inside non-JSON argument values (
Pre-merge Checks
- [PASS] Security / malicious screen: No unsafe code, exfiltration, or prompt-injection vectors; 1 MiB parser buffer bound (
tagged.rs:329-331), strict schema validation, and fail-closed EOS rejection (tagged.rs:292) are preserved, andO(K·N)rescanning is eliminated. - [PASS] Charter & value fit: Aligns with documented OpenAI Chat Completions support, model-agnostic Helios layers (
Effort::Medium+ dialect-genericCandidate/scan_value_end), and requireddocs/api.mdupdates; minor bundling of two fixes remains noted under Nits. - [PASS] Related / duplicate / conflict check: Not a duplicate; cleanly rebased over merged
#670(TaggedJson,JSON_BODY,with_tool_delimiters); open docs PR#172will rebase its GLM effort note onto this. - [WARN] Tests & verification evidence: All new Rust tests are isolated, mutate no global state, and exercise real production entry points (with external unverified GPU/BFCL claims removed from the PR description); warning solely because
cargo-kani/cargo-mutantswere not run on the validation host (honestly disclosed;kani_proofs.rs:99-136verified statically) and test counts rely on CI/author execution.
Blockers
None.
Should Fix
None.
Subtract / Simplify
- Fail-closed default for
ToolDialect::scan_value_end(helios/src/output/tagged.rs:61-63): Every current dialect that emitsCandidate::IncompleteValue(ArgumentTags,FunctionTags,GemmaCall) overridesscan_value_end, whileMiniMaxXmlandTaggedJsonnever emitIncompleteValue. ReturningErr(0)instead ofOk(0)in the trait default keeps non-IncompleteValuedialects untouched while ensuring any futureIncompleteValuedialect fails immediately in its first functional test instead of silently falling back toO(K·N)reparsing. - Deduplicate Chat effort predicate and normalized-name list (
helios/src/server/protocol/decode.rs:596-629, 677-682):protocol == Protocol::Chat && !chat_nested_effortis repeated at:622and:627, and the six withheld level names at:681mirror the match arms at:614-626(excluding"xhigh"). Bindinglet chat_top_level = protocol == Protocol::Chat && !chat_nested_effort;once and returning(native, withhold)from the effort match (with"xhigh"returning(Some(Effort::Max), false)onchat_top_level) removes the duplicated list and prevents future drift. - Share
<parameter-boundary scan in ChatML (helios/src/output/chatml.rs:30-47, 197-208):FunctionTags::scan_value_endandparse_tool_candidatewalktail.match_indices('<')with the sameparameter_end/parameter_start/</function>predicates. Extracting a singlefn find_value_end(tail: &str) -> std::result::Result<(usize, usize), usize>letsscan_value_endbefind_value_end(tail).map(|(end, consumed)| end + consumed)andparse_tool_candidatereuse it directly, eliminating duplicate logic and drift risk. - Optional
Candidate::into_callshelper (helios/src/output/argument_tags.rs:108-112, 125-130,chatml.rs:130-134,gemma_call.rs:167-171, 183-187): Fiveparse/parse_eossites repeat the three-armCandidatematch to convertIncompleteValue/InJsonStringinto errors; a small helper method onCandidatewould trim ~15-20 lines.
Nits
- Sentinel-probe scope in
Frontend::resolve_effort(helios/src/frontend/mod.rs:863-880): No supported Flare model template falls back to"medium"on unknown values, so the heuristic works across all current templates (GLM/Kimielse 'max', Qwen3.8 strict, and effort-agnostic templates). A brief comment noting that a hypotheticallow/medium/hightemplate defaulting unknowns to"medium"would have"medium"excluded by render-equality probing — plus a unit test infrontend/mod.rsalongsideadvisory_effort_uses_the_prepared_templates_vocabulary(:1742-1777) exercising a fallback template — would document this boundary clearly. docs/api.mdprecision (docs/api.md:982-993): Mentioning that (a) non-standard/padded top-level Chatreasoning_effortstrings (like"xhigh"and numeric scores) pass through to the encoder/template, and (b) Chat nestedreasoning.effort: "medium"follows Responses semantics (Effort::High→0.9on TMLv0,"high"before"medium"on Jinja) rather than top-level ChatEffort::Medium(0.7), would make the docs exact on both edge cases.- PR scoping & Kani: The PR still bundles two independent fixes (Chat decode/effort and tagged tool-call parsing); keeping independent fixes in separate PRs simplifies review and bisecting in future work. Running
cargo kanionhelios/src/output/tagged/kani_proofs.rsin an environment with Kani installed is recommended before/during CI merge gating.
Dropped on verification
- Claim that default
scan_value_endreturningOk(0)causes an infinite loop (Discovery Dossier Finding 5 & Subtraction Lens Finding 1): Verified false. Athelios/src/output/tagged.rs:377,self.search_from = prev + consumedadvances past the closing tag beforeparse_candidatereturnsIncompleteValue; on the next iterationOk(0)clearsin_valueand scanning resumes strictly after the skipped closer. Impact for a hypothetical future non-overriding dialect isO(K·N)reparsing, not an infinite loop, and zero current dialects reach the default. - Claim that
Effort::Medium/ the sentinel filter inFrontend::resolve_effortis untested on Jinja (Discovery Dossier Open Question & Correctness Lens Finding 1.2 / §4): Verified false.helios/src/server/protocol/decode.rs:2565-2601directly exercises Chat"medium"(Effort::Medium) through a GLM-style fallback Jinja template where the sentinel filter fires and resolves"medium"→"high", anddecode.rs:2652-2671testsEffort::Mediumthrough a Qwen3.8 strict Jinja template. - Claim that
Effort::Mediumis a single-backend (TmlV0-only) enum variant that should be replaced with aTmlV0branch inrequest.rs(Subtraction Lens Finding 3): Verified false. Any Jinja template accepting both"medium"and"high"also distinguishesEffort::Medium(&["medium", "high"]atrequest.rs:521) fromEffort::High(&["high", "medium"]atrequest.rs:522). KeepingEffort::Mediumin the shared enum is more model-agnostic than hardcoding aPromptEncoder::TmlV0branch inrequest.rs. - Claim that unknown top-level Chat
reasoning_effortpassthrough is a regression or violates charter #417 (Correctness Lens Finding 1.3): Dropped as pre-existing behavior intentionally retained for numeric/padded/native-encoder inputs (DeepSeek, TMLv0, and strict Jinja still reject invalid values with HTTP 400, matchingmain); narrowed to a minor doc-precision nit. - Claim that omitting an unclosed non-JSON argument value on
OutputLimit/UserStop/Cancelled/ExecutionErroris an undisclosed compatibility hazard (Correctness Lens Finding 2.4): Dropped;tagged.rs:283-297aligns with the existing documented contract (docs/api.md:636-638: calls cut off by output limits or stop sequences are never recovered) and is explicitly tested atargument_tags.rs:896-910. - Minor factual corrections to Subtraction Lens Findings 4 & 5: There are 5 (not 6)
Candidatematch sites acrossargument_tags.rs,chatml.rs, andgemma_call.rs; and the suggestedfind_value_endwrapper forchatml.rsmust map(end, consumed)toend + consumed(not justconsumed).
Classify triage
Selected: triage:review
Threshold: 65%
Triage
- [✓]
triage:review: 99.8% -
none: 0.1% -
triage:validation: 0.0% -
triage:design-review: 0.0% -
triage:integration: 0.0% -
triage:investigate: 0.0% -
triage:partial: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Apply labels
No label changes Decision to Test: yes (89%): Testing will add considerable value with the code. It is ready to merge and the tests will validate and improve confidence on hardware we have available for testing.
Pre Test Report
Hardware test plan — PR #677 (fix/helios-glm53-tool-and-reasoning, head c897437)
1. What is being validated
Two independent fixes in one branch:
| Half | Files | Claimed behavior |
|---|---|---|
| Tagged tool-call parsing | helios/src/output/tagged.rs (Candidate{Complete,InJsonString,IncompleteValue} :31-37, ToolDialect::scan_value_end :61-63, TaggedTools::in_value), argument_tags.rs (GLM <arg_value>), chatml.rs (ChatML <parameter=…>, scan_value_end :30-47), gemma_call.rs (`< |
" |
| Chat decode / effort | decode.rs (:181-199 assistant-only reasoning aliases, :593-682 effort), inference.rs:121-122 (not opened) (Effort::Medium), request.rs:521 (&["medium","high"]), frontend/mod.rs:843-880 (sentinel __flare_unknown_effort__ template probe) |
thinking/reasoning aliases on assistant messages (non-string → 400); nested reasoning.effort on Chat; top-level none/minimal/low/medium/high/max normalized against the prepared vocabulary and withheld from options.template; xhigh and numeric scores pass through raw. |
2. Bottom line on GPU spend
Neither half needs a GPU to be validated, and there is no speedup to measure against main.
- On
main, the literal-tag input does not parse at all (the reported HTTP 500). The O(K·N) reparse this PR fixes exists only in the PR's own earlier revision (f439f744). "O(N)" is a hardening property of new code, provable by timing a CPU stress test — an A/B GPU benchmark would measure nothing. - Every behavioral claim already has a CPU-only in-tree test that the author reports passing:
argument_tags.rs:765-934(every two-part UTF-8 split, single-character streaming, strict-tool accept/reject, EOS accept vs reject, all four non-EOS terminations, 40,000-tag ≈480 KiB stress), the same shape atchatml.rs:1557andgemma_call.rs:444,minimax_xml.rs:443-483;helios/src/server/request/tml_tests.rs:102-114prompts_match_tml_renderers_token_for_token(needs only a tokenizer.json (not opened),FLARE_INKLING2_TEST_SNAPSHOT);decode.rs:2436-2759new decode/prepare unit tests;helios/tests/deepseek_requests.rs:453-462(not opened).
So: Phase 0 (CPU) carries the validation. Phase 1 on cn7 (~45 min GPU) confirms the two user-visible changes on real templates. Phase 2 on cn5 (~20 min) is optional.
3. Host → what it can actually test
| Host | Usable for #677? |
|---|---|
| cn7 (1×GB10, arm64, 10 CPU, 60 GiB RAM, 16 GiB scratch) | Primary. Has nvidia/Qwen3.8-27B-NVFP4 (strict low/medium/xhigh template → high/max 400 regression), MiniMaxAI/MiniMax-M3.1-Flash (touched MiniMaxXml), and nvidia/GLM-5.3-Flash-NVFP4 (the <arg_value> headline case + fallback-effort template). One GPU, so serve one core at a time. |
| cn5 (4×RTX PRO 6000, amd64, 48 CPU, 125 GiB RAM) | Optional. Only tool-bearing model is nvidia/GLM-5.3-Flash-NVFP4 (also on cn7). No Qwen, no Gemma, no MiniMax. Use only if the GLM dialect is somehow left unexercised on cn7. |
| Missing everywhere | No Inkling 2 (TMLv0) core and no DeepSeek core on either host. The medium→0.7 (Chat) vs 0.9 (Responses) contract and DeepSeek high=75 vs max=100 are therefore CPU-only checks. State this in the test record — do not imply hardware covered them. |
4. Phase 0 — CPU, no GPU lease (~40 min). Do this first; if it fails, stop.
# 1. pin templates
.venv/bin/python tests/frontend/prepare_templates.py --output "$FLARE_TEST_TEMPLATE_DIR"
# 2. full crate
cargo test --locked --release --manifest-path helios/Cargo.toml (not opened) \
--features runtime-core,server 2>&1 | tee /tmp/677-unit.log
# PASS: 0 failed; record exact passed/ignored and compare with the PR's 1,841/47
# 3. the parser tests, by name
cargo test --locked --release --manifest-path helios/Cargo.toml (not opened) \
--features runtime-core,server literal_closing_tool_tag
# plus plain_closing_tool_tag_in_element_text, split_streams_preserve_reasoning
# 4. TMLv0 golden + effort normalization
FLARE_INKLING2_TEST_SNAPSHOT=<dir with tokenizer.json (not opened)> \
cargo test --locked --release --manifest-path helios/Cargo.toml (not opened) \
--features runtime-core,server -- --ignored tml_tests # PASS: 6 passed, includes
# prompts_match_tml_renderers_token_for_token
cargo test --locked --release --manifest-path helios/Cargo.toml (not opened) --features runtime-core,server \
chat_normalizes_reasoning_effort_across_glm_qwen_tml_and_deepseek
cargo test --locked --release --manifest-path helios/Cargo.toml (not opened) --features runtime-core,server \
chat_preserves_assistant_reasoning_aliases_across_jinja_and_native_encoders
# 5. linearity timing (the PR's only quantitative claim) — release build, 40,000-tag case
cargo test --locked --release --manifest-path helios/Cargo.toml (not opened) --features runtime-core,server \
-- --nocapture literal_closing_tool_tag
# PASS: single-digit milliseconds, not seconds
Optional but recommended (author disclosed it was not run): cargo kani on helios/src/output/tagged/kani_proofs.rs (not opened) — in_value was added to eos_decision (kani_proofs.rs:99-136 (not opened)) and per docs/verification.md:56-84 an unexecuted proof is not evidence. If Kani is unavailable on the machine, record it as an unrun check, not a pass.
5. Phase 1 — cn7, ~45 min GPU (one core at a time)
# rebuild Flare from PR head; a serving-only Rust change needs NO re-export (AGENTS.md:273-278)
cargo build --release --manifest-path flare-cli/Cargo.toml (not opened)
flare-cli/target/release/flare run <qwen3.8-27b-nvfp4 core> --gpus 0
1. Effort matrix (Qwen3.8, non-streaming, max_tokens: 8, thinking on). Send reasoning_effort = low, medium, high, xhigh, max, minimal.
- PASS: all six return 200 (before this PR,
highandmaxreturned 400 —tests/frontend/qwen38.json:3089-3099(not opened)). - Mapping check (
high→medium,max→xhigh,minimal→low): the rendered prompt is not exposed by the API, so assert equalusage.prompt_tokensfor the pairs (high,medium) and (max,xhigh) and for (minimal,low). Record the token counts. reasoning_effort: "none"→ 200, noreasoning_content,completion_tokens> 0.reasoning_effort: 7(numeric, invalid for Qwen) → still rejected.
2. Reasoning aliases (one script, 4 requests against the same service). Base an assistant turn on a tool call, follow with a tool result.
reasoning_content: "…"(baseline),thinking: "…",reasoning: "…",reasoning: {"nested": true}.- PASS: the first three give identical
usage.prompt_tokens; the fourth is HTTP 400 namingreasoning. - Then send
thinking/reasoningon arole: "tool"message and assert the prompt token count equals the baseline (non-assistant roles must ignore them — the PR's nits claimed this was fixed; verify it).
3. MiniMax regression (2 requests). Serve MiniMaxAI/MiniMax-M3.1-Flash: one plain completion and one tool call. This only needs to confirm the MiniMaxXml parse_candidate → Complete mapping (minimax_xml.rs:200-202) did not disturb its namespace-prefixed closer; the synthetic proof is minimax_xml.rs:443-483.
4. Tool-call smoke for the headline fix (Qwen's ChatML dialect), non-streaming and stream: true separately. Declare one function with a single string parameter and ask: "Call grep with pattern exactly a</tool_call>b."
- PASS: HTTP 200,
finish_reason: "tool_calls",json.loads(arguments)["pattern"] == "a</tool_call>b". - If the model will not emit the literal tag, record "model did not produce the input" and do not iterate — the parser is already proven on synthetic input; that is stronger evidence than one sampled generation.
5. EOS rejection. Same tool, max_tokens: 16, prompt inviting a long argument. PASS: any truncated call is not returned as a tool call (docs/api.md:636-638).
6. Regression sweep: FLARE_API_TEST_URL=http://127.0.0.1:8000 .venv/bin/python -m pytest tests/server/test_protocols.py -q (idle service) and pytest tests/server/test_qwen38_dense_dflash.py (not opened) -q.
6. Phase 2 — cn5, ~20 min, only if the GLM dialect is unexercised
GLM-5.3-Flash-NVFP4 is also on cn7 (1 GPU is enough for TP1), so prefer cn7 and skip cn5 rather than paying 4-GPU load time. If used: flare-cli/target/release/flare run <glm-5.3-flash-nvfp4 core> --gpus 0, then
- effort subset
minimal, medium, high, max— assertminimalandlowproduce equal prompt tokens, andmediumandhighdo. GLM is the fallback template (low/highelsemax), somediummust resolve tohigh; ifmediumrendersmax, the sentinel probe atfrontend/mod.rs:863-880is broken — the single most valuable hardware finding available here. - the step-4 tool-call smoke above (GLM is the
<arg_value>case the PR targets).
7. Not testable on this hardware, and not worth GPU time
ToolDialect::scan_value_enddefaultOk(0)(tagged.rs:61-63): safe today only because all threeIncompleteValuedialects override it. A code-review item; no request to a served model can reach it.- Sentinel-render heuristic for
medium(frontend/mod.rs:863-880): undocumented, tested only against raise-on-unknown templates; a hypothetical template defaulting unknowns tomediumwould lose the level. Review item; the Phase 2 GLM check is the closest hardware proxy. - Gemma
<|"|>dialect — one request at most (gemma-4-E4B-iton cn7) for a smoke check; the split sweep ingemma_call.rsis the real coverage. - TP>1, scheduler, prefix cache — untouched by this PR; cn7's single GPU and cn5's 4-GPU load cost are irrelevant.
8. Time budget
| Phase | Where | GPU time | Wall clock |
|---|---|---|---|
| 0 | any CPU host / cn5 48-CPU job | 0 | ~40 min |
| 1 | cn7 | ~45 min | ~75 min incl. core load |
| 2 (optional) | cn5 | ~20 min | ~40 min incl. core load |
9. Findings a reviewer should carry into the test record
- The PR is mergeable, with nits per re-review at head
c897437: all round-1 blockers fixed (TMLv0mediumpreserved viaEffort::Medium; linearscan_value_end;high/maxnormalized for Qwen;docs/api.md:975-995and:621-625updated; rebased over merged #670). Two non-blocking items remain: the fail-openOk(0)default and the sentinel heuristic. - Testing will not change the merge decision — it will confirm the two user-visible changes work end-to-end on a strict template (Qwen3.8) and on the tool parser with a real model. That is a worthwhile ~45 minutes on cn7; it is not worth 4 GPUs for hours on cn5.
- No speedup claim survives measurement: nothing to benchmark against
main, sincemainfails the input outright. Frame the result as "the HTTP 500 is gone and the argument is preserved", plus the CPU timing showing linear scan. - Report gaps honestly in the result: no Inkling 2 and no DeepSeek hardware, so those contracts were validated only by the CPU golden/unit tests;
cargo kaniunrun unless you run it in Phase 0.
Discord Test Request
Deliverable — ready-to-paste Discord post
## Recommendation: Test
High confidence. Both fixes are already covered by CPU-only tests in the repo; hardware only confirms the two user-visible changes end-to-end.
## Hardware Required
- cn7 (1× GB10): serve Qwen3.8-27B-NVFP4, GLM-5.3-Flash-NVFP4, MiniMax-M3.1-Flash — one core at a time
- Any CPU host, no GPU lease, for the ~40 min test suite (this is where the real validation happens)
- Skip cn5 (4 GPUs) — the only model it has that matters, GLM-5.3, also runs on cn7
## Justification
- The headline bug is that `main` returns HTTP 500 on a literal `</tool_call>` inside a tool argument; any GPU run either reproduces the 500 or proves it gone — no benchmark needed.
- Effort levels `high`/`max` currently 400 on strict templates (Qwen3.8), and `medium` silently falls through to `max` on GLM; a few requests confirm both now resolve correctly.
## Estimated Time to Complete
~2 hours total: ~40 min CPU-only (blocking — stop if it fails) + ~75 min wall clock on cn7 (~45 min GPU, rest is core load).
-----
How I built it
Source material: the hardware test plan for PR #677 (fix/helios-glm53-tool-and-reasoning, head c897437), plus the PR's own description and re-review.
I checked the plan's load-bearing claims against the repo at the PR head so the post does not overstate anything:
helios/src/output/tagged.rs:31-37—Candidate { Complete, InJsonString, IncompleteValue }exists as described;scan_value_enddefaultOk(0)at:61-63;TaggedTools::pushlinear scan at:350-361andin_value = trueonIncompleteValueat:406.- All three
IncompleteValuedialects do overridescan_value_end(argument_tags.rs:117(not opened),chatml.rs:30(not opened),gemma_call.rs:176(not opened)), so the fail-open default is unreachable today — consistent with the plan's "code-review item, not hardware testable". helios/src/server/request/tml_tests.rs:102-114— the Inkling 2 golden testprompts_match_tml_renderers_token_for_tokenis#[ignore]d pendingFLARE_INKLING2_TEST_SNAPSHOT, matching the plan's Phase 0 step 4.- PR re-review at head
c897437records 0 blockers / 0 should-fix and "Ready To Merge"; the plan correctly frames testing as confirmation, not a merge gate.
Simplifications I made for the Discord audience
- Dropped the O(K·N) → O(N) framing from the justification: on
mainthe input does not parse at all, so there is nothing to benchmark against; the post instead names the concrete user-visible symptom (HTTP 500 on a literal closing tag) and the concrete regression (high/max→ 400,medium→max). - Collapsed the "missing hardware" caveat (no Inkling 2 or DeepSeek core on either host) out of the post — it is a test-record honesty note, not a reason to test. Flagged separately below.
- Reduced hosts to what is actually useful: cn7 for the ~45 min GPU confirmation, CPU host for the blocking suite, cn5 explicitly marked skip.
Caveats to state in the eventual test record (not the post)
No Inkling 2 (TMLv0) or DeepSeek core exists on cn7 or cn5, so the medium→0.7 (Chat) vs 0.9 (Responses) contract and DeepSeek high=75 vs max=100 were validated only by CPU golden/unit tests — do not imply hardware covered them. cargo kani on tagged/kani_proofs.rs (not opened) (updated for in_value in eos_decision) was disclosed as unrun by the author; run it in Phase 0 or record it as an unrun check, not a pass.
Full report Human Approval: Do you approve this test? → No answer in time.
Deliverable — ready-to-paste Discord post
## Recommendation: Test High confidence. Both fixes are already covered by CPU-only tests in the repo; hardware only confirms the two user-visible changes end-to-end. ## Hardware Required - cn7 (1× GB10): serve Qwen3.8-27B-NVFP4, GLM-5.3-Flash-NVFP4, MiniMax-M3.1-Flash — one core at a time - Any CPU host, no GPU lease, for the ~40 min test suite (this is where the real validation happens) - Skip cn5 (4 GPUs) — the only model it has that matters, GLM-5.3, also runs on cn7 ## Justification - The headline bug is that `main` returns HTTP 500 on a literal `</tool_call>` inside a tool argument; any GPU run either reproduces the 500 or proves it gone — no benchmark needed. - Effort levels `high`/`max` currently 400 on strict templates (Qwen3.8), and `medium` silently falls through to `max` on GLM; a few requests confirm both now resolve correctly. ## Estimated Time to Complete ~2 hours total: ~40 min CPU-only (blocking — stop if it fails) + ~75 min wall clock on cn7 (~45 min GPU, rest is core load). -----How I built it
Source material: the hardware test plan for PR #677 (
fix/helios-glm53-tool-and-reasoning, headc897437), plus the PR's own description and re-review.I checked the plan's load-bearing claims against the repo at the PR head so the post does not overstate anything:
helios/src/output/tagged.rs:31-37—Candidate { Complete, InJsonString, IncompleteValue }exists as described;scan_value_enddefaultOk(0)at:61-63;TaggedTools::pushlinear scan at:350-361andin_value = trueonIncompleteValueat:406.- All three
IncompleteValuedialects do overridescan_value_end(argument_tags.rs:117(not opened),chatml.rs:30(not opened),gemma_call.rs:176(not opened)), so the fail-open default is unreachable today — consistent with the plan's "code-review item, not hardware testable".helios/src/server/request/tml_tests.rs:102-114— the Inkling 2 golden testprompts_match_tml_renderers_token_for_tokenis#[ignore]d pendingFLARE_INKLING2_TEST_SNAPSHOT, matching the plan's Phase 0 step 4.- PR re-review at head
c897437records 0 blockers / 0 should-fix and "Ready To Merge"; the plan correctly frames testing as confirmation, not a merge gate.Simplifications I made for the Discord audience
- Dropped the O(K·N) → O(N) framing from the justification: on
mainthe input does not parse at all, so there is nothing to benchmark against; the post instead names the concrete user-visible symptom (HTTP 500 on a literal closing tag) and the concrete regression (high/max→ 400,medium→max).- Collapsed the "missing hardware" caveat (no Inkling 2 or DeepSeek core on either host) out of the post — it is a test-record honesty note, not a reason to test. Flagged separately below.
- Reduced hosts to what is actually useful: cn7 for the ~45 min GPU confirmation, CPU host for the blocking suite, cn5 explicitly marked skip.
Caveats to state in the eventual test record (not the post)
No Inkling 2 (TMLv0) or DeepSeek core exists on cn7 or cn5, so the
medium→0.7 (Chat) vs 0.9 (Responses) contract and DeepSeekhigh=75 vsmax=100 were validated only by CPU golden/unit tests — do not imply hardware covered them.cargo kaniontagged/kani_proofs.rs(not opened) (updated forin_valueineos_decision) was disclosed as unrun by the author; run it in Phase 0 or record it as an unrun check, not a pass.