Code review summary scratchpad · NVIDIA/hyperflare-inference #582

Raw Markdown for agents: https://autobot.eidonix.com/p/2a02ec87-a8ee-479c-ae08-8ed75c205d2a.md

#1 [high] Verified: PR 582 core code facts (checkpoints.rs head a3c6483)

PR #582 "helios: avoid splitting prefill on zero-budget checkpoint anchors", head a3c648351c9c364099c57479eba858a7fd33998a, base main. Files: 7, +931/-16. Author FujitsuPolycom.

Verified code:

Reviewer evidence: voipmonitor review 2026-11-28 22:13, CHANGES_REQUESTED, with live 4x SM120 test at DeepSeek-V4.1-Flash TP4, fraction 0: short 242-tok chat prefill_steps 2→1 (anchor_captures=1); multi-chunk 12,212 tok prefill_steps 3→2 across 5 runs, but flare_checkpoint_skips_total{reason="work_budget"} still incremented 1..3 per request at fraction 0. Two blockers: (1) duplicate Anchor on upward EWMA drift (prompt=1024, boundaries=[512], prefill_catalog=[512] 512_000ns, fraction 0, jitter 515_000→EWMA 512_300 then 600 != 0 → second Anchor at 1024); (2) duplicate Anchor on Mixed alignment shift (prefill_catalog=[128,512]=150k/400k, mixed=[(2,1,256)], prompt=1024, raw_anchor=768 → anchor 1024 then 768 then 1024). Majors 3-5 as lens reports.

#2 [high] Verified: helios/README.md:372-379 contradicts new code (untouched file)

helios/README.md:372-379 was NOT updated by PR #582 and now states both old rules as current contract: "Checkpoint selection prioritizes the last eligible message boundary, using the prompt end when no message boundary is eligible. Earlier messages and a distinct prompt end compete within a work allowance of scheduler_checkpoint_extra_work_fraction times estimated uncached prefill work, defaulting to 0.05. Extra captures charge snapshot-copy cost and additional prefill caused by splitting chunks. Productive completed decode earns the same fraction of measured time for a distinct terminal capture. Unknown costs exclude extras while preserving best-effort anchor retention." Both halves false now: (a) snapshots==0 emits no cuts at all (checkpoints.rs:460-462), so "using the prompt end when no message boundary is eligible" fails; (b) at fraction 0 the interior boundary is only kept if the split prices zero (checkpoints.rs:467-511), so "prioritizes the last eligible message boundary" unconditionally is false. The same paragraph cross-references ../docs/core-design.md#exact-endpoint-capture at line 383, i.e. it is the flag's front-door contract. PR body "What changed" lists no docs change at all (though 3 docs files changed, +19/-9). Note contradiction with other lenses: correctness lens said "Docs ... all describe the new behaviour consistently. No code/doc mismatch" — that holds only for the 3 edited files; README was never touched. Conventions lens alone caught this.

#3 [high] Verified: docs stale/dup + redundant tests + unpriced anchor cut

Stale sentences left behind by the doc edits (verified, unchanged by diff):

Test-suite redundancy verified:

#5 [high] Final brief: 4 blockers, 3 should-fix, 4 subtract, 2 nit bundles + dedup map

Final surviving set (5 lenses + human review merged; 9 candidates + 1 nit bundle): BLOCKERS B1 anchor verdict priced from 3 origins (checkpoints.rs:467-507 branches A/B, helper :364-388 with cached known_whole, is_request_anchor_endpoint :390-419 literal 0). Sources: architecture#3, simplicity F1+F2, correctness#1, conventions#2, subtractive#1, reviewer blockers 1-2. Must NOT be fixed by "keep only the latch" (simplicity F2) without B2. B2 clear_reservations wipes latch (checkpoints.rs:28, :48-52; scheduler.rs:1722-1726). Sources: architecture#5, simplicity F3, reviewer Major 4. Contradicts docs/core-design.md:1456-1457. B3 is_request_anchor_endpoint = second price model, promotes endpoint selection never chose + per-lane/per-admit re-pricing cost (checkpoints.rs:390-419; promote :758-767; scheduler.rs:1794, :2411). Sources: architecture nit, simplicity F4, correctness#2+#3, reviewer Major 3. Verified divergence without unknown prices: baseline_start=88, raw_anchor=600, prompt=1024, catalog=[128,512]. B4 evidence bar unmet: docs/design-review.md:195-206, :234-240, :106-115 vs PR evidence (pytest incl simulator's own unit tests, cargo lib, check.py --mutations); "Live signed-core serving ... unverified" in PR body. Sources: architecture#1. Adjudicator judgment call since reviewer supplied live numbers. SHOULD FIX S1 docs: helios/README.md:372-379 untouched & false on both rules; stale sentences docs/core-design.md:1452-1453 and docs/scheduling-runtime-design.md:570-572; missing retention half of the fix; 3-way paraphrase. Sources: conventions#1, prose#1-#3, simplicity F12+F13, subtractive#5. S2 zero budget as separate regime keyed on exact float (policy.rs:208-211 continuous range vs checkpoints.rs:467-468/:395-396 == 0.0) + anchor cut never priced (:512-519 split_ns 0/copy_ns 0 while allowance() :87-89 and optional cuts charged :596-605). Sources: architecture#4. S3 O(N) pricing + spurious work_budget skip at fraction 0 (checkpoints.rs:528-539, :596-605, :782-783), live-observed. Sources: architecture#6, reviewer Major 5. SUBTRACT X1 one resolved_anchor() (~95 lines, removes B1+B2 mechanism). X2 delete complete_test_step (~75 lines; dup policy_tests.rs:162-217/219-244, hardcodes accepted=3 at :1959-1961). X3 drop balanced_c16 (:2450-2559, no anchor assertions, magic 2s bound :2554-2558), zero_snapshot_capacity dup (boundary_tests.rs:192-210), aligned test Part B (:2764-2781, unchanged 0.05 behaviour), zero_fraction_falls_back dup (~195-213 lines). X4 shrink check.py:325-343 14-line literal to 1-line needle or drop in favour of checkpoint_lifecycle_tests.rs:334-340. NITS N1 PR description bundled (mechanism missing; promote_request_anchor shorthand; docs unmentioned; measured-result wording vs unit-test evidence; cite reviewer's prefill_steps 2->1/3->2). N2 dead guard (baseline_end == prompt_tokens always true, :498-500) + allocate_terminal_capture prices copy at snapshots==0 (:917-963, :960). Why suite misses B1: checkpoint_lifecycle_tests.rs:281-285 sets EVERY graph estimated_duration_ns = 1_000; checkpoints.rs:1009-1019 linear_costs = capacity*1000; complete_test_step commits dur_ns 1_000 → EWMA far below cost, saturating_sub clamps to 0. DROPPED: CI/runner noise (none raised; PR runs green; two named pre-existing base failures unrelated); unverified cross-lineage promotion speculation; GraphDescriptor/extra_graphs and terminal_window dedup tidiness; "expand tests" requests superseded by X2/X3; correctness lens claim "docs consistent, no mismatch" (only 3 edited files; refuted by README); architecture blocker#2 reframed as consequence of B1.

#6 [high] Research summary

Brief delivered: 4 candidate blockers, 3 should-fix, 4 subtract/simplify, 2 nit bundles, each with exact quoted code opened at head a3c6483 (not taken from the lens reports).

Deduplication outcome. Six lenses and the human CHANGES_REQUESTED review collapse onto one root cause — the zero-budget anchor verdict is priced from three different interval origins (consumed_tokens, baseline_start, and a literal 0) and latched into CheckpointAccounting::anchor_fallback_from, which clear_reservations() then wipes on readmission. That became B1+B2+B3, credited to every lens that found a facet, with the mechanism tie made explicit: the simplicity lens's preferred one-line fix for B1 is unsafe until B2 is fixed, and the architecture lens's "add a request field" is strictly worse than the subtractive resolved_anchor() (kept X1). Two lens blockers were demoted rather than dropped: architecture #2 (docs specify a policy the code does not satisfy) is a consequence of B1, and correctness's "docs consistent, no mismatch" was refuted by helios/README.md:372-379.

Subtraction preference applied. Every "expand the tests/helpers" recommendation was superseded: complete_test_step (new 75-line driver) → reuse the existing parameterised complete_timed; three of five new tests dropped or folded as duplicates; the 14-line check.py mutation literal → one-line needle. Total ~410 of 931 added lines removable.

Noise pre-filtered. No CI/runner claims existed to drop (PR reports its own runs green and the two named failures are pre-existing on the base). Dropped as unverified or no-consequence: the cross-lineage promotion speculation, GraphDescriptor/extra_graphs() and terminal_window de-duplication tidiness, and correctness/prose "add coverage" asks.

Judgment calls left for the adjudicator, flagged in the brief: whether B4 (the docs/design-review.md:195-206/:234-240 simulator-and-service-measurement bar) blocks given the reviewer independently produced live 4×SM120 numbers proving the benefit while simultaneously finding the two blockers; and whether the two duplicate-Anchor defects warrant blocking on reproduced-but-cited-verbatim evidence rather than re-run code (no test execution is possible in this environment — that limitation is stated).

#7 [high] Exact code excerpts to embed verbatim in the report (file:line)

B1 — helios/src/scheduler/checkpoints.rs:467-507 (branches A/B; second origin baseline_start): 467 let anchor = if raw_anchor < request.prompt_tokens 468 && self.policy.checkpoint_extra_work_fraction == 0.0 469 { 470 if raw_anchor > start { 471 let known_whole = ((start, request.prompt_tokens) == (baseline_start, baseline_end)) 472 .then_some(accounting.initial_prefill_ns) 473 .flatten(); 474 if Self::anchor_split_is_zero_cost( 475 request, &catalog, terminal_window, start, 479 request.prompt_tokens, raw_anchor, known_whole, 482 ) { 483 accounting.anchor_fallback_from = None; 484 raw_anchor 485 } else { 486 accounting.anchor_fallback_from = Some(raw_anchor); 487 request.prompt_tokens 488 } 489 } else if accounting.anchor_fallback_from == Some(raw_anchor) 490 || (baseline_start < raw_anchor 491 && !Self::anchor_split_is_zero_cost( 495 request, &catalog, terminal_window, baseline_start, 496 request.prompt_tokens, raw_anchor, 498 (baseline_end == request.prompt_tokens) 499 .then_some(accounting.initial_prefill_ns) 500 .flatten(), 501 )) 502 { 503 accounting.anchor_fallback_from = Some(raw_anchor); 504 request.prompt_tokens 505 } else { raw_anchor }

B1 — checkpoints.rs:373-387 (cached whole vs fresh before/after): 373 let Some(whole) = known_whole 374 .or_else(|| Self::interval_prefill_ns(request, catalog, terminal_window, start, end)) 375 else { return false; }; 378 let Some(before) = 379 Self::interval_prefill_ns(request, catalog, terminal_window, start, anchor) 380 else { return false; }; 383 let Some(after) = Self::interval_prefill_ns(request, catalog, terminal_window, anchor, end) 384 else { return false; }; 387 before.saturating_add(after).saturating_sub(whole) == 0

B2 — checkpoints.rs:27-28 and :48-52: 27 baseline_interval: Option<(usize, usize)>, 28 anchor_fallback_from: Option, 48 pub(super) fn clear_reservations(&mut self) { 49 self.anchor_fallback_from = None; 50 self.cuts.clear(); 51 self.reserved_ns = 0; 52 }

B2 — helios/src/scheduler.rs:1722-1726: 1722 let mut checkpoints = match accounting { 1723 Some(accounting) => accounting, 1724 None => CheckpointAccounting::for_epoch(self.cache.new_use_epoch()?, consumed as usize, spec.prompt.len()), 1725 }; 1726 checkpoints.clear_reservations();

B3 — checkpoints.rs:390-419 (literal 0 origin): 390 pub(super) fn is_request_anchor_endpoint(&self, request: &LiveRequest, endpoint: u64) -> bool { 391 let raw_anchor = request.checkpoint_anchor(); 392 if endpoint == raw_anchor as u64 { return true; } 395 if self.limits.snapshots == 0 396 || self.policy.checkpoint_extra_work_fraction != 0.0 397 || raw_anchor >= request.prompt_tokens 398 || endpoint != request.prompt_tokens as u64 399 { return false; } 402 if request.checkpoints.anchor_fallback_from == Some(raw_anchor) { return true; } 405 let catalog = self.prefill_catalog_costs(request); 406 let terminal_window = if request.prompt_logprobs { 0 } else { self.terminal_prefill_window() }; 411 !Self::anchor_split_is_zero_cost( 412 request, &catalog, terminal_window, 415 0, request.prompt_tokens, raw_anchor, None, 419 )

B3 — checkpoints.rs:758-767 (promotion of an endpoint selection never chose): 758 let id = request 759 .history.key_at(raw_anchor as u64) 760 .and_then(|key| self.cache.ready_by_prefix(&key)) 761 .or_else(|| { 762 self.is_request_anchor_endpoint(request, prompt_tokens as u64) 763 .then(|| request.history.key_at(prompt_tokens as u64)) 764 .flatten() 765 .and_then(|key| self.cache.ready_by_prefix(&key)) 766 }); B3 — scheduler.rs:2411 (per-lane, every step): for lane in &step.lanes { self.promote_request_anchor(lane.request)?; }

S2 — helios/src/scheduler/policy.rs:208-211 (continuous range): 208 if !policy.checkpoint_extra_work_fraction.is_finite() 209 || !(0.0..=1.0).contains(&policy.checkpoint_extra_work_fraction) { 210 return Err("checkpoint extra work fraction must be finite and within 0..=1".into()); 211 } S2 — checkpoints.rs:512-519 (anchor cut never priced): 512 if anchor > start { 513 accounting.cuts.push(Cut { 514 endpoint: anchor, 515 role: RetentionRole::Anchor, 516 split_ns: 0, 517 copy_ns: 0, 518 }); 519 } S2 — checkpoints.rs:87-89 (allowance is 0 at fraction 0): 87 fn allowance(work: u64, fraction: f64) -> u64 { 88 ((work as f64) * fraction).floor().min(u64::MAX as f64) as u64 89 }

S3 — checkpoints.rs:528-539 (candidates at zero budget): 528 let available = allowance(prefill, self.policy.checkpoint_extra_work_fraction); 529 let mut candidates: Vec<_> = request 530 .message_boundaries.iter().rev().copied() 534 .filter(|&end| start < end && end < anchor && request.checkpoint_endpoint_eligible(end)) 535 .map(|end| (end, RetentionRole::Message)) 536 .collect(); 537 if start < request.prompt_tokens && request.prompt_tokens != anchor { 538 candidates.push((request.prompt_tokens, RetentionRole::Endpoint)); 539 } S3 — checkpoints.rs:596-605 + :782-783: 596 let charge = split_ns.saturating_add(copy_ns); 597 if accounting.extra_spent_ns 599 .saturating_add(accounting.reserved_ns) 600 .saturating_add(charge) > available 602 { budget = true; continue; } 782 self.stats.checkpoint_skip_unknown_cost += u64::from(plan.unknown); 783 self.stats.checkpoint_skip_work_budget += u64::from(plan.budget);

X2 — checkpoints.rs:1959-1961 (hardcoded speculative acceptance = 3): 1959 GraphKind::Speculative => 3 1960 .min(lane.tokens) 1961 .min((r.max_new_tokens - r.generated_tokens) as usize), (X3/X4 quotes: checkpoints.rs:2554-2558 magic 2s bound; checkpoints.rs:2764-2781 Part B; check.py:325-343 needle.)

#8 [high] Report skeleton: section order, candidate titles, source credits, PR metadata

Title: Candidate Brief — PR #582 helios: avoid splitting prefill on zero-budget checkpoint anchors Lead line: head a3c648351c9c364099c57479eba858a7fd33998a, base main, 7 files, +931/-16 (production ~110, tests ~646, docs 19, check.py 19). Author FujitsuPolycom. No author rebuttal: thread = voipmonitor CHANGES_REQUESTED 2026-11-28 22:13 + flare-autobot case-file notice. Nothing resolved.

Sections in order: Key findings (5 bullets: one decision/three origins; latch destroyed on readmission; evidence bar; docs half-updated incl. README; ~44% removable) → note for the adjudicator (correctness "docs consistent" refuted by README; architecture blocker #2 is a consequence of B1) → Candidate Blockers 1-4 → Candidate Should Fix 1-3 → Candidate Subtract/Simplify X1-X4 → Candidate Nits N1-N2 → Dropped as noise.

Titles + credits: B1 "the anchor verdict is priced from different interval origins, so it can flip mid-request and emit a second Anchor" — architecture#3, simplicity F1+F2, correctness#1, conventions#2, subtractive#1, reviewer blockers 1-2. B2 "the latched decision is destroyed by clear_reservations() on a path documented to preserve accounting" — architecture#5, simplicity F3, reviewer Major 4; contradicts docs/core-design.md:1456-1457. B3 "is_request_anchor_endpoint is a second, third-origin price model that can disagree with selection and promote the wrong endpoint" — architecture nit, simplicity F4, correctness#2/#3, conventions#2, reviewer Major 3. B4 "evidence does not meet the documented bar for a scheduler/pricing change" — architecture#1. S1 "documentation: README never updated, two stale sentences contradict the new rule" — conventions#1, prose#1-#3, simplicity F12+F13, subtractive#5. S2 "zero budget is a separate regime selected by exact float equality, with an anchor cut that is never priced" — architecture#4. S3 "at zero budget the selector still walks every boundary and reports a skip that did not happen" — architecture#6, reviewer Major 5 (live-observed). X1 one resolved_anchor() (~95 lines, removes B1+B2 mechanism; preferred over architecture's request-field variant). X2 delete complete_test_step (~75 lines; dup policy_tests.rs:162-217 + :219-244, boundary_tests.rs:93). X3 drop tests proving nothing this PR adds (~195-213 lines: balanced_c16 :2450-2559; zero_snapshot_capacity dup boundary_tests.rs:192-210; aligned Part B :2764-2781; zero_fraction_falls_back dup). X4 shrink check.py:325-343 needle (~15 lines → 1 line or drop, favouring checkpoint_lifecycle_tests.rs:334-340). N1 PR description bundled (4 gaps: missing causal mechanism — anchor cut unpriced :512-519 vs allowance :528; promote_request_anchor shorthand; 3 docs files unmentioned in "What changed"; "avoids extra padded prefill launches" stated as measured with only unit-test evidence — cite reviewer's prefill_steps 2→1 short / 3→2 multi-chunk). N2 merged consistency nits (dead guard :498-500 since baseline_end == prompt_tokens by construction :35-41/:441-444; allocate_terminal_capture :917-963/:960 prices copy at snapshots==0).

Why the PR suite misses B1 (keep in report): linear_costs = capacity*1000 ns (checkpoints.rs:1009-1019), complete_test_step commits dur_ns 1_000, checkpoint_lifecycle_tests.rs:281-285 sets every graph estimated_duration_ns = 1_000 → EWMA far below measured cost, saturating_sub clamps to 0. Regression tests must use measured costs above the chunk interval and assert the number of Anchor-role captures.

Dropped (state briefly): no CI/runner red-check claims raised (PR runs green; two named base failures pre-existing/unrelated); unverified cross-lineage promotion speculation; GraphDescriptor/extra_graphs and terminal_window dedup tidiness; "expand tests" asks superseded by X2/X3; correctness's "no doc mismatch"; architecture blocker #2 reframed.

What the change gets right (include): zero-capacity guard :460-462 placed after initial_prefill_ns (:451-459) so unmeasured-cost accounting still priced; no model-identity branching; overwrite reachability of snapshots==0 confirmed (ignition/cli/serve.py:503, ignition/planning.py:459, boundary_tests.rs:194 loops snapshots incl. 0).

Limit to state: no cargo/pytest here — nothing executed; all code findings from head sources, defect reproductions cited verbatim from the reviewer's live run.

#4 [medium] Brief-support: scoping corrections, dropped noise, policy citations

Facts established for the brief beyond entry 1-3: