Final review report · NVIDIA/hyperflare-inference #697

Raw Markdown for agents: https://autobot.eidonix.com/p/7ab1208d-d545-4a17-b3e3-8a7d3de47100.md

Recommendation: Changes Requested

The core scheduler change (+29 net production LOC across 4 Rust files, zero unsafe, zero model-name branches or ABI/wire changes) cleanly and safely fixes the <think>-stripping multi-turn prefix-reuse regression disclosed by #660, with strong single-GPU gb10-tp1 A/B gains (+9.74 to +31.78 pp Turn 2+ cache hit, 0 / 108 zero-hit misses, -20.1% to -45.1% total prefill tokens). No merge blockers exist, but three concrete issues should be addressed before merge: an internal documentation contradiction in docs/cli-design.md:709-713, the lack of an end-to-end two-turn divergent-suffix reuse test in helios/src/scheduler/checkpoints.rs, and the undisclosed extra prompt-end Endpoint snapshot published on every preserved open-reasoning turn (ckpt_caps end 60/61/64 → 96) alongside missing benchmark harness command lines in ## Evidence.

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

None.

Should Fix

  1. Fix internal contradiction in docs/cli-design.md:709-713: Lines 699-702 state that under a nonzero fraction an interior message endpoint is "retained without charging its split when the generation prompt opens a reasoning block", but lines 709-711 immediately below still state "Any retained interior anchor split, earlier messages, and a distinct prompt end share the fraction of estimated uncached prefill work" (whereas docs/core-design.md:1449-1451 was properly updated to "when such a budgeted interior anchor is retained").
    • Fix: Change docs/cli-design.md:709 to "Any budgeted interior anchor split..." and clarify at :712-713 that uncharged anchor copies and preserved open-reasoning anchor splits are excluded from budgeted extra-work accounting (flare_checkpoint_extra_work_nanoseconds_total).
  2. Add an end-to-end two-turn divergent-suffix reuse test (helios/src/scheduler/checkpoints.rs:4789-4926): Neither new scheduler test executes a preserve_message_anchor: true Turn 1 through plan() -> commit() -> complete_test_step() to publish Anchor(896) and then admits a divergent Turn 2 (matching 0..896 and diverging in 896..1024, modeling stripped reasoning history). Right now :4790-4865 only inspects checkpoint_selection() / request_anchor_endpoint() without stepping, and :4868-4926 only executes a 512-token Turn 1 with preserve_message_anchor: false and no interior boundary.
    • Fix: Add an isolated test (following #660's Case 1 pattern at checkpoints.rs:4270-4332) that runs Turn 1 (prompt_tokens = 1024, message_boundaries = [896], preserve_message_anchor = true) through prefill publication and asserts that a Turn 2 matching 0..896 with a modified 896..1024 suffix admits with admission_reused_tokens == 896 (and that the same sequence with preserve_message_anchor = false falls back to 1024 and admits with admission_reused_tokens == 0).
  3. Resolve/document the extra prompt-end Endpoint snapshot on preserved open-reasoning turns (helios/src/scheduler/checkpoints.rs:695-697) and add benchmark reproducer commands (## Evidence):
    • Because preserved turns keep anchor = raw_anchor < request.prompt_tokens with anchor_split_ns = 0, checkpoints.rs:695-697 pushes (request.prompt_tokens, RetentionRole::Endpoint) with split_ns = 0 and full prefill allowance intact, publishing an extra GraphKind::Snapshot copy and snapshot row at prompt_tokens on every open-reasoning turn (visible in the PR's own tables: ckpt_caps end rose 60→96, 61→96, 64→96 across 48 turns, i.e., +32 to +36 extra prompt-end snapshots for the exact <think> suffix that Turn k+1 strips; also pinned at checkpoints.rs:4819-4822). While protected_budget (prompt_tokens - raw_anchor, :769-773) bounds eviction under tight snapshot capacity and this matches pre-#660 behavior, it is never mentioned in ## What or ## Trade-offs.
    • Fix: Either confirm whether that prompt-end Endpoint capture is intentionally kept (for exact-prompt replay / pre-#660 parity) and disclose the extra per-turn Endpoint snapshot copy/row in ## What / ## Trade-offs, or skip pushing request.prompt_tokens at :695-697 when !self.budget_interior_anchor(request) if the extra copy is unnecessary. Also add the workload harness repo/commit and exact invocation commands for C=6 x 4 turns and prefill_burst to ## Evidence (matching #660).

Subtract / Simplify

  1. Fold the duplicate fallback arm in checkpoint_selection_uncached (helios/src/scheduler/checkpoints.rs:620-624,662-665): The new if !self.budget_interior_anchor(request) arm at :621-623 executes accounting.budgeted_anchor = None; (raw_anchor, 0) — byte-identical to the pre-existing else arm at :662-665. Changing :620 to if raw_anchor < request.prompt_tokens && self.budget_interior_anchor(request) deletes 4 lines, one nesting level, and the duplicate budgeted_anchor = None above the TLA+ mutation target at :649 with identical behavior across all four reachability cases.
  2. Extract a shared prepare helper in helios/src/server/runtime/phase_tests.rs:8358-8377,871-888: The 18-line let prepare = |...| { ... } closure at :8358-8377 is a verbatim duplicate of the first 18 lines of prepared_budget_request at :871-888. Extracting fn prepare(fixture: &Fixture, protocol: Protocol, body: serde_json::Value) -> PreparedInference removes ~18 duplicated lines and keeps the prepare_inference call site in one place.
  3. Optional — extract a local stepped-cost scheduler helper in helios/src/scheduler/checkpoints.rs:4791-4802,4843-4854,4869-4880: The 10-line [(128, 100), (256, 110), (512, 200)] + Snapshot(1, 5) + configure_policy(fraction) fixture setup is repeated verbatim 3 times in the new tests (and 5 other times earlier in the module); a small fn budgeted_scheduler(fraction: f64) helper cuts ~20 lines.

Nits

Dropped on verification