Opened by a workflow run, Nov 29, 2026 2:05 PM EST. decide malicious: all_clear (100%): No malicious content found
explore
Author: newjordan (FIRST_TIME_CONTRIBUTOR — first contribution in the repo, no prior PRs or issues in 180 days; Discord frosty40)
Motivation: thinking_token_budget (per-request and [server]) has to be a hard cap, and it already returns HTTP 400 on models whose reasoning lives inside TMLv0 content-header frames (Inkling 2 Mini/Small), because the cut code only knew formats that start in plain reasoning or content. Separately, a hard token cap can land mid-character on byte-level BPE tokenizers, so the re-prefilled continuation prompt carries 1–3 dangling UTF-8 bytes before the forced close token.
Scale: +562 / −31 lines in 6 files (production code ≈ +156/−25; 442 of the added lines are tests).
Proposal:
- Widen
thinking_budget_close()to acceptOutputStart::RecipientFrame/RecipientHeaderwhen the contract's reasoning parser isContentHeaders(single-token close required);RecipientHeadersunchanged (helios/src/server/request.rs:557-578). - New
tml_text_transition_tokens()resolves<|message_model|>and<|content_text|>from the added vocabulary and attaches them asReasoningCut::close_tailwhen no tools and no grammar are active and capacity allows (request.rs:384-393,543-555). Worker::publish()emitsclose+close_tailthroughActive::close_reasoning(), records each injected token, counts them in progress metrics and subtractsinjected.len()fromcut.after(helios/src/server/runtime.rs:1950-2017).Worker::park()trims up to 3 trailing generated tokens when an 8-token decode window ends in U+FFFD and trimming restores a clean boundary, keeping ≥1 generated token (runtime.rs:2129-2155).- Tests (bootstrap validation, request prep across plain/29-31/tools/
tool_choice=none/grammar/Messages/uncapped, worker injection + capacity + pipeline, UTF-8 1-byte/2-byte/complete) and adocs/api.mdupdate. Touches: helios/src/server/runtime.rs— forced-cut injection, accounting, and the sharedpark()prompt-rewrite path (also used by preemption and the plain output limit).helios/src/server/request.rs— budget/close/accept-reject logic in request preparation and startup validation.helios/src/output/tml.rs+helios/src/model/contract.rs(not opened) (unchanged but load-bearing) — the TMLv0 frame parser andContentHeaderssyntax the injected sequence depends on. Related items:- #167 Add a hard reasoning-token budget and DeepSeek V4.1 sampling ranges (merged): created the feature this PR extends and deliberately rejected unsupported formats.
- #457 Fail untyped TML model headers at EOS and align TMLv0 content-header and strict-tool grammars with TmlOutput (open): rewrites the same TmlOutput/unnamed-header grammar semantics; no cross-reference either way.
- #582 helios: avoid splitting prefill on zero-budget checkpoint anchors (open, approved): edits the same
park()prompt-rewrite path. - #541 Add a Prometheus and Grafana monitoring example (open): documents
reasoning_budget_cuts_total, whose accounting this PR changes. - #396 / #281 (merged / closed): earlier added-vocabulary and content-header handling that this change reads.
Link: https://github.com/NVIDIA/hyperflare-inference/pull/615
Autobot comments: Zero CI checks, zero reviews, zero comments, no labels, never updated since opening. The UTF-8 trim is not ContentHeaders-specific: it fires on every forced reasoning cut in every format, can silently drop up to 3 already-emitted tokens from the continuation prompt, and does not cover preemption or the plain output limit. Injected tail tokens go through the stop/grammar path and count as generated tokens (3 instead of 1),
record_decoded_tokennow runs per injected token, and a user token-stop can truncate the tail mid-sequence — none of which the description states. Evidence is CPU tests only: no live Inkling 2 run, the#[ignore]real-checkpoint TML tests unrun, and the TLA+ runner skipped; the one thing that matters (real-model behaviour after the injected frame opener) is asserted only against a synthetic tokenizer plus the contract fixture. Charter tension: hardcoded<|message_model|>/<|content_text|>literals in the request layer cut against "keep the runtime model-agnostic".
Classify intake
Selected: triage:review, enhancement, area:api
Threshold: 65%
Triage
- [✓]
triage:review: 98.0% -
triage:design-review: 1.4% -
triage:validation: 0.6% -
triage:integration: 0.0% -
triage:investigate: 0.0% -
triage:partial: 0.0% -
none: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Priority
-
none: 94.3% -
priority:P2: 4.7% -
priority:P1: 1.0%
Type
- [✓]
enhancement: 97.4% -
bug: 43.8% -
performance: 40.7% -
community: 29.4% -
duplicate: 13.3% -
documentation: 0.4%
Area
- [✓]
area:api: 91.5% -
area:engram: 5.3% -
area:scheduling: 2.3% -
area:preparation: 1.8% -
area:selene: 1.4% -
area:memory: 0.4% -
area:orbit: 0.4% -
area:caching: 0.3% -
area:packaging: 0.2% -
area:kernels: 0.2% -
area:rocenante: 0.1%
Model
-
model:inkling-small: 62.2% -
model:deepseek-v4: 2.3% -
model:deepseek-v4.1: 1.2% -
model:qwen3.8-flash-next: 0.9% -
model:glm-5.3: 0.5% -
model:nemotron-3.5-bolt: 0.5% -
model:muse-glimmer: 0.4% -
model:qwen3.8-27b: 0.4% -
model:mimo-v2.6: 0.2% -
model:kimi-k3.1: 0.2% -
model:gemma4: 0.1%
Apply Labels (Intake)
Applied: +triage:review, +enhancement, +area:api
Value Proposition
Value Proposition: PR #615 — thinking_token_budget for ContentHeaders + UTF-8 tail trim
Charter alignment — partly aligned, partly adversarial.
The PR closes a real gap in a shipped feature: on TmlV0/ContentHeaders cores (Inkling 2 Mini/Small), a documented request field (thinking_token_budget, Anthropic thinking.budget_tokens) and the [server] thinking_token_budget default currently yield HTTP 400 or a bootstrap failure. That touches the charter's "support the documented Chat Completions, Completions, Responses and Messages APIs" goal and the "either implement the field per spec or reject it" rule, and it reverses no prior work (#167 902c88e2 deliberately rejected such formats). But the mechanism collides with "keep the runtime small and model-agnostic … no per-model special cases": tml_text_transition_tokens() hardcodes <|message_model|>/<|content_text|> in the request layer (request.rs:543-555) while the contract declares reasoning.open/close but no text opener. The UTF-8 half is a U+FFFD heuristic at one call site (runtime.rs:2129-2155), not a decoder fix — the same hazard survives on preemption and at the plain output limit, short of #397's "root cause" bar.
Novelty & status — genuinely additive; not obsolete, not superseded.
No other open PR targets thinking_token_budget or ContentHeaders budgets; #615 widens #167's accept list rather than reversing it. Two live conflicts must be resolved: open #457 rewrites the very TmlOutput/content-header semantics the injected unnamed-model-header + content-kind-marker sequence depends on (it adds an EOS error for a header without content), and neither PR references the other; #582 is in flight on the same park path this PR edits.
Value vs maintenance cost — benefit real, evidence thin, scope understated.
Beneficiaries: Inkling 2 Mini/Small users who can now hard-cap reasoning, plus every reasoning format that silently gains the trim. Evidence is CPU-only on synthetic tokenizers with no CI on the head commit; the central behavioural claim — that a real model continues in a text frame after <|message_model|><|content_text|> — is unexercised (FLARE_INKLING2_TEST_SNAPSHOT #[ignore] tests and live flare run not run). The description also omits three substantive effects: the trim drops up to 3 already-generated tokens for all formats, not just TMLv0; generated_tokens / usage.completion_tokens inflate by the injected tail (3 vs 1), shifting dashboards built on #541; and a user token-stop can truncate the tail mid-sequence, contradicting the "all-or-nothing" framing. runtime.rs is among the most contended files in the repo (20+ items in 180 days), and this adds per-token accounting plus up to 4 decodes per cut on the worker thread, unbenchmarked.
Verdict: Worth it with changes. Keep the review investment, but require: (1) real-checkpoint or live GPU evidence that the injected pair yields a text continuation rather than a second thinking frame; (2) scope the UTF-8 trim to the forced-cut case it claims (or fix it at the decoder) and test a non-TML format; (3) declare the text-opener markers in the contract instead of hardcoding them in request.rs; (4) an explicit resolution with #457 (and a rebase past #582); (5) documented accounting/stop-path semantics and the stale comments in runtime.rs:68-70 / docs/logprobs-design.md. If (1) or (2) cannot be delivered, this should be declined — a format-keyed special case on synthetic-only evidence is not worth the maintenance cost on that file.
No prompt-injection or instruction-override attempts were present in the PR text, dossier, or discovered activity.
Full report Decide Value: yes (98%): This change is worth reviewing: it provides value to the project in line with its charter.
Subtraction and simplicity
Subtraction/simplicity review of PR #615: production code is lean (no new config keys, flags, or dead code), but three real subtractions remain.
ReasoningCut { close, close_tail }(runtime.rs:50-61) plus theinclude_tailre-check (runtime.rs:1962-1972) state "one token, sometimes two" twice; the re-check re-tests operands fixed at preparation, so it is dead defensive code — replace with onesequence: Vec<u32>(~25 lines gone).tml_text_transition_tokens()(request.rs:543-555) is a second, weaker lookup for idsprepare_outputalready resolved intoOutputConfig.control_tokens(model/prompt.rs:315-328 → output/pipeline.rs:135 → tml.rs:25/29), and it is the PR's only per-format branch in helios request prep (charter #267/#334). Delete it.- The UTF-8 trim (runtime.rs:2129-2155) is a 27-line U+FFFD heuristic with magic 8-token window, 3-token cap and up to 4
decodecalls per cut on the worker thread, wheretoken_bytes+str::from_utf8(precedent: token_spans.rs:129-141) gives it exactly in ~8 lines — or drop it, since preemption (runtime.rs:2121) keeps the same hazard and the charter wants root-cause fixes (#397). - New tests rebuild tokenizers that exist in the same file (
decode.rs:2034-2042vsrenderer()atdecode.rs:1035-1154) and pasteCONTROL_MARKERS(tml.rs:41-44) in three places. - Stale comment at runtime.rs:68-71 ("forced token" singular) and duplicate
u64::from(1 + x.len() as u32) <idiom.
Open: does control_tokens always carry the TML markers when a request sends no tools (contract-declared TmlJson)? And is the token_bytes batch API exactly as sketched? Nothing was compiled; correctness items left to the contracts lens.
Correctness and contracts
Reviewed PR #615 (ContentHeaders thinking_token_budget + UTF-8 tail trim) across all six changed files and their direct callees. The request-preparation and accounting core is sound; the UTF-8 trim half has a scope defect and the "all-or-nothing" claim is false.
Findings:
- Major — the trim in
Worker::park()is gated only on!appended.is_empty()(runtime.rs:2133), so it fires for every forced cut in every format, including grammar-constrained ones, while the tail injection it accompanies is grammar-gated (runtime.rs:1962-1965). Already-grammar-advanced, already-published tokens are silently deleted from the parking prompt (runtime.rs:2150), diverging grammar state from prompt history;docs/api.md:817-823documents this only for TMLv0/ContentHeaders. - Minor — the injected tail is not all-or-nothing: a user token stop matching
<|message_model|>breaks the loop mid-sequence (runtime.rs:1973-1981), leavingTmlOutputinState::Header(tml.rs:272-284), contradicting the PR text. - Minor —
'\u{FFFD}'cannot distinguish a provisional replacement char from genuine content that byte-fallback tokenizers emit; the repo says so attoken_spans.rs:92-93. - Minor — the trim silently no-ops when the partial sequence reaches the 8-token window start (
runtime.rs:2141-2153) althoughdocs/api.md:821-823promises it unconditionally. - Minor — hidden tokens per cut go 1 → up to 3 in
generated_tokens/usage (runtime.rs:1991-1999, 2063) whileprompt_tokensdoes not follow andreasoning_budget_cuts_totalsemantics are unchanged. - Minor —
<|message_model|>/<|content_text|>hardcoded in the request layer (request.rs:543-555) thoughOutputPipelinealready exposes them; charter model-agnostic friction. - Minor — decoded history retains the trimmed tokens (
runtime.rs:2157).
Verified sound: event-capacity bound, admission.rs context and extend_text monotonicity invariants, preemption path, no platform or wire/proto change, and the injected pair legally re-enters Body::Text. Tests cover the happy paths but none of the five edge cases above.
Open questions: no live Inkling 2 evidence that the injected pair keeps the model in a text frame; whether the format-agnostic trim is intended; interaction with #457's "header without content" EOS path; reliability of the U+FFFD heuristic on the real tokenizer.
Final review
Recommendation: Changes Requested
This PR cleanly closes a real feature gap by enabling thinking_token_budget (and [server] thinking_token_budget) on ContentHeaders cores, and its core accounting, output_event_capacity, prompt_metadata::extend_text, and TmlOutput state transitions are verified sound. However, changes are requested before merge for three verified issues: the UTF-8 tail trim in Worker::park() uses a '\u{FFFD}' decode heuristic that drops legitimately generated literal U+FFFD tokens and silently fails to trim when <= 3 tokens were generated since the last admission/preemption, tml_text_transition_tokens() duplicates already-resolved TML control tokens with a per-format branch in request.rs, and the central behavioral claim (that <|message_model|><|content_text|> keeps a real Inkling 2 model in a text frame) currently has synthetic-only evidence with no real-checkpoint or live GPU verification.
Merge Risk
Level: Medium
helios/src/server/runtime.rs(Worker::publishandWorker::park) is a shared hot path used by every reasoning format and every parked/preempted continuation; the new UTF-8 trim runs on all forced reasoning cuts across all formats (not onlyContentHeaders).Worker::park()executes up to 4 synchronousfrontend.decodecalls on the worker thread per forced cut, with no real-checkpoint or live serving validation yet confirming the injected<|message_model|><|content_text|>continuation behavior on Inkling 2 models.- No wire/ABI, captured-graph, scheduler state-machine, or lock/contention changes are introduced; preemption (
park_if_preemptedpassing&[]) and uncapped requests are unaffected.
Walkthrough
helios/src/server/request.rs(381-401,543-578): Widensthinking_budget_close()to acceptOutputStart::RecipientFrameandOutputStart::RecipientHeaderwhenReasoningParserKind::ContentHeadershas a single-token close delimiter, and addstml_text_transition_tokens()to attach[<|message_model|>, <|content_text|>]asReasoningCut::close_tailwhenPromptEncoder::TmlV0+ContentHeadersis active, no tools or grammar are active, and1 + tail.len() < after.helios/src/server/runtime.rs(50-61,1956-2017,2129-2156): ExtendsReasoningCutwithclose_tail, injects[close, ...close_tail]sequentially throughActive::close_reasoning()inWorker::publish()(recording each injected token in decoded history andmetrics.progress, and subtractinginjected.len()fromcut.after), and adds a trailing-'\u{FFFD}'trim loop (up to 3 generated tokens within an 8-token window) inWorker::park()whenappendedis non-empty.docs/api.md(813-842): DocumentsContentHeadersbudget support, silent<|message_model|><|content_text|>injection when tools and grammar are absent, UTF-8 tail trimming on forced cuts, and updated HTTP 400 wording.helios/src/server/config.rs(663-710),helios/src/server/protocol/decode.rs(2032-2222),helios/src/server/runtime/phase_tests.rs(415-420,680-879): Adds unit and worker-loop tests covering bootstrap validation, request preparation across plain/tight-capacity/tools/tool_choice="none"/grammar/Messages/uncapped cases,close_tailinjection andOutputPipelinedecoding, and byte-level incomplete UTF-8 trimming versus plain continuation.
Pre-merge Checks
- [PASS] Security / malicious screen: No prompt-injection attempts, unsafe code, external I/O, or credential/trust-boundary changes.
- [WARN] Charter & value fit: Implementing a documented API field (
thinking_token_budget) onContentHeaderscores aligns with the API-support goal, but hardcoding<|message_model|>/<|content_text|>behind aPromptEncoder::TmlV0check inhelios/src/server/request.rs:543-555adds a format-specific branch whereoutput.control_tokensalready carries those validated markers. - [PASS] Related / duplicate / conflict check: Additive over #167 with no competing PRs and no file or behavioral conflicts with open #457 or #582 (verified against both PRs' diffs and file lists).
- [WARN] Tests & verification evidence: No CI checks on head
2652c06, and all reported tests are CPU-only with synthetic tokenizers; real-checkpoint#[ignore]tests (helios/src/server/request/tml_tests.rs) and live Inkling 2 serving were not run to verify the injected text-frame continuation.
Blockers
None.
Should Fix
- Replace the
'\u{FFFD}'decode heuristic inWorker::park()with exact token-byte UTF-8 boundary checking and fix the unnecessarygenerated_len - 1trim floor (helios/src/server/runtime.rs:2129-2155,helios/src/server/config.rs:281).- False positive on literal
U+FFFD: Decoding a window and checkingtext.ends_with('\u{FFFD}')(runtime.rs:2136-2139) cannot distinguish an incomplete trailing UTF-8 byte prefix from a legitimately generated literalU+FFFDcharacter ([0xEF, 0xBF, 0xBD])—an ambiguity the codebase already calls out inhelios/src/server/token_spans.rs:92-93. A literal'\u{FFFD}'at the budget boundary is silently deleted from the continuation prompt. - Silent failure on small/post-preemption passes (
generated_len <= 3):let max_trim = 3usize.min(generated_len.saturating_sub(1))andend > window_start(runtime.rs:2141-2144) fail to trim whenever a budget cut occurs with 1–3 tokens generated since the last admission (for example, a request preempted with 2 budget tokens remaining that generates[0xE2, 0xAC]of a 3-byte char:generated_len = 2->max_trim = 1-> trimming 1 token leaves[0xE2]which still ends inU+FFFD, so nothing is trimmed). The comment atruntime.rs:2131-2132claims at least one generated token must be retained forextend_text, which is unnecessary:tokens.extend_from_slice(appended)runs atruntime.rs:2156beforeextend_text(runtime.rs:2167-2168) with!appended.is_empty(), guaranteeingtokens.len() >= live.prompt_tokens + 1 > incoming.prompt.tokens.len(), andextend_textitself only requiresafter >= before(helios/src/model/admission.rs:26). - Fix: Use
Frontend::token_bytes()(helios/src/frontend/mod.rs:1534, backed byhelios/src/frontend/vocabulary.rs:11-45) on the trailing tokens and validate withstd::str::from_utf8(as inhelios/src/server/token_spans.rs:129-141), trimming generated tokens at index>= live.prompt_tokensonly whenUtf8Error::error_len().is_none()(a true incomplete UTF-8 suffix, never a literalU+FFFD). Ensurefrontend.prepare_token_bytes()?is called at bootstrap (helios/src/server/config.rs:281currently gates it onmodel.max_top_logprobs != 0) soVocabularyBytesis never lazily built on the worker thread during a cut. Add regression tests for a literalU+FFFDtoken at the cut boundary and a 2-byte incomplete tail withgenerated_len == 2.
- False positive on literal
- Delete
tml_text_transition_tokens()and resolve the TML text-frame opener from the already-validatedoutput.control_tokens(helios/src/server/request.rs:384-393, 543-555).- Contract validation already enforces the biconditional
ToolParserKind::TmlJson <=> ReasoningParserKind::ContentHeaders(helios/src/model/contract.rs:895-899), soprepare_output()(helios/src/model/prompt.rs:315-328,helios/src/output/pipeline.rs:131-142) has already encoded every marker inhelios/src/output/tml.rs:41-44(CONTROL_MARKERS, includingMODELandTEXT), validated each occupies one token, and stored them inoutput.control_tokensregardless of whether requesttoolsare empty. tml_text_transition_tokens()re-checksPromptEncoder::TmlV0+ContentHeaders, hardcodes the marker strings again inrequest.rs, and reaches intotokenizer().get_added_vocabulary().get_vocab()withoutprepare_output's single-token guarantee.- Fix: Expose a small helper on
OutputConfig/helios/src/output/(reusingtml::MODELandtml::TEXTagainstoutput.control_tokenswhenContentHeadersis active) and deletetml_text_transition_tokens()fromrequest.rs.
- Contract validation already enforces the biconditional
- Supply real-checkpoint / live Inkling 2 verification for the injected
<|message_model|><|content_text|>continuation.- Every test in this PR scripts the post-cut continuation tokens (
[1, 2]inhelios/src/server/runtime/phase_tests.rs:760), so nothing yet demonstrates against an actual Inkling 2 checkpoint that injecting<|message_model|><|content_text|>after<|end_message|>keeps the model generating in the text frame rather than immediately closing it or reopening<|content_thinking|>. - Fix: Run the real-tokenizer
tml_tests.rssuite (and add athinking_token_budgetcase there) plus at least one liveflare runtranscript on an Inkling 2 core demonstrating a hit onthinking_token_budgetcontinuing cleanly intocontent(both plain and with tools active).
- Every test in this PR scripts the post-cut continuation tokens (
Subtract / Simplify
- Collapse
ReasoningCut { close, close_tail }into one token sequence and delete the redundant runtimeinclude_tailre-check (helios/src/server/runtime.rs:50-61, 1962-1972,helios/src/server/request.rs:384-400).request.rs:384-393already checksoutput.content.tools.is_empty() && grammar.is_none()and1 + tail.len() < after. None ofprompt.grammar,cut.after, orcut.close_tailcan change between preparation andWorker::publish(), so theinclude_tailre-derivation andVecrebuild atruntime.rs:1962-1972duplicate an already-decided invariant.- Replacing
close+close_tailwith a single non-empty sequence (built once inrequest.rswhen1 + tail.len() < after as usize) removes ~20 lines of duplicated policy and the repeatedu64::from(1 + ... as u32) < u64::from(after)casts. (phase_tests.rs:786-800Case 2 only tests that duplicated runtime guard; request-level tight-capacity coverage already exists atdecode.rs:2161-2171.)
Nits
helios/src/server/runtime.rs:70: Update the stale singular comment"A reasoning cut's forced token is part of 'after'"to plural"forced tokens".docs/api.md:821-823: Clarify that incomplete UTF-8 tail trimming on forced cuts applies to all reasoning formats (not onlyContentHeaders), since the sentence currently sits inside the TMLv0ContentHeadersexplanation.helios/src/server/config.rs:667-682andhelios/src/server/protocol/decode.rs:2054-2069: Reusecrate::output::tml::CONTROL_MARKERSinstead of re-spelling the 14 marker strings inline in both tests.
Dropped on verification
- PR #582 edit conflict on
Worker::park()(from Dossier / Value Prop): Verified false. PR #582 changes 7 files inscheduleranddocs/; it does not modifyhelios/src/server/runtime.rsat all (a review comment on #582 merely citedruntime.rs:2106-2121for explanation). - PR #457 conflict on
<|message_model|><|content_text|>(from Dossier / Value Prop / Correctness): Verified false. PR #457'sHeaderWithoutContentEOS error only fires when a non-empty model header (model && at > 0) closes on<|end_message|>or<|content_model_end_sampling|>with no emitted answer, and explicitly preserves empty model headers and external terminations (UserStop,OutputLimit). Injecting<|message_model|><|content_text|>immediately entersState::Body { kind: Body::Text, model: true }(helios/src/output/tml.rs:277-281) and touches none of #457's files. - Correctness F1 — "Blocker-adjacent: UTF-8 trim diverges active JSON grammar state; no non-TML test; hidden scope": Verified false. Trimming only runs when
forced == true, which requiresreasoning_open() == trueandgrammar.allows(cut.close)(runtime.rs:1951-1958)—generation cannot be inside a JSON string answer whilereasoning_open()is true, andllguidance's/(?s:.+)/reasoning region (helios/src/grammar.rs:462-466) enforces UTF-8 boundaries before accepting the close token. Furthermore, the PR description explicitly states "across all reasoning formats" andphase_tests.rs:825-879explicitly tests a non-TML (ThinkTags) cut viabudget_cut(4, 3)(phase_tests.rs:408-428). Only thedocs/api.mdparagraph placement survives as a nit. - Correctness F4 — "User token stop mid-tail leaves
TmlOutputinState::Headerand finishes withreason = \"length\"": Verified false. Whenbudget_stopis true,user_stopis true andruntime.rs:2055setsreason = "stop"withTermination::UserStop, not"length". Moreover,TokenStops::push(helios/src/server/stops.rs:32-44) strips the matched stop token so<|message_model|>is never delivered toTmlOutput, and honoring an explicit user stop token is documented behavior (docs/api.md:828). - Correctness F5 — "Hidden-token accounting triples and
prompt_tokensdoes not follow": Dropped.docs/api.md:823-824already documents that forced close tokens count as generated tokens within the output limit, andprompt_tokensintentionally tracks the original user prompt across all parks/continuations rather than absorbing generated or injected tokens. - Correctness F6 — "
decoded_sequencemismatch breaks prefix cache reconciliation": Dropped as low-signal / misframed.DecodedHistory(helios/src/scheduler/decoded_history.rs:48-145) is only an advisory copy-draft n-gram index for verified speculative proposals (not KV prefix caching), and keeping the emitted stream there has no correctness impact. - Subtraction S4 (partial) — "
decode.rstest can reuserenderer(PromptEncoder::TmlV0, ...)and drops temp-file cleanup": Verified false.renderer()(decode.rs:1035-1154) does not add the 14 TML control tokens and uses DeepSeek's EOS token, anddecode.rs:2106does remove its temp file (std::fs::remove_file(path).unwrap()). Retained only theCONTROL_MARKERSarray reuse as a nit. - Stale companion docs
docs/logprobs-design.md:19anddocs/cli-design.md:1337,1367,1417: Verified false.docs/logprobs-design.md:19already uses plural"Forced tokens", anddocs/cli-design.mddoes not enumerate supported reasoning formats.
Full report Decision to Test: no (98%): 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: 99.1% -
triage:validation: 0.8% -
triage:design-review: 0.1% -
triage:partial: 0.0% -
none: 0.0% -
triage:integration: 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: newjordan (FIRST_TIME_CONTRIBUTOR — first contribution in the repo; no prior PRs or issues in 180 days; Discord frosty40)
Motivation: The hard reasoning-token budget added in #167 can be set per request and as a server default, but it refuses to work on Inkling 2 models whose output starts in a TML "content-header" frame — those requests get HTTP 400 and the server default fails startup. This PR lets the budget work there and also repairs a partial multi-byte character left at the cut boundary so the continuation prompt is not corrupt.
Scale: +614 / −50 lines in 9 files
Proposal:
- Widens
thinking_budget_close()to acceptRecipientFrame/RecipientHeaderstarts forContentHeaderssyntax (helios/src/server/request.rs). - Appends a silent
<|message_model|><|content_text|>opener after the forced<|end_message|>when no tools or grammar are active, resolved from validatedoutput.control_tokensvia newtml::text_frame_opener()andOutputConfig::reasoning_close_tail()(helios/src/output/tml.rs:46-57,helios/src/output/pipeline.rs:26-41). - Collapses
ReasoningCutto oneclose: Vec<u32>sequence and requires a single-token close whenever a grammar is present (helios/src/server/runtime.rs:1995-1998). - Replaces the earlier U+FFFD trim heuristic with exact byte-level trimming,
trim_incomplete_utf8_tail()(runtime.rs:417-461), applied inWorker::park()before the close token is appended. - Removes the
max_top_logprobsgate onprepare_token_bytes(), buildingVocabularyBytesfor every core at startup (helios/src/server/config.rs:281); adds a real-tokenizer#[ignore]test and updatesdocs/api.md. Touches: helios/src/server/runtime.rs— hotWorker::publish()/park()path shared by every reasoning format; the trim runs on all forced cuts, and injected tokens inflatecarried.generated_tokens, decoded history and clustergenerated_tokens.helios/src/server/request.rs+helios/src/output/{syntax honestly pipeline,tml}.rs— request preparation and TML dialect vocabulary.helios/src/server/config.rs— startup validation plus an unconditional per-core token-byte build. Related items:- #167 Add a hard reasoning-token budget and DeepSeek V4.1 sampling ranges (merged): created the entire feature; #615 is additive and edits its
docs/api.mdtext. - #457 Fail untyped TML model headers at EOS and align TMLv0 grammars (open): injects the exact "unnamed header + content marker" shape #457 changes; no cross-reference either way, parser side unguarded.
- #582 heilos: avoid splitting prefill on zero-budget checkpoint anchors (open, approved): its
zero_budget_anchorlatch assumespark()grows the readmitted prompt; #615 shrinks it by up to 3 tokens. - #541 Add a Prometheus and Grafana monitoring example (open): documents
reasoning_budget_cuts_total, whose meaning survives while surrounding token counters shift. - #396 / #281 (merged/closed): earlier added-vocabulary and special-token handling this now reuses.
Link: https://github.com/NVIDIA/hyperflare-inference/pull/615
Autobot comments: Force-pushed from
2652c06to7dde009after a bot review (Changes Requested, 19:28); the author replied 19:53 claiming all five fix groups and asked for re-review. Two of the bot's complaints are genuinely fixed — the hardcoded TML literals and the encoder-keyed branch are gone from the server layer, and the U+FFFD trim heuristic became exact UTF-8 boundary checking. Undeclared in the description: the trim fires on every forced cut in every format (preemption and the plain output limit stay untrimmed), injected control tokens are counted as generated tokens (up to 3 instead of #167's 1) and can be truncated mid-frame by a user token stop, andconfig.rs:281now buildsVocabularyBytesfor every core at startup, a memory/start-latency change for all deployments. Evidence is one author-reported live Inkling-2-Mini run on GB10 plus an#[ignore]real-tokenizer test; there are zero CI checks on the head and zero human reviews or comments. Inkling-2-Small, vision and TP>1 are untested. Earlier claim that #582 edits the samepark()path was wrong — it edits scheduler/checkpoint files, though its latch still matters here.
Value Proposition
Value Proposition — PR #615 (helios: support thinking_token_budget for ContentHeaders)
What it is. At head 7dde009, #615 enables per-request and [server] thinking_token_budget on TMLv0 ContentHeaders cores (which currently return HTTP 400), plus a byte-exact UTF-8 tail trim on forced reasoning cuts. It is 9 files, roughly +614/−50, with ~+170/−50 in five production files.
Charter alignment — mostly good. The core change is squarely in scope: the charter requires that a standard request field be either implemented per spec or rejected, never quietly dropped, and it requires Chat/Responses/Messages parity. The dossier confirms the earlier architecture objection is genuinely repaired, not papered over: the <|message_model|>/<|content_text|> literals now live once in helios/src/output/tml.rs:25,29, resolved via tml::text_frame_opener() and OutputConfig::reasoning_close_tail() (pipeline.rs:26-41), and request preparation request.rs:380-397 is format-agnostic — so the runtime stays model-agnostic rather than accumulating per-model branches. Two parts drift from the charter. The trim fires on every forced cut in every format rather than the one format the PR is about, and it repairs the prompt while silently dropping text already streamed to the client (open question 1; docs/api.md:817-820 documents only the prompt side). And config.rs:281 now calls prepare_token_bytes() unconditionally for every core — a boot-latency/memory cost for all deployments that appears nowhere in the description's change list and carries no measurement.
Novelty — additive, neither obsolete nor superseded. #167 (merged) is the origin and this edits its own docs/api.md paragraph rather than reversing it. Open #457 (TMLv0 grammar/EOS-on-header shape) and open #582 (scheduler zero_budget_anchor) touch different files; the bot's duplicate check found no file or behavioural conflict. This is genuinely new capability. Caveats: neither PR cross-references the other, and #615 introduces a shrink of up to 3 tokens on the same park() re-admit path that #582's latch assumes (open question 5).
Value vs cost. Real beneficiaries: anyone serving Inkling-2 ContentHeaders cores through OpenAI/Anthropic SDK clients, who today gets an HTTP 400 on a documented API field. Evidence is decent but unaudited: 1,685 + 62 + 242 CPU tests passing, a real-Inkling-2 tokenizer #[ignore] test (tml_tests.rs:355-417) asserting the exact cut sequence, and seven self-reported live GB10/SM121 scenarios including tools, json_object, Messages, and the server-level default. Against that: no CI checks exist on 7dde009, the live transcript is not reproducible from the repo, Inkling-2-Small/vision/TP>1 are untested, there is zero human review (one bot review plus an author reply 25 minutes later), and an undeclared accounting change — up to 3 injected tokens where #167 counted 1 (metrics.rs:333-347).
Verdict: Worth it with changes. The PR fixes a genuine, charter-mandated functional gap and now places the format knowledge in the right layer, so the maintenance cost is defensible. Before merge: (1) CI green on head; (2) declare and either justify or measure the unconditional prepare_token_bytes() startup cost; (3) narrow the trim scope or explicitly address the client-visible/prompt divergence and the identical, untouched dangling-byte hazard in preemption; (4) reconcile with #457 and #582, and confirm #582's anchor latch tolerates a shorter re-admitted prompt; (5) update the stale docs (docs/logprobs-design.md:19, the output_event_capacity comment at runtime.rs:68-70, docs/cli-design.md) and state the generated_tokens change.
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, performance, enhancement, area:api
Threshold: 65%
Triage
- [✓]
triage:review: 99.6% -
triage:design-review: 0.2% -
triage:validation: 0.1% -
none: 0.0% -
triage:partial: 0.0% -
triage:investigate: 0.0% -
triage:integration: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Priority
-
none: 99.9% -
priority:P1: 0.1% -
priority:P2: 0.0%
Type
- [✓]
enhancement: 99.5% - [✓]
performance: 65.1% -
community: 40.7% -
bug: 10.7% -
duplicate: 8.5% -
documentation: 0.2%
Area
- [✓]
area:api: 98.0% -
area:preparation: 5.3% -
area:memory: 1.4% -
area:scheduling: 0.6% -
area:engram: 0.5% -
area:selene: 0.2% -
area:caching: 0.2% -
area:kernels: 0.2% -
area:orbit: 0.1% -
area:packaging: 0.1% -
area:rocenante: 0.0%
Model
-
model:inkling-small: 62.2% -
model:glm-5.3: 0.9% -
model:deepseek-v4: 0.7% -
model:nemotron-3.5-bolt: 0.7% -
model:qwen3.8-27b: 0.6% -
model:deepseek-v4.1: 0.5% -
model:muse-glimmer: 0.5% -
model:qwen3.8-flash-next: 0.5% -
model:kimi-k3.1: 0.1% -
model:gemma4: 0.0% -
model:mimo-v2.6: 0.0%
Apply Labels (Intake)
Applied: +performance
Subtraction and simplicity
Subtraction/Simplicity/Conventions lens, PR #615 @ 7dde009. The production diff (5 files, ~+170/−50) is lean: no dead knob, no new flag, no duplicated marker table; the literals live once beside CONTROL_MARKERS (helios/src/output/tml.rs:25,29,41-44) and the earlier tml_text_transition_tokens()/PromptEncoder-keyed branch is correctly gone. Five suggestions, highest value first:
- Delete
frontend.prepare_token_bytes()?(helios/src/server/config.rs:281). Its only consumer is already a lazy OnceLock (helios/src/frontend/mod.rs:1534-1537); the unconditional call builds one Vec per vocab entry per core at boot (helios/src/frontend/vocabulary.rs:31-39) for cores that never arm a cut — an undeclared resource change (AGENTS.md:88-94). - The new decode test rebuilds the module's own
renderer()helper (helios/src/server/protocol/decode.rs:2033-2092 vs renderer at :1035); a third copy is tml_tests.rs:32-91, a fourth is config.rs:663-694 (32 lines to assert one Option). Parametrize renderer with anadded: &[&str]and keep only the assertions tml_tests.rs:355-416 lacks: the tight-capacity ladder (decode.rs:2146-2155), tool_choice=none (:2166-2173), Messages budget (:2186-2193). - Option<[u32;2]> → to_vec() → !is_empty() → extend is four spellings of two u32s across tml.rs:47-57, pipeline.rs:29-40, request.rs:384-390, with the capacity rule split across two files; collapse into one OutputConfig::reasoning_close(close, after, grammar) -> Vec.
- runtime.rs:433-435's
let Ok(bytes) = ... else { return; }is a silent no-op fallback AGENTS.md:182-186 rejects; the 17-line scan at :439-455 re-walks token_spans.rs:129-142 and reduces to ~6 lines using one from_utf8 + valid_up_to(). - Keep one of the two guards for "a grammar never sees a tail": drop request.rs:385's grammar.is_none() in favour of the runtime check at runtime.rs:1995-1998.
Checked clean: docs/api.md:817-832, ReasoningCut collapse, phase_tests Vec updates. Open: is prepare_token_bytes measured? which bot "subtract" item was addressed? should the trim be scoped to one format when preemption (:2152) has the same hazard untrimmed?
Correctness and contracts
PR #615 at head 7dde009 is architecturally sound in its core but has one Major correctness/documentation gap and three Minor accounting/scope issues.
Major: trim_incomplete_utf8_tail runs in Worker::park() (helios/src/server/runtime.rs:2156-2163), which is only reached after every generated token was already emitted to the client (runtime.rs:1902, emit_output at runtime.rs:490-524) and pushed through the worker-side parser. The trim therefore repairs only the re-prefilled prompt; the streamed text can still end in a stray U+FFFD from the dangling byte token, and docs/api.md:817-820 documents only the prompt side.
Minor, three: (1) the trim is gated on !appended.is_empty() (runtime.rs:2160), so it silently applies to every reasoning format's forced cut, while preemption (park_if_preempted, park(slot, &[], remaining) at runtime.rs:2152) has the identical hazard and is never trimmed; (2) a three-token close now runs emit_output/token-stop matching per token via close_reasoning (runtime.rs:474-488), so a user token stop can truncate the frame mid-header (runtime.rs:2009-2012), and metrics.progress(0, injected.len(), ...) (runtime.rs:2030) adds up to 3 to generated_tokens per single reasoning_budget_cuts increment — unreconcilable for #541 consumers; (3) Bootstrap::load() now calls prepare_token_bytes()? unconditionally (helios/src/server/config.rs:281), building one decoded Vec<u8> per vocabulary entry for every core (frontend/vocabulary.rs:31-39), an unmeasured boot latency/memory change absent from the PR description.
Verified sound: marker ids come only from validated single-token control markers, grammar/tools are guarded twice correctly, required budgets still 400 rather than being silently dropped, the UTF-8 algorithm itself handles literal U+FFFD correctly, no new concurrency surface, and the synthetic plus worker-loop tests are substantive.
Evidence: no CI on 7dde009; the real-tokenizer test is #[ignore]d; live GB10 runs are author-reported. Open questions: client-visible trim semantics, preemption scope, #582's shrinking-prompt anchor latch, and #457's header/EOS interaction.
Final review
Recommendation: Ready To Merge
All Round 1 review findings (exact UTF-8 boundary checking, removing the PromptEncoder::TmlV0 branch/hardcoded markers from request.rs, collapsing ReasoningCut to a single close: Vec<u32>, real Inkling-2 tokenizer and live SM121 serving verification, and all three nits) are verified cleanly resolved at head 7dde009. No blockers or regressions were introduced: capacity arithmetic, grammar/tool gating, prompt metadata/vision invariants, and TmlOutput state transitions all hold under direct inspection. Wait for CI to run green on 7dde009 before merging.
Merge Risk
Level: Low
helios/src/server/runtime.rs(Worker::publishandWorker::park) is a shared single-threaded worker path; the newtrim_incomplete_utf8_tail()runs only on forced reasoning cuts (!appended.is_empty()), inspects at most 8 trailing generated tokens viaO(1)pre-initializedFrontend::token_bytes()lookups, and leaves preemption (park_if_preemptedpassing&[]), unforced continuations, and uncapped requests untouched.Bootstrap::load()(helios/src/server/config.rs:281) now callsfrontend.prepare_token_bytes()?unconditionally; all current cores (max_top_logprobs == 20 != 0) already executed this at startup, and initializing eagerly avoids a synchronous worker-thread stall on the first forced cut for legacymax_top_logprobs == 0cores.- No wire/ABI, captured-graph, scheduler state-machine, or lock/contention changes are introduced; verified conflict-free with open PRs
#457and#582.
Walkthrough
helios/src/output/tml.rs(46-57) &helios/src/output/pipeline.rs(26-41): Addstml::text_frame_opener()reusingtml::MODELandtml::TEXTagainst already-validated single-tokenoutput.control_tokens, and exposesOutputConfig::reasoning_close_tail()whenReasoningParserKind::ContentHeadersis active with no tools.helios/src/server/request.rs(380-400,539-560): Widensthinking_budget_close()to acceptOutputStart::RecipientFrameandOutputStart::RecipientHeaderfor single-tokenContentHeadersclose delimiters (leavingRecipientHeadersunchanged), and buildsReasoningCut::close: Vec<u32>once at preparation time—appendingoutput.reasoning_close_tail()only whengrammar.is_none()andtokens.len() + tail.len() < after as usize.helios/src/server/config.rs(279-281,663-696): Callsfrontend.prepare_token_bytes()?unconditionally inBootstrap::load()and adds aContentHeaders[server] thinking_token_budgetbootstrap validation test.helios/src/server/runtime.rs(50-69,417-461,1994-2048,2156-2177): CollapsesReasoningCut::closetoVec<u32>, enforces single-token grammar advancement (cut.close.len() == 1 && grammar.allows(cut.close[0])), emits every injected close token throughActive::close_reasoning()and decoded history/progress metrics while subtractinginjected.len()fromcut.after, and trims trailing incomplete UTF-8 byte tokens (Utf8Error::error_len().is_none()) at indices>= live.prompt_tokensinWorker::park()before appending forced close tokens.docs/api.md(813-835) & tests (helios/src/server/protocol/decode.rs:2032-2194,helios/src/server/request/tml_tests.rs:355-416,helios/src/server/runtime/phase_tests.rs:679-869): DocumentsContentHeaderssupport, silent<|message_model|><|content_text|>opener injection, and cross-format UTF-8 tail trimming on forced cuts; adds synthetic, worker-loop, UTF-8 edge-case (includinggenerated_len == 1, 2and literalU+FFFD), and real Inkling-2 tokenizer snapshot tests.
Pre-merge Checks
- [PASS] Security / malicious screen: No prompt-injection attempts, unsafe code, external I/O, or credential/trust-boundary changes.
- [PASS] Charter & value fit: Implements the documented
thinking_token_budgetAPI across Chat/Responses/Messages forContentHeaderscores without per-model branches in the server layer; format markers live inhelios/src/output/tml.rs. - [PASS] Related / duplicate / conflict check: Additive over
#167; verified zero behavioral or file conflict with open#457(non-empty header EOS check cannot fire on<|message_model|><|content_text|>) or open#582(readmitted prompt is strictly longer thanlive.prompt_tokens,P' >= P + 1). - [WARN] Tests & verification evidence: Substantive CPU unit/worker tests, real Inkling-2-Mini tokenizer snapshot tests (
6/6--ignored), and liveGB10/SM121serving across 7 scenarios are reported passing, but no CI status checks are recorded on head7dde009yet (confirm CI passes before merge).
Blockers
None.
Should Fix
None.
Subtract / Simplify
None.
Nits
helios/src/server/runtime.rs:433-435(trim_incomplete_utf8_tail):let Ok(bytes) = frontend.token_bytes(token) else { return; };silently skips trimming on error even thoughpark()already returnsResult<()>(runtime.rs:2156) andBootstrap::load()validatesprepare_token_bytes()?(config.rs:281). Propagating?would avoid a silent no-op fallback if an unexpected lookup failure ever occurred.helios/src/server/protocol/decode.rs:2033-2110: The new test repeats ~77 lines of ByteLevel BPE tokenizer + temp-file +GrammarCompilersetup already implemented inrenderer()(decode.rs:1035-1154) in the same test module; parametrizingrenderer()(or extracting a shared helper) would reduce test boilerplate without losing coverage.helios/src/output/pipeline.rs:29-40:reasoning_close_tail(&self)allocates aVec<u32>fromOption<[u32; 2]>; returningOption<[u32; 2]>directly would avoid the temporary allocation beforetokens.extend(...)athelios/src/server/request.rs:386-389.docs/api.md:817-820: Optional wording note—the doc accurately states that incomplete UTF-8 tail tokens are trimmed from the re-prefilled continuation context, and could optionally mention that client-streamed reasoning text before the cut may still end with a replacement character (U+FFFD) when a cut splits a multi-byte character (matching existing forced-cut behavior onmain).
Dropped on verification
- Streaming rollback / client-visible
U+FFFD(Correctness F1, Major): Onmain, a forced cut landing mid-character already flushesU+FFFDto the client when the forced close token pushes throughIncrementalDecoder. This PR does not regress client output, repairs the continuation prompt as accurately documented indocs/api.md:817-820, and adding multi-token streaming hold-back was neither requested in Round 1 nor warranted; demoted to a minor optional doc nit. - Trimming preemption / narrowing trim scope (Correctness F2, Dossier): Claiming preemption (
park_if_preempted) has the "identical hazard" and should also trim is incorrect: preemption injects no close token, so the client'sIncrementalDecoderstill holds the partial UTF-8 bytes awaiting the continuation byte—trimming them on preemption would cause the model to re-emit the character and corrupt client output. Trimming across all reasoning formats on forced cuts is explicitly disclosed in the PR title, description, anddocs/api.md:817-820, and keepsWorker::park()format-agnostic. - Stop-matching injected tokens & "undocumented" 1→3
generated_tokensaccounting (Correctness F3): Both the PR description ("What changed") anddocs/api.md:824-825explicitly state that forced close tokens count as generated tokens within the output limit;metrics.progress(0, injected.len(), ...)is consistent withcarried.generated_tokensandcut.after.saturating_sub(injected.len() as u32).Active::close_reasoningmatchesmain(#167), EOS does not triggerbudget_stop(runtime.rs:501-503), and an explicit user stop token cleanly terminates viaTermination::UserStopinTmlOutput::finish()(tml.rs:371-395). config.rs:281prepare_token_bytes()as "undeclared / whole-VRAM-scale boot cost" (Correctness F4, Subtraction #1, Dossier #5): Explicitly disclosed in the PR description's "What changed" section;VocabularyBytesis host RAM (zero VRAM); every current exported core already hasmax_top_logprobs == 20 != 0(docs/logprobs-design.md:21) and already ranprepare_token_bytes()at boot; eager preparation prevents a synchronous full-vocab decode stall on the GPU worker thread during the first forced cut on legacymax_top_logprobs == 0cores.- Collapsing
trim_incomplete_utf8_tailwhileloop to a singlestd::str::from_utf8(&raw)(Subtraction #4): Incorrect simplification—ifwindow_start = tokens.len().saturating_sub(8).max(prompt_tokens)lands mid-character on an earlier multi-byte sequence (or an earlier stray byte appears in the 8-token window),raw[0]haserror_len() == Some(1), so a singlefrom_utf8(&raw)would return early and fail to trim a genuine trailing incomplete UTF-8 suffix. Thewhile pos < raw.len()loop (runtime.rs:441-455) is necessary. - Dropping
if grammar.is_none()atrequest.rs:385as a duplicate guard (Subtraction #5): Incorrect simplification—request.rs:385omits the 2-token tail so grammar-constrained requests still get a 1-token[<|end_message|>]close; removing it would prepare a 3-tokencut.closethatruntime.rs:1997(cut.close.len() == 1) would reject, silently disabling forced reasoning cuts for all structured-output TMLv0 requests. - Secondary test-scaffolding claim on
config.rs:663-694(Subtraction #2):config.rs:664clones the existing test'stokenizerand addsCONTROL_MARKERSrather than rebuilding a fourth tokenizer from scratch. - Stale doc/comment claims (
runtime.rs:67-68,docs/cli-design.md,docs/logprobs-design.md:19):runtime.rs:68already readsforced tokens(fixed in7dde009);docs/cli-design.md:1337,1367,1417is format-neutral and delegates format details todocs/api.md;docs/logprobs-design.md:19already readsForced tokens, such as the thinking_token_budget close, have no logprob entry. - Potential conflicts with
#457and#582(Dossier & Correctness):#457'sHeaderWithoutContentonly fires on non-empty model headers (at > 0) closed without a content-kind token, never on[<|end_message|>, <|message_model|>, <|content_text|>].#582's(raw_anchor, prompt_tokens)latch is unaffected becausetrim_incomplete_utf8_tailnever truncates belowlive.prompt_tokensandtokens.extend_from_slice(appended)appends>= 1token, guaranteeing the readmitted prompt is strictly longer thanlive.prompt_tokens(P' >= P + 1 > P).
Classify triage
Selected: triage:review
Threshold: 65%
Triage
- [✓]
triage:review: 98.6% -
triage:validation: 0.8% -
none: 0.5% -
triage:design-review: 0.1% -
triage:integration: 0.0% -
triage:partial: 0.0% -
triage:investigate: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Apply labels
No label changes Decision to Test: yes (87%): 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 #615 helios: support thinking_token_budget for ContentHeaders (head 7dde009)
Bottom line
Run a narrow, ~2-hour, single-core non-regression plan — do not plan a speedup measurement, because there is no speedup claim to measure. PR #615 is a correctness/enhancement change (it makes a documented API field work on ContentHeaders cores and repairs a cut-boundary UTF-8 prompt). Triage applied performance at 65 %, but nothing in the PR claims a latency or throughput win, and at head 7dde009 the UTF-8 trim is O(1) (Frontend::token_bytes() lookups over ≤8 tokens, helios/src/server/runtime.rs:417-461, 2160-2162) with no decode() calls left — it is too small to measure against GPU noise. The only performance-shaped thing to check is a startup regression, not a speedup.
And one hard limit on scope: neither machine has an Inkling 2 checkpoint, so the headline behaviour of this PR cannot be exercised on our hardware. ContentHeaders (ReasoningParserKind::ContentHeaders, helios/src/model/contract.rs:68, 907) exists only for Inkling 2 Mini/Small (docs/model-preparation.md:324). cn5/cn7 carry GLM-5.3 and Qwen3.8, whose contracts are ThinkTags (helios/tests/support/contracts/glm53.json:24-30, qwen38.json:29-37) — they take the pre-existing OutputStart::Reasoning budget path (helios/src/server/request.rs:549-551). The <|message_model|><|content_text|> injection and the 1→3 injected-token accounting are unreachable there.
That splits the work cleanly:
- the real-tokenizer proof for the new request-preparation logic is CPU-only and free (Stage 0) — run it first;
- the GPU time buys proof that the shared hot path (
Worker::publish/Worker::park, used by every format) still behaves exactly likemainon formats we can serve.
If Stage 0 passes and Stage 1/2 show byte-identical behaviour, GPU evidence is complete for what is testable. If Stage 1 diverges, stop and report — the PR touches helios/src/server/runtime.rs, one of the most contended files in the repo, and has zero CI checks on 7dde009.
Stage 0 — CPU only, no GPU time, ~25 min (do this first; it is the highest-value check)
On cn5 (48 CPUs; cn7's 10 CPUs also suffice). Build once, then run tests.
git fetch origin pull/615/head:pr615 && git checkout pr615 # expect 7dde009
cargo build --locked --release --manifest-path flare-cli/Cargo.toml (not opened)
python -m pip install -r tests/frontend/requirements.txt 2>/dev/null || python -m pip install huggingface-hub
python tests/frontend/prepare_templates.py (not opened) --output /tmp/flare-test-templates \
--recipe gemma4 --recipe glm53 --recipe mimo_v2 --recipe minimax_m3 --recipe nemotron_h --recipe qwen38 --recipe step5
export FLARE_TEST_TEMPLATE_DIR=/tmp/flare-test-templates
cargo test --locked --release --manifest-path helios/Cargo.toml \
--target-dir flare-cli/target --features runtime-core,server # the CI command, .github/workflows/native-serving.yml:63 (not opened)
0b — the one check that closes the real evidence gap (real Inkling 2 tokenizer, still CPU-only):
huggingface-cli download thinkingmachines/Inkling-2-Small \
--revision b0e7afb8892a07897c78ce1c5b801a0d9cbd5e7b tokenizer.json (not opened) \
--local-dir /tmp/inkling2-snapshot
FLARE_INKLING2_TEST_SNAPSHOT=/tmp/inkling2-snapshot \
cargo test --locked --release --manifest-path helios/Cargo.toml \
--target-dir flare-cli/target --features runtime-core,server -- --ignored tml_tests
Assertions that matter: thinking_budget_prepares_content_headers_cut (helios/src/server/request/tml_tests.rs:355-416) must produce cut.close == [200010, <|message_model|>, <|content_text|>], max_new_tokens == 16, after == 48; tools-active and json_object cases must give cut.close == [200010] only; the omitted-budget case must leave reasoning_cut == None. The five pre-existing tml_tests must also pass (they pin the <|end_message|> == 200010 assumption at tml_tests.rs:25 and the whole renderer parity).
Do not proceed to GPU stages until 0a and 0b are green. If 0b cannot be fetched, say so in the report: the ContentHeaders path then has no real-tokenizer evidence at all and that (not GPU time) is the merge blocker.
Stage 1 — Determinism A/B on GB10 / SM121 (cn7): 1 GPU, ~45 min
cn7 is the right first machine: GB10/SM121 is exactly the class the author reported live evidence on, it is one GPU away from idle, and a TP1 core is far cheaper than a TP4 export.
1.1 Reuse, don't build. No exported core is recorded for these checkpoints, so first check:
./flare-cli/target/release/flare models list --json
- Core present for
qwen3.8-27b(TP1) orglm-5.3-flash(TP1): skip the export entirely. PR #615 touches zeroignition/, model, kernel, or graph code and no wire/ABI, so a core exported frommainserves both binaries. - No core: export exactly one, TP1, once, on
main— budget 1–3 h of GPU time and note it, becauseignition exportruns b12x tuning,torch.compile, warmup and capture (docs/model-preparation.md:273-288). Prefer the smallest supported text core that fits 60 GiB unified RAM on GB10;nvidia/Qwen3.8-27B-NVFP4ornvidia/GLM-5.3-Flash-FP4-Local(docs/model-preparation.md:475-479: SM121 cores must be prepared on Spark). Rules of thumb:--autotune-effort offfor a functional test (it changes only kernel selection, not request semantics —docs/model-preparation.md:182-190), and one--no-mtp/reduced-capacity export is fine because the PR touches no speculative path. Gate: if export alone exceeds the time box, stop and reportblocked-style: the same non-regression evidence is already available CPU-side, and TP4 on cn5 would multiply the cost.
1.2 Boot the baseline and the candidate with one fixed request matrix. Same core, same GPU, --max-concurrency 1 (removes batching nondeterminism), only the binary changes.
# baseline
git checkout main && cargo build --locked --release --manifest-path flare-cli/Cargo.toml (not opened)
./flare-cli/target/release/flare run CORE --gpus 0 --max-concurrency 1 --host 127.0.0.1 --port 8101
# candidate
git checkout pr615 && cargo build --locked --release --manifest-path flare-cli/Cargo.toml (not opened)
./flare-cli/target/release/flare run CORE --gpus 0 --max-concurrency 1 --host 127.0.0.1 --port 8102
1.3 Request matrix — for each of seed in {7, 11} (seed is request-controlled, docs/api.md:44; note temperature 0 is not available — ranges are clamped, docs/api.md:775-795), fire each case against 8101 then 8102, saving the full JSON body:
| # | Case | Purpose |
|---|---|---|
| A | {"model":"m","messages":[{"role":"user","content":"Explain why quicksort terminates."}],"max_tokens":512,"seed":7} |
uncapped control — must be identical (proves no no-op drift) |
| B | same + "thinking_token_budget":64 |
cut fires; assert reasoning_budget_cuts_total == 1 after |
| C | same + "thinking_token_budget":8 |
tight budget → injected vs after arithmetic near the boundary |
| D | same + "thinking_token_budget":64 + "stop_token_ids":[[<the close token id>]] |
user stop vs injected token; must terminate cleanly, not corrupt usage |
| E | same + "thinking_token_budget":64 + "tools":[...] + tool_choice default |
tools path; cut.close stays 1 token either way, tool call must still parse |
| F | same + "thinking_token_budget":64 + "response_format":{"type":"json_object"} |
grammar active (grammar.is_none() false → no tail, single-token close enforced at runtime.rs:1995-1998); JSON must be valid |
| G | POST /v1/messages with "thinking":{"type":"enabled","budget_tokens":64} |
Anthropic parity (docs/api.md:845-848) |
| H | POST /v1/responses + "thinking_token_budget":64, "stream":true |
Responses/streaming parity |
| I | 32 variants of B with thinking_token_budget 1..32, prompt asking for long non-ASCII reasoning (CJK + math symbols + emoji) |
the only way to reach the UTF-8 trim on this tokenizer — a cut splits a multi-byte char only if the tokenizer splits characters |
1.4 Assertions.
- Cases A–H: response bodies byte-identical between ports (modulo
created/id), and/metricsdeltas identical. This is the strong result — forThinkTags,OutputConfig::reasoning_close_tail()returns empty (helios/src/output/pipeline.rs:26-41), socut.close == [close]and the PR is intended to be a strict no-op. - Where a cut fires (
reasoning_budget_cuts_totalincremented,flare_reasoning_budget_cuts_totalin/metrics): reasoning text stops at the cap,completion_tokens == budget + 1 + tokens emitted after the cut,usage.completion_tokens_details.reasoning_tokens <= completion_tokens, and the content after the cut is coherent text (not stray markers, not empty). - Case I differs from baseline in ≥1 instance ⇒ the trim path is exercised. For each divergence confirm the candidate's continuation remains coherent and that the streamed reasoning ends with
U+FFFDin both binaries (documented behaviour,docs/api.md:817-820; the PR repairs the prompt, not the client stream). Zero divergences across 32 budgets ⇒ report "trim not exercised on this tokenizer" and do not spend more GPU time chasing it — the deterministic coverage is the synthetic byte-level matrix athelios/src/server/runtime/phase_tests.rs:805-869(includinggenerated_len == 1, 2and a literalU+FFFD), plus a code ask for a real-tokenizer variant. - Any cut that does not fire is a void test, not a pass. Preconditions are budget present, single-token close delimiter,
budget < max_new_tokens, output starting in reasoning, reasoning still open at the cap (helios/src/server/request.rs:368-400,runtime.rs:1992-2005). Checkreasoning_budget_cuts_totalafter every case before believing the result.
Stage 2 — Preemption must stay untrimmed (cn7): ~20 min, same core, no new export
The trim is gated on !appended.is_empty(), so claiming preemption (park_if_preempted → park(slot, &[], remaining), helios/src/server/runtime.rs:2152) must be byte-for-byte untouched. This is the one place a wrong gate would corrupt client output (re-emitting a character), so it is worth 20 minutes.
- Restart the candidate with a deliberately small cache:
--kv-cache-limit contextor--memory-limit <tight>(docs/model-preparation.md:397-406). - Fire two concurrent requests (concurrency forced to 2 via
--max-concurrency 2), eachmax_tokens512 +thinking_token_budget64, one of them in non-ASCII text, solive.preempted()andphase == Finishingare reachable (runtime.rs:2133-2145). - Assert:
flare_checkpoint_skips_total/preempt-related counters move (proof preemption happened at all), both requests complete withfailed == 0, streamed text has no duplicated character at the park boundary, and the completion bodies match the same requests run at concurrency 1 (aside from usage identical, text equal). Repeat once with the baseline binary; results must match.
Stage 3 — Startup regression of the unconditional prepare_token_bytes() (cn7 + cn5): ~15 min, no export needed
helios/src/server/config.rs:281 now calls frontend.prepare_token_bytes()? for every core instead of only when max_top_logprobs != 0. This is the only performance-shaped change, and it is host-side (VocabularyBytes is host RAM, one Vec<u8> per vocabulary entry, helios/src/frontend/vocabulary.rs:14-39) — it must show zero VRAM change. The final review argues every exported core already had max_top_logprobs == 20, so the expected delta is zero; measure rather than assume, but do not build a benchmark around it.
For each binary, 3 boots of the same core:
- time from process start to
GET /healthreturning 200 (and to the first served token); nvidia-smi --query-gpu=memory.used --format=csvimmediately after health is 200, all 4 GPUs on cn5 / the one on cn7;- host RSS of
flare runafter health.
Pass: boot time and VRAM within noise of baseline; host RSS delta (predict: single-digit MiB for a 154 880-entry GLM vocab). Anything above ~50 MiB or >1 s of added boot time → report as an undeclared startup regression, which is what reviewers flagged as unmeasured.
Stage 4 — Optional, cn5 only, and only if Stage 1 left a real question: TP4 served-workload spot check, ~60–90 min
GLM-5.3-Flash NVFP4 TP4 fits cn5's exactly 4 × 96 GiB (docs/prefix-cache-offload.md:1429 (not opened), docs/roce-ring.md:349 (not opened) qualify TP4 but on four Sparks — this would be a new topology, so treat it as a smoke test only). Use it only for: serve, run cases B/F/E at concurrency 4, and confirm reasoning_budget_cuts_total equals the number of budgeted requests and failed == 0. Do not attempt to measure throughput: charter requires flare run CORE --embedding-table-storage ram with matched configuration for any performance claim (docs/performance-work.md:45-51), which is out of scope here. Skip cn5 entirely if Stage 1 and 2 pass — that is the main GPU-time saving in this plan.
Also skip, deliberately: the facebook/dinov2-base / timm/vit_base_patch14_dinov2 vision models (PR touches no vision path; the prompt-metadata extend_text invariant it relies on is unchanged), tensor-parallel > 1 as a correctness target for this PR, and any multi-host/Orbit work.
Server-level default check (2 min, fold into Stage 1)
Write ~/.config/flare/config.toml (not opened) with [server] thinking_token_budget = 32, boot the candidate on the GLM or Qwen core, then assert: server starts (this is the bootstrap validation the PR widened, helios/src/server/config.rs:416-418), GET /v1/models shows flare.thinking_token_budget == 32 (docs/api.md:842-843), a request that omits the field gets capped (reasoning_budget_cuts_total increments), and an explicit thinking_token_budget overrides it. This is the only "startup accepts the default on a real core" evidence obtainable without Inkling 2.
GPU-time budget
| Stage | Machine | GPU time | Blocking? |
|---|---|---|---|
| 0 — CPU tests + real Inkling-2 tokenizer | cn5 or cn7 CPU | 0 | yes, prerequisite |
| 1 — determinism A/B + trim sweep | cn7 (1 GPU) | ~45 min (+0–3 h if an export is needed) | yes |
| 2 — preemption untrimmed | cn7 (1 GPU) | ~20 min | yes |
| 3 — boot/RSS/VRAM | cn7, optionally cn5 | ~15 min | no |
| 4 — TP4 spot check, optional | cn5 (4 GPUs) | 0–90 min | no |
Single-GPU cn7 does everything essential; cn5 is contingency only. That is the whole point of the plan: this PR has no speedup to demonstrate and its headline path is untestable here.
Stop / report conditions
- Stage 0 red → stop; report failing test names. Do not spend GPU time.
- Stage 1 case A (uncapped control) differs between binaries → hard stop: the change is not format-isolated; report the diff with seed and body.
- Stage 1 case F produces invalid JSON or a
failedcount → hard stop: grammar/close interaction is broken (the single-token close requirement atruntime.rs:1995-1998would be the suspect). - Stage 2 shows duplicated/missing characters at a park boundary, or preemption counters stay at 0 while only one request is admitted → hard stop.
- Export for Stage 1 exceeds ~3 h → stop, report
blocked on export cost; recommend merging on CPU evidence plus maintainer sign-off, since no machine can validate the actual feature.
Residual risk the plan cannot retire (state this in the sign-off)
Real Inkling 2 continuation after <|end_message|><|message_model|><|content_text|> — i.e. whether a real ContentHeaders model keeps generating in a text frame rather than reopening <|content_thinking|> — remains unverified on our hardware, and no GPU on cn5/cn7 can change that. The cheapest way to retire it is the Stage 0b real-tokenizer suite (proves the right token ids for the right markers) plus one author-supplied flare run transcript on an Inkling 2 Mini core; the expensive-but-definitive option is provisioning an Inkling-2-Small core, which is out of this plan's scope.
Content-safety note
No prompt-injection or instruction-override attempts were found in the PR description, dossier, or comments; nothing in the reviewed material was treated as instructions. One oddity worth flagging as data cleanliness only: the second dossier pass carries a garbled phrase ("helios/src/output/{syntax honestly pipeline,tml}.rs") — noise in the case file, not a security issue.
Discord Test Request
Discord post (ready to paste)
## Recommendation: Test
High confidence (~80%). Narrow, CPU-first, non-regression plan — not a speedup benchmark.
## Hardware Required
- **CPU only** (cn5 or cn7): `cargo test` suite + the real Inkling-2 tokenizer check — costs 0 GPU minutes, run it first.
- **1 GPU on cn7** (GB10/SM121): baseline-vs-branch A/B on one existing TP1 core (GLM-5.3-Flash or Qwen3.8-27B).
- Only if no core exists: 1× TP1 export on `main` (1–3 h). cn5's 4 GPUs are contingency only.
## Justification
- It's a real fix, not a perf win: `thinking_token_budget` currently 400s on Inkling-2/TMLv0 (`ContentHeaders`) cores, and forced cuts can leave broken UTF-8 in the continuation prompt. Zero CI checks ran on this head, and the author's live evidence can't be reproduced here — we have no Inkling 2 checkpoint, so GPU time can only prove the shared path didn't regress.
- The `performance` label is a misnomer: no latency/throughput claim exists. The only measurable risk is startup — `prepare_token_bytes()` now runs on every boot instead of only for `max_top_logprobs != 0` (expect ~0 VRAM, single-digit MiB RSS).
## Estimated Time to Complete
~2 hours total: 25 min CPU (tests + real tokenizer), ~65 min on 1 cn7 GPU (determinism A/B, UTF-8 trim sweep, preemption check), ~15 min boot/RSS/VRAM. Add 0–3 h only if a core has to be exported first.
How I checked it (verification of the plan's claims against the repo at PR head 7dde009)
- The change is a correctness/enhancement, not a speedup. PR #615 (
h3dde009, +614/−50, 9 files) widensthinking_budget_close()to acceptOutputStart::RecipientFrame/RecipientHeaderforContentHeaders(helios/src/server/request.rs:539-560) and makesReasoningCut::closeaVec<u32>built once at preparation (request.rs:380-400, tail only whengrammar.is_none()andtokens.len() + tail.len() < after). No claim of latency/throughput anywhere in the description; boot/startup is the only performance-shaped risk. - The UTF-8 repair really is O(1) and not worth measuring.
trim_incomplete_utf8_tail()(helios/src/server/runtime.rs:417-461) scans at most the last 8 generated tokens viafrontend.token_bytes()+std::str::from_utf8(), drops tokens only whenUtf8Error::error_len().is_none(), and is called only whenappendedis non-empty (runtime.rs:2160-2162). - Preemption is genuinely untouched:
park_if_preemptedpasses&[](runtime.rs:2152), so the trim gate is skipped — that is exactly what the plan's Stage 2 spends 20 minutes confirming. - The headline path is untestable on our hardware — confirmed.
ReasoningParserKind::ContentHeadersexists (helios/src/model/contract.rs:68,907); the only ContentHeaders checkpoints are Inkling 2 (docs/model-preparation.md:324:inkling-2-small-nvfp4,inkling-2-mini). So the<|message_model|><|content_text|>injection is unreachable on GLM-5.3/Qwen3.8 cores — GPU stages can only prove non-regression, which is why "Test" (not "Benchmark") and a tight time box are the right ask. - Stage 0b assertions match the code exactly:
thinking_budget_prepares_content_headers_cut(helios/src/server/request/tml_tests.rs:355-416) assertscut.close == [END_MESSAGE(=200010), <|message_model|>, <|content_text|>],max_new_tokens == 16,after == 48, tools/json_object→[200010]only, omitted budget → no cut. The module header (tml_tests.rs:9-12) confirms it reads the Inkling-2tokenizer.json(not opened) fromFLARE_INKLING2_TEST_SNAPSHOT. Author reports 6/6--ignoredtests green. - Startup change verified:
frontend.prepare_token_bytes()?is now unconditional inBootstrap::load()(helios/src/server/config.rs:281);VocabularyBytesis host-sideVec<Vec<u8>>(helios/src/frontend/vocabulary.rs:11), so a VRAM delta would be a surprise worth reporting. - CI command in the plan is the real one:
.github/workflows/native-serving.yml:63(not opened) runscargo test --locked --release --manifest-path helios/Cargo.toml (not opened) --target-dir flare-cli/target --features runtime-core,serverwithFLARE_TEST_TEMPLATE_DIR— matching Stage 0 (which also mirrors the 64 MiBmemlockprlimit the author skipped because of a local 8 MiB limit). - Charter fit: fixes a documented API field rather than silently dropping it, and test-running on real checkpoints is the "bring real evidence" bar — consistent with
read_charter.
Caveats I could not retire
- The cn5/cn7 machine inventory (which checkpoints each box actually has on disk) is not in the repo; the post therefore says "an existing TP1 core" and defers the export decision to
flare models list --json. If no core exists, the estimate becomes 0–3 h longer, which the post states explicitly. - The residual risk is unretireable here: whether a real Inkling 2 model continues in
<|content_text|>rather than reopening<|content_thinking|>cannot be shown on our GPUs. That belongs in the sign-off, alongside the ask for one author-suppliedflare runtranscript or an Inkling-2-Small core. - No prompt-injection or instruction-override content was found in the PR description, the two Autobot review rounds, or the author's reply; the only oddity is cosmetic (a garbled path in one review line), which I treated as data noise, not an instruction or a security issue.