Explore scratchpad · NVIDIA/hyperflare-inference #677

Raw Markdown for agents: https://autobot.eidonix.com/p/16864e34-8c6f-4b0b-87a3-60fcc404525c.md

#1 [high] Change: what PR #677 does, file map, size

PR #677 (open, head f439f74, base main@1fbcc3c9), "fix(helios): preserve Chat Completions reasoning aliases, normalize effort levels, and allow literal closing tool tags in argument values". Author brandonmmusic-max (CONTRIBUTOR). No comments, no reviews, no CI checks on head. 6 files, +791/-59.

Files (pr_files):

Two independent changes bundled: (A) decode.rs chat_messages: reads first non-null of reasoning_content, thinking, reasoning (decode.rs ~line 181-195); non-string now errors with field name in message (e.g. "thinking must be text"), i.e. HTTP 400 for non-string thinking/reasoning on Chat messages (previously those fields were ignored entirely, so a numeric reasoning was silently dropped). (B) decode.rs options(): Chat protocol now treats top-level reasoning_effort string as effort; "none"->enable_thinking:false, "minimal"->Effort::Minimal, "medium"->Effort::High, and when normalized (or nested reasoning.effort used) skips copying raw reasoning_effort into options.template (~line 681-690). Unknown string values on Chat now fall through to None instead of error (arm _ if protocol == Protocol::Chat && !chat_nested_effort => None), but unknown non-string values (numbers) still error. Nested reasoning.effort accepted on Chat when top-level absent/null. (C) output/: ToolDialect::parse_candidate return type changed from Result<Option<Vec<(String,String)>>> to Result<Candidate> where Candidate = Complete | InJsonString | IncompleteValue. TaggedTools::push only sets in_json_string on InJsonString; on IncompleteValue it just continues scanning past the inner closer. ArgumentTags/parse_tool_candidate(chatml)/GemmaCall return IncompleteValue for open non-JSON argument values during streaming candidate evaluation; direct parse/parse_eos still error. MiniMaxXml maps to Candidate::Complete (its outer closer starts with NAMESPACE sentinel). Tests added: argument_tags.rs (+~155 lines test), chatml.rs (both ChatMlOutput and CompactChatMlOutput), gemma_call.rs, minimax_xml.rs, decode.rs native_prompt_tests (2 tests). Diff spans: pr_diff start=0..~49371 chars.

#2 [high] The change: decode.rs effort/reasoning detail and docs gap

Decode-side detail (verified in code, PR head f439f74 vs main 1fbcc3c9):

#3 [high] The change: output/ Candidate three-state and untouched files

Verified at PR head:

#4 [high] The change: undeclared behavior deltas (TMLv0 effort, high passthrough)

Verified behavior deltas not stated in the PR description (all at head f439f74):

  1. Chat reasoning_effort": "medium" on a TMLv0 native encoder (Inkling 2 / TML models) changes rendered effort from 0.7 to 0.9. TMLv0's named table is ("medium", 0.7), ("high", 0.9) (helios/src/frontend/tml.rs:18-29); previously the raw string reached the template through options.template and tml::effort mapped it to 0.7 (frontend/tml.rs:49-69). Now decode.rs:621-624 maps medium -> Effort::High and withholds the raw string, and request.rs:518-527 resolves High to the first template-accepted candidate ["high","medium"], i.e. high -> 0.9. The description discloses the fallback only for "Jinja templates distinguishing medium from high" (compat note b); the TMLv0/native-encoder 0.7→0.9 change is not mentioned. (deepseek/DeepSeek V4+V41 previously rejected medium outright, frontend/deepseek.rs:191-219, so there it changes 400→200, which is disclosed.)
  2. Unknown string reasoning_effort on Chat is now silently ignored instead of forwarded to the template: arm _ if protocol == Protocol::Chat && !chat_nested_effort => None (decode.rs:627), and because normalized_chat_effort stays false the raw value is still copied to the template only if... no: the copy loop is skipped only when normalized/nested, so an unknown string IS still copied (decode.rs:684 condition false). Re-reading: for unknown strings, native is None, normalized_chat_effort false, so the key loop still inserts it — passthrough preserved, matching the description's "unknown strings ... preserved". But an unknown nested reasoning.effort string errors (decode.rs:627-628 because chat_nested_effort is true), and unknown numeric top-level values keep flowing to the encoder (numbers are filtered out by .filter(|v| v.is_string()) at line 601, so they never reach the match). Description's claim holds; the asymmetry (string vs number) is worth noting.
  3. reasoning_effort: "high" on Chat is still copied raw (normalized_chat_effort false), so templates that reject high still 400 — e.g. Qwen3.8's pinned template raises "Unexpected reasoning effort high. Supported types are xhigh (default), medium, and low." (tests/frontend/qwen38.json:3089-3099). The PR fixes medium for such a template but leaves high broken. Not disclosed.
  4. Non-string thinking/reasoning in a Chat message now 400 where it was previously ignored (decode.rs:184-195; main decode.rs:184-190). Disclosed as compat note (a); affects clients that echo Anthropic-style {"type":"thinking", ...} objects into Chat messages.

#5 [high] Why/Related: #172, #25 and docs describe the behavior this changes

#6 [high] Community/Process: no engagement, no CI, no docs, bundled fixes

#7 [high] Related work: #670 collision risk, #596/#573/#67/#418 lineage, #133

Overlapping/related work on the same files (items_touching + read_item):

#9 [high] Project fit: charter and AGENTS.md mapping for #677

Charter (read_charter) mapping, as facts:

#10 [high] Claims and evidence: test coverage confirmed, live benchmarks unlinked

Claims vs evidence in the PR description, checked against the tree: Supported by in-tree tests (I read the code, not ran it):

#11 [high] Research summary

Case file prepared for PR #677 (brandonmmusic-max, open, head f439f74, base main@1fbcc3c9, 6 files, +791/−59). Findings are in ten scratchpad entries covering all requested angles; the facts a reader could not get from the description are summarized here.

Undeclared behaviour deltas. Chat reasoning_effort: "medium" now maps to Effort::High through options.effort and is withheld from the template (decode.rs:621-628, 684-686), so on TMLv0 native encoders (Inkling 2) the rendered effort goes 0.7 → 0.9 (frontend/tml.rs:18-29 vs request.rs:518-527) — the description only discloses this for Jinja templates. "high" is not normalized, so a Chat "high" still reaches templates raw and still fails on Qwen3.8's pinned template ("Unexpected reasoning effort high", tests/frontend/qwen38.json:3089-3099). Non-string thinking/reasoning fields in Chat messages now 400 where they were previously ignored (disclosed as compat note a). Unknown nested reasoning.effort rejects while unknown top-level strings still pass through. No docs file is touched, though docs/api.md:596-628 and 955-995 are the specification for both halves and AGENTS.md:230 requires updating it.

Why / related work. The behaviour being changed is documented elsewhere as intended: open docs-only PR #172 records that GLM-5.3-Flash maps none/medium/xhigh to Max, and yatesdr's review of it states named-effort resolution belongs to Responses/Messages only. Closed issue #25 is the community precedent for "translate, don't reject" effort levels. On the output side, the lineage is #67/#179/#418/#573/#596 (all merged, same files); #670 (open, lukealonso) rewrites the same tagged.rs push/parse_candidate region for contract-parameterized delimiters, so textual conflicts are likely; closed issue #133 recorded GLM tool-parse rejections and explicitly left malformed-output parsing as "a separate parser/API concern", which is the half this PR does.

Evidence. The new decode tests build their own tokenizer and literal templates (decode.rs:1104-1175), so they do not depend on FLARE_TEST_TEMPLATE_DIR, and the output tests sweep every two-part UTF-8 split plus single-character streaming while preserving strict-tool and EOS rejection. The live SM120/BFCL/agentic_suite.py (not opened) claims have no in-repo harness, command, core id or log (agentic_suite/BFCL grep returns nothing) — the same gap Autobot flagged on the author's #457. Kani proofs are confirmed structurally unchanged (kani_proofs.rs:71-110) and unrun, as disclosed.

Community/process. Zero comments, reviews, reactions or labels; no CI checks on head; two independent fixes bundled on one branch; author is a CONTRIBUTOR with one prior merged PR in this exact file (#162, commit 5dd6723e) but not a priority contributor. Charter fit is mostly positive (documented APIs, no per-model branch, no core-format change) with tensions on "root cause" and the missing docs update.

#12 [high] Reach: who and what #677 affects

Reach of PR #677, verified from the diff and the code paths it feeds:

Users / clients:

Operators / configuration / deployment:

Documentation reach (stale after this PR):

Tests / CI reach: new Rust unit tests only; no Python server test, no tests/server/* change, no live-harness file added, so the behaviour is not covered by the CUDA-gated serving suites.

#15 [high] Amendment 2026-12-02 (head c897437): #677 revised after Autobot review — all four prior findings addressed

AMENDMENTS to entry #14 (report of 2026-12-02, run 2931). PR https://github.com/NVIDIA/hyperflare-inference/pull/677, now head c897437, base main@cc0a49d2.

1. Shape changed: 11 files, +1089/−80 (was 6 files, +791/−59)

pr_files: docs/api.md, helios/src/frontend/mod.rs, output/{argument_tags,chatml,gemma_call,minimax_xml,tagged}.rs, output/tagged/kani_proofs.rs, server/inference.rs, server/protocol/decode.rs, server/request.rs. Labels added: area:api, bug, priority:P2, triage:review (read_item #677). Description rewritten into the AGENTS.md four-part format with in-repo-only evidence; external SM120/BFCL/agentic_suite.py claims removed (so my §8 "not backed in-repo" gap is closed by removal, not by evidence). Kani/mutants still declared unrun.

2. My "undeclared TMLv0 medium 0.7→0.9 shift" is FIXED (supersedes Key finding 1 and §9)

New Effort::Medium between Low and High (helios/src/server/inference.rs:117-125), candidates &["medium","high"] (server/request.rs:521). Chat top-level "medium" maps to Effort::Medium only when top-level and not nested (decode.rs:622-624); Responses/nested medium still Effort::High (:625). Test asserts Chat medium == 0.7 and Responses reasoning.effort:"medium" == 0.9 on the real Inkling 2 contract (decode.rs:2706-2726, fixtures tests/support/contracts/inkling2_frontend.json); TML ladder unchanged (frontend/tml.rs:19-27). Documented at docs/api.md:991-993.

3. My "high left unnormalized" is FIXED (supersedes Key finding 2)

withheld_chat_effort now covers none|minimal|low|medium|high|max (decode.rs:677-682); xhigh is deliberately left raw so DeepSeek-V4.1 keeps score 75 vs max 100 (asserted decode.rs:2753-2756). Qwen3.8-style vocabulary test: high→medium, max→xhigh (decode.rs:2652-2671). Documented docs/api.md:985-991.

4. My "docs/api.md not updated" is FIXED (supersedes Key finding 3, §9 and the AGENTS.md:230 tension in §7)

docs/api.md +25/−5: literal outer closing tags stay argument text inside open non-JSON values (new para ~:621-626), and the reasoning-controls section now states assistant-only reasoning_content|thinking|reasoning aliases with 400 on non-strings, nested reasoning.effort, Chat named-level normalization, per-vocabulary resolution incl. TMLv0 0.7/0.9 (:975-995). AGENTS.md:230 requirement met.

5. My "O(K·N) rescan / unbounded hot path" concern did not exist in my report but is the new architectural addition

ToolDialect::scan_value_end (output/tagged.rs:56-63) + TaggedTools::in_value (:241, scan loop :350-361, eos_decision :292, Kani proof tagged/kani_proofs.rs). New latent footgun for reviewers: the default scan_value_end returns Ok(0) while :352-355 clears in_value and does not advance search_from; a dialect that returns Candidate::IncompleteValue without overriding scan_value_end would re-select the same closer forever (infinite loop, not caught by the 1 MiB bound since nothing is added). Today only ArgumentTags (argument_tags.rs:117), FunctionTags (chatml.rs, with new possible_parameter_end :100-119) and GemmaCall return IncompleteValue, and all three override it — so unreachable now, but the default impl is not fail-closed.

6. Correction to my §1(A): alias lookup is now Role::Assistant-only

chat_messages reads reasoning_content|thinking|reasoning only for Role::Assistant; other roles read reasoning_content only (decode.rs:184-192). My earlier wording "across roles" is wrong; the narrowing is a self-review fix, and the 400-on-non-string compat note (a) now applies to assistant messages only.

7. Jinja effort-vocabulary probing changed (new code, replaces plain acceptance probing)

Frontend::resolve_effort now renders the template six times, including a magic sentinel __flare_unknown_effort__, and drops "medium" from the accepted set when its render equals the sentinel's render (frontend/mod.rs:843-880; cached in OnceLock effort_levels :799). Residual limits: this only detects fallback-by-rendering (a template that maps medium to another valid level keeps medium and the template does the mapping); the existing vocabulary test (frontend/mod.rs:1741-1777) is unchanged and still only covers strict raise-on-unknown templates. Heuristic is not documented in docs/api.md, whose :988-991 describes plain vocabulary matching.

8. Conflict surface collapsed

#670 is merged (commit 2acc3f3a, in the new main tip) and #677 is rebased over it: the same-function textual conflict I flagged in §3/§6 no longer exists; the diff now consumes #670's JSON_BODY (tagged.rs:46-48, used :378-393) and with_tool_delimiters (:466) instead of fighting them. Remaining textual interaction: open docs PR #172 (YouNeedCryDear) also edits docs/api.md near :975-995, and #172's premise ("named effort resolution is Responses/Messages-only"; low/high, else max) becomes stale once #677 lands — #172 needs rewording rather than a rebase only.

9. Still open from my report (unchanged)

Citations: read_item 677; pr_files; pr_diff docs/api.md / decode.rs / frontend/mod.rs / request.rs / inference.rs; read_file tagged.rs:28-72,240-430; decode.rs:175-210,590-700,2650-2760; frontend/mod.rs:827-891,1741-1777; request.rs:515-530; inference.rs:110-125; docs/api.md:955-1030,618-626; read_item 172.

#16 [high] Research summary

Amendment written as scratchpad entry #15 (high). The new event is a substantive revision of PR #677: head is now c897437, rebased over the merged #670, 11 files, +1089/−80, labels area:api, bug, priority:P2, triage:review, with a rewritten AGENTS.md-format description and in-repo-only evidence.

Three findings in my earlier report are now stale and must be replaced: (1) the TMLv0 Chat medium 0.7→0.9 shift is fixed by a new Effort::Medium (inference.rs:117-125, request.rs:521, decode.rs:622-624) with a real Inkling 2 contract test (decode.rs:2706-2726); (2) high is now normalized (decode.rs:677-682), with xhigh deliberately left raw for DeepSeek 75-vs-100; (3) docs/api.md is updated (+25/−5) for both the literal-closing-tag rule and the reasoning/effort surface, satisfying AGENTS.md:230. The #670 textual conflict is gone since #670 merged (2acc3f3a), leaving only a docs collision with open #172, whose "Responses/Messages-only effort" premise becomes stale.

New material worth flagging: the O(N) follow-up introduces ToolDialect::scan_value_end whose default returns Ok(0) while TaggedTools::push clears in_value without advancing — an infinite-loop footgun only avoided because all three IncompleteValue dialects override it; and Frontend::resolve_effort now renders each template six times with a __flare_unknown_effort__ sentinel to detect fallback-branch medium, a heuristic that is undocumented in docs/api.md and only exercised for raise-on-unknown templates. Bundling of two fixes, no linked issue, and unverifiable test counts still stand.

#17 [high] Amendment prose (ready to lift): exact supersede/replace list against entry #14

Use with entry #15 (the delta case file). This is the amendment text for the final report; entry #14 stays as the base, these items replace or extend it.

Amendment (2026-12-02, after #677 head c897437)

PR #677 changed materially since the report of run 2931, so four of that report's items are superseded. Head is now c897437 (was f439f74), base main@cc0a49d2 (was 1fbcc3c9), 11 files / +1089 −80 (was 6 / +791 −59), labels area:api, bug, priority:P2, triage:review (read_item 677). The branch was rebased over the now-merged #670 (2acc3f3a), and the description was rewritten into the AGENTS.md four-part format with in-repo-only evidence.

  1. Superseded — "undeclared TMLv0 medium 0.7 → 0.9 behaviour change". Fixed by a new neutral level: Effort::Medium sits between Low and High (helios/src/server/inference.rs:117-125), Chat top-level "medium" selects it (helios/src/server/protocol/decode.rs:622-624) with ladder &["medium","high"] (helios/src/server/request.rs:521), so TMLv0 renders its native 0.7 (helios/src/frontend/tml.rs:19-27) while Responses and nested reasoning.effort:"medium" still resolve to Effort::High → 0.9 (decode.rs:625). Verified against the real Inkling 2 contract in chat_normalizes_reasoning_effort_across_glm_qwen_tml_and_deepseek (decode.rs:2706-2726, tests/support/contracts/inkling2_frontend.json) and documented at docs/api.md:991-993. The old "shifts prompt tokens and prefix-cache keys" warning applies only to the GLM-style medium→high change, not to TMLv0.
  2. Superseded — "high is still forwarded raw, so Qwen3.8 still 400s". withheld_chat_effort now withholds none|minimal|low|medium|high|max (decode.rs:677-682); xhigh is deliberately left raw so DeepSeek-V4.1 keeps 75 vs 100 (asserted decode.rs:2753-2756). Qwen3.8-vocabulary test resolves high→medium and max→xhigh (decode.rs:2652-2671). Documented docs/api.md:985-991.
  3. Superseded — "docs/api.md not updated (AGENTS.md:230)". docs/api.md now +25/−5: literal outer closing tags (</tool_call>, <tool_call|>) inside open non-JSON argument values stay argument text under a linear scan (~:621-626), and the reasoning-controls section states assistant-only aliases, the non-string 400, nested reasoning.effort, Chat named-level normalization and per-vocabulary resolution incl. TMLv0 0.7 / Responses 0.9 (:975-995).
  4. Corrected — the alias lookup is now Role::Assistant-only; non-assistant roles read reasoning_content only (decode.rs:184-192). My earlier "across roles" wording and the breadth of compat note (a) were too wide.

New items to add (not in entry #14)

Still standing from entry #14

Two independent fixes still bundled (Autobot's 11:26 review still counts this under charter fit; the author did not split). Unknown top-level Chat effort strings and xhigh passthrough remain undocumented at docs/api.md:984-987. No linked issue for either defect. Only Autobot has reviewed; no maintainer engagement. The CPU test counts (1,841 unit, 62 integration, tml_tests 6/6, flare 254, flare-cli 245) and the Kani/mutants gap are unverifiable without running the tree. External SM120/BFCL/agentic_suite.py claims were removed from the description rather than substantiated.

Verdict change

All four Autobot blockers/should-fixes have in-tree fixes with tests, so #677 moves from "changes requested / not mergeable" toward mergeable-with-nits. The two things a reviewer should still press are the non-fail-closed scan_value_end default and the undocumented sentinel heuristic.

#8 [medium] People: author history (#162 merged in tagged.rs) and area owners

#13 [medium] Recent activity: what changed lately in the two touched areas

Recent activity in the areas #677 touches (from search_history on each path, and the orientation packet):

helios/src/output/tagged.rs (newest first): 99339606 2026-11-28 Luke Alonso "preserve JSON types for unconstrained tool parameter schemas" (#596); 2bdc8472 2026-11-28 Luke Alonso "tolerate omitted closing tags on complete tagged tool calls at EOS" (#573); 0b09434d 2026-11-22 Joshua Cartu "Constrain strict function-tool arguments in native tool syntax" (#418); 9d1e0137 2026-11-11 Mark Yong (#179); f76b517f 2026-11-11 Martin Vit (#228); 902c88e2 2026-11-02 yatesdr (#167); 5dd6723e 2026-11-02 Brandon M. Music (#162 — same author as #677). So the file changed five times in the three weeks before #677 and is owned in practice by Luke Alonso.

helios/src/server/protocol/decode.rs: cd1daa3e 2026-12-01 flare-autobot (#638) — the most recent change, one day before the branch point; e4d8eb60 2026-11-29 Frosty40 (#615); 85de9eae 2026-11-28 Joshua Cartu; 0b09434d (#418); ab606762 yatesdr; 902c88e2 (#167). decode.rs is a high-churn shared file touched by at least six different authors in the last six weeks.

Base/main state: PR base is main@1fbcc3c9 (2026-12-01); the packet reports no commits on the default branch since the branch point touching any of the six changed files, and search_history on pr/677 confirms the two #677 commits sit directly on top of 1fbcc3c9 (f439f744, 0b042e56), so the branch is up to date.

Build-on vs conflict: #677 builds directly on #596 (it calls super::tagged::container_parameter, strict_nonstring_raw, and the RawArguments/to_json_string helpers that #596 reshaped) and preserves #573's parse_eos contract verbatim. The live in-flight work that could conflict is open PR #670 (lukealonso), which rewrites the same ToolDialect/TaggedTools/ThinkReasoning structures to carry contract-supplied open/close, and which also edits argument_tags.rs; #670 was opened 2026-12-02 00:26, about ten hours before #677. Nothing in #677 reverses or undoes an earlier merged change: it is additive to the #67/#179/#418/#573/#596 series.