Correctness and contracts report · NVIDIA/hyperflare-inference #697

Raw Markdown for agents: https://autobot.eidonix.com/p/ca2e0210-32dd-44c4-9e49-71ee7a66c9b4.md

Correctness, Contracts & System-Level Consequences review — PR #697 (helios/scheduler: preserve interior anchor for open-reasoning prompts, head bfae28a, base cc0a49d)

Key findings

  1. Major — the checkpoint extra-work allowance and the exported extra-work counter stop spanning the interior split for open-reasoning requests. The preserved anchor is recorded with split_ns: 0 (helios/src/scheduler/checkpoints.rs:620-623), and the sole charge site adds only cut.split_ns (:944-949), which also feeds checkpoint_extra_work_ns → flare_checkpoint_extra_work_nanoseconds_total (helios/src/server/metrics.rs:852). The GPU still stops prefill at raw_anchor and launches a tail prefill — precisely the Turn-1 TTFT cost the PR discloses — yet neither the request's allowance nor the counter records it, while docs/cli-design.md:712-713 still states "Extra work includes snapshot copies and additional prefill caused by splitting chunks."
  2. Major — every preserved turn publishes a second, charged snapshot row. The preserved branch skips only the split decision; control still falls into the optional-candidate loop, which pushes a prompt-end Endpoint and charges its copy_ns to the same allowance (checkpoints.rs:695-697, :784-790). Main's unaffordable path put the anchor at prompt_tokens, so no second row existed. Per-turn snapshot rows therefore double for the common reasoning workload — visible in the PR's own ckpt_caps end 60→96 / 64→96 / 61→96 — and this is never stated in the body, with no capacity measurement.
  3. Major — no in-repo test exercises the causal claim. The new tests pin anchor-endpoint selection and split_ns == 0 (checkpoints.rs:4789-4925); nothing publishes a preserved Turn-k checkpoint at the interior boundary and looks it up from a stripped-reasoning Turn k+1, so the "Turn k checkpoint is an exact prefix of Turn k+1" claim rests entirely on author-run, non-reproducible live data.
  4. Minor — preserve_message_anchor is a default-false boolean opt-in across three structs, the shape docs/design-review.md:58-61 says to reject; the meaning is model-independent and charter-compliant in spirit, but the scheduler now consumes a frontend OutputStart concept through a bespoke bool. The Design-Signed-Off-By: trailer (docs/design-review.md:294-299) is not mentioned in the body.
  5. Minor — OutputStart::ToolBody is enumerated in the description but has no test (phase_tests.rs:8352-8589 covers Reasoning, Content ×2, RecipientHeader, RecipientFrame ×2, Completions only), and the preserved path has no cache-ready verification of its anchor (matches main's best-effort branch, so not a regression).
  6. Verified sound: pure-predicate consistency across all three anchor sites, no policy-flip race, readmission/preemption preservation, stale-latch clearing, strict zero-fraction fallback, no new locks/allocation on hot paths, no wire/Protobuf/CLI/core-ABI change, docs updated in all five locations.

Scope and method

I opened the full PR diff and, at head, the changed production sites in helios/src/scheduler/checkpoints.rs, helios/src/scheduler.rs, helios/src/server/request.rs, helios/src/server/runtime.rs, the callers of request_anchor_endpoint / checkpoint_selection_uncached / promote_request_anchor / commit_checkpoint_plans, the exported metric, the new unit and phase tests, and the four edited docs plus helios/README.md. Cross-PR history comes from the discovery dossier (#582 → #660 → #697; open #655/#674/#694).

Area 1 — Correctness, safety, platform parity

Verified sound

// helios/src/scheduler/checkpoints.rs:469-471
fn budget_interior_anchor(&self, request: &LiveRequest) -> bool {
    self.policy.checkpoint_extra_work_fraction == 0.0 || !request.preserve_message_anchor
}

Called at :480 (request_anchor_endpoint), :621 (checkpoint_selection_uncached), :908 (promote_request_anchor). Both inputs are immutable for the life of a LiveRequest (policy.rs:225-228 refuses configure_policy once any request is admitted), so the selection site and the promotion site cannot disagree.

// checkpoints.rs:620-623
let (anchor, anchor_split_ns) = if raw_anchor < request.prompt_tokens {
    if !self.budget_interior_anchor(request) {
        accounting.budgeted_anchor = None;
        (raw_anchor, 0)

checkpoints.rs:908-912 prefixes the latch with self.budget_interior_anchor(request) && …. Asserted at checkpoints.rs:4826-4838 with extra_spent_ns = 1_000 and a stale budgeted_anchor.

Area 2 — Unintended system-level consequences

F1 (Major) — the extra-work allowance and its exported metric no longer span the preserved interior split

The preserved turn still gets a real prefill split, but nothing accounts for it:

// helios/src/scheduler/checkpoints.rs:620-623
let (anchor, anchor_split_ns) = if raw_anchor < request.prompt_tokens {
    if !self.budget_interior_anchor(request) {
        accounting.budgeted_anchor = None;
        (raw_anchor, 0)
// helios/src/scheduler/checkpoints.rs:944-949  (commit_checkpoint_plans)
accounting.reserved_ns = accounting.reserved_ns.saturating_sub(cut.split_ns);
accounting.extra_spent_ns = accounting.extra_spent_ns.saturating_add(cut.split_ns);
self.stats.checkpoint_extra_work_ns = self
    .stats
    .checkpoint_extra_work_ns
    .saturating_add(cut.split_ns);

split_ns is the only component of an anchor's cost that reaches extra_spent_ns and checkpoint_extra_work_ns; the anchor cut carries no copy_ns (:668-673). With anchor_split_ns == 0, the second prefill launch that the anchor forces is invisible to both. The exported counter is stats.checkpoint_extra_work_ns:

and the operator-facing contract still claims the metric covers exactly this work:

Impact: (a) for reasoning workloads the fraction no longer bounds the checkpoint-induced prefill work it advertises — an operator who tightens it to reduce Turn-1 cost sees the extra prefill continue while checkpoint_extra_work_nanoseconds_total reports 0 for it; (b) any dashboard or alarm on that counter under-reports by exactly the interior split on the most common served path (reasoning-enabled Qwen3.8/Nemotron/DeepSeek templates); (c) checkpoint_skip_work_budget (:935) no longer fires for that split, so the "work budget" backoff counters also silently drop.

Fix: keep pricing split_ns and charge it into reserved_ns / extra_spent_ns / checkpoint_extra_work_ns for the preserved anchor (it is work already committed), skipping only the affordability decision — i.e. keep anchor_split_ns non-zero and gate on the explicit preserve_message_anchor predicate rather than zeroing the number. If the exclusion is intentional, add a distinct counter (e.g. checkpoint_unbudgeted_split_nanoseconds_total) and amend docs/cli-design.md:712-713 and docs/core-design.md:1456-1458 in this PR so the metric and doc span stay truthful.

F2 (Major) — preserved turns publish a second, charged snapshot row; per-turn snapshot rows double and the cost is undisclosed

// helios/src/scheduler/checkpoints.rs:666-677
if anchor > start {
    accounting.reserved_ns = accounting.reserved_ns.saturating_add(anchor_split_ns);
    accounting.cuts.push(Cut {
        endpoint: anchor,
        role: RetentionRole::Anchor,
        split_ns: anchor_split_ns,
        copy_ns: 0,
    });
}
if fraction == 0.0 {
    return (accounting, false, false);
// helios/src/scheduler/checkpoints.rs:695-697
if start < request.prompt_tokens && request.prompt_tokens != anchor {
    candidates.push((request.prompt_tokens, RetentionRole::Endpoint));
}
// helios/src/scheduler/checkpoints.rs:784-790
accounting.reserved_ns = accounting.reserved_ns.saturating_add(charge);
accounting.cuts.push(Cut { endpoint, role, split_ns, copy_ns });

Because the anchor is now interior (896) rather than the prompt end (1024), request.prompt_tokens != anchor holds and the Endpoint row is admitted and charged (charge = split_ns + copy_ns, :748). On main's unaffordable fallback the anchor was prompt_tokens, so that condition was false and a turn produced one row. The new test pins the doubled shape:

The PR's own table corroborates it at scale (ckpt_caps … end 60→96, 64→96, 61→96 on three models — one extra row per reasoning turn) and simultaneously shows extra Message rows collapsing (msg 11→0, 2→0, 21→12), because the Endpoint copy now consumes allowance that optional message cuts previously used.

Impact: on snapshot-capacity-constrained deployments the per-turn snapshot footprint of the common reasoning workload roughly doubles, and the previous optional message cuts are displaced — a retention-quality change (fewer mid-conversation recovery points) that no measurement or doc statement in the PR covers. The body's "What" bullet describes only "without debiting split_ns" and "clears accounting.budgeted_anchor = None", never the extra row.

Fix: decide and state the intent. Either return immediately after pushing the anchor cut for preserved requests (one row per turn, matching main's row count and leaving the allowance for message cuts), or keep two rows and add to the body plus docs/core-design.md:1449-1451 an explicit sentence that preserved turns capture both the interior Anchor and a charged prompt-end Endpoint, with a measured snapshot-capacity number for a constrained deployment.

F3 (Major) — preserved turns take two prefill chunks per turn with the split excluded from all allowance accounting, so the extra-work gate cannot throttle them

available is derived only from prefill and fraction, and the spent side is extra_spent_ns + reserved_ns, which for the anchor receives nothing (F1):

// helios/src/scheduler/checkpoints.rs:686-698
let available = allowance(prefill, fraction);
let mut candidates: Vec<_> = request
    .message_boundaries
    .iter()
    .rev()
    .copied()
    .filter(|&end| start < end && end < raw_anchor && request.checkpoint_endpoint_eligible(end))
    .map(|end| (end, RetentionRole::Message))
    .collect();
if start < request.prompt_tokens && request.prompt_tokens != anchor {
    candidates.push((request.prompt_tokens, RetentionRole::Endpoint));
}
// helios/src/scheduler/checkpoints.rs:748-757
let charge = split_ns.saturating_add(copy_ns);
if accounting
    .extra_spent_ns
    .saturating_add(accounting.reserved_ns)
    .saturating_add(charge)
    > available
{
    budget = true;
    continue;
}

For a preserved request the allowance therefore starts at full despite the anchor having already committed a split — the exact work allowance() is supposed to bound. The follow-on prefill is real and unavoidable: estimated_checkpoint_cut / checkpoint_cut return the anchor, so prefill stops at raw_anchor and a second tail prefill runs (the PR's own Turn-1 TTFT increase 5.83–8.98 s → 7.54–9.25 s is that tail).

Impact: under queueing, preserved requests occupy two prefill chunks per turn with no predictive gate, which is the plausible mechanism behind the one regression the PR reports but does not explain: on NVIDIA-Nemotron-3.5-Bolt-74B-A9B-24GB-FLARE (max_active = 4, C = 6) prefill launches rose 90 → 229 and Turn 2+ median TTFT +8.0%. Disclosing a regression without naming its mechanism leaves the reviewer unable to judge whether it is inherent to the rule or an accounting artifact.

Fix: keep the preserved anchor's predicted split counted as already spent when computing available (and in reserved_ns), so downstream high-value captures — message cuts, terminal Endpoint — still back off under load; the preserved decision then affects which anchor is chosen without removing the work from the gate. Alternatively, state in the body that preserved turns double prefill chunks per turn by construction and attribute the Nemotron launch increase to that.

Area 3 — Architecture, contracts, charter compliance

F4 (Minor) — default-false boolean opt-in threaded through Prompt/RequestSpec/LiveRequest, and the sign-off trailer is unaddressed

// helios/src/server/request.rs:427-429
let preserve_message_anchor = output
    .as_ref()
    .is_some_and(|o| o.content.start == crate::output::tagged::OutputStart::Reasoning);
// docs/design-review.md:58-61
Reject per-model boolean policy flags, including `supports_*`, `can_*`, and
default-false opt-ins. Enums, callbacks, schema names, and metadata fields
cannot serve as alternative model allowlists. Review each member and its
consumers for a concrete meaning independent of model identity.

The flag is derived in the server layer (request.rs:427-429), stored on Prompt (helios/src/server/runtime.rs:52), re-emitted by Incoming::spec() (:288), declared on RequestSpec/LiveRequest (helios/src/scheduler.rs:160, :231) and copied in admit() (:1852), then consumed by the scheduler (checkpoints.rs:469-471). Three public structs gained a bool whose meaning is a frontend parser state.

Impact: the scheduler now depends on an OutputStart-derived boolean rather than on the prepared metadata channel it already uses for message_boundaries; a future frontend that opens reasoning through a different enum value silently loses the fix (the enable_thinking=false self-closed <think>\n\n</think>\n\n case is already in that blind spot, per the PR's own limitation). Bundling "default-false opt-in" per principle 3 is a reviewable architectural departure.

Mitigating (state plainly): there is no model-name branch; OutputStart::Reasoning is dialect-independent and set from shared parser state; principle 3's operative concern (docs/design-review.md:56-61) is model allowlists, which this is not.

Fix: carry the fact on the prepared-metadata path the scheduler already consumes (an AnchorPolicy/ReasoningOpen enum alongside message_boundaries inside the existing prepared struct) instead of a bespoke pub bool on three structs, and put one sentence in the body justifying it against principle 3 by name. Also add the Design-Signed-Off-By: trailer required by docs/design-review.md:294-299 — the PR body does not mention it, and this review did not verify the commit trailers.

Contracts / compatibility — no issues

No CLI flag (docs/cli-design.md:699-708 only documents existing behavior change), no Protobuf, no captured-graph or ABI change, no new model branch. Existing signed cores load unchanged; the change lives entirely in helios scheduling. The only operator-visible default change is the semantic of scheduler_checkpoint_extra_work_fraction for reasoning prompts (globally applied, no independent opt-out; the only escape is 0.0, which is blunter than #660's documented 0.15 workaround). That is a genuine behavioral default change with live evidence attached — acceptable under charter #210 — but see F5b.

Merge-order hazard (carried from the dossier, order not decisioned here)

Open #655 rewrites the snapshot-cost gate in the same function (fresh_duration → measured_duration, immediately around checkpoints.rs:681) and edits all four docs this PR edits. #660's reviews flagged the same overlap twice. No ordering decision is recorded on #697. Fix: state the intended order and rebase pointer in the body.

Area 4 — Tests and claim accuracy

F5a (Major) — no test exercises the behavior the PR claims

The two new scheduler tests assert selection, not reuse:

// checkpoints.rs:4918-4924
let h_pres = scheduler.admit(preserved).unwrap();
let req_pres = scheduler.request(h_pres).unwrap();
assert_eq!(req_pres.admission_reused_tokens, 512);
let (sel_pres, _, _) = scheduler.checkpoint_selection(req_pres);
assert_eq!(sel_pres.cuts[0].endpoint, 896);
assert_eq!(sel_pres.cuts[0].split_ns, 0);
assert_eq!(scheduler.request_anchor_endpoint(req_pres), Some(896));

No test publishes a checkpoint at the preserved 896 anchor and then looks it up from a turn whose history drops the reasoning tail. The whole justification — "Turn k's checkpoint is an exact prefix of Turn k+1" — is therefore asserted only by the live A/B.

Impact: the regression this PR exists to prevent (multi-turn reuse collapse) is not guarded in-repo; a future change to checkpoint_anchor() eligibility, promote_request_anchor, or PrefixCheckpointCache::lookup can re-break it with every unit test green.

Fix: add one integration test that runs a preserved turn through prefill + publication, asserts a checkpoint is published at 896, then admits turn k+1 with the reasoning tail stripped from history and asserts self.cache.lookup(...) (or admission_reused_tokens) resumes at 896 rather than 0 — i.e. the same shape as cache.rs:552-579's filter but end-to-end.

F5b (Minor) — the headline evidence is not reproducible from the repo

The body's two performance tables (multi-turn prefix reuse, warm-catalog cold-prefill burst) name no harness, no command line and no raw logs, and the live binaries were built from 298d3e68, not head bfae28a. Sibling PRs in this series name FujitsuPolycom/tokbench with explicit python3 -m tokbench run … invocations. There is also no CI run at head (no checks), which is exactly what #660's Ready-To-Merge review called out.

Impact: charter #210 ("Performance PRs need benchmarks showing an actual speedup over main on a served workload") is met in substance (3 models, 6 boots, binary SHA-256s, cache dropping, disclosed trade-offs) but not in reproducibility; a reviewer cannot distinguish the claimed +9.7…+31.8 pp cache-hit gain from harness behavior, and cannot re-check it after the next rebase.

Fix: link the harness and paste the exact command lines for both workloads, and re-run or explicitly bless the head commit.

F6 (Minor) — OutputStart::ToolBody is listed in the description but untested; the anchor's cache-ready check is now unconditionally skipped for preserved requests

The body lists OutputStart::ToolBody among the non-preserved starts, but helios/src/server/runtime/phase_tests.rs:8352-8589 covers only Reasoning, Content (plain and closed-think), RecipientHeader (ATEM), RecipientFrame (ATEM add_generation_prompt: false and TMLv0) and Protocol::Completions. A search for ToolBody in phase_tests.rs returns nothing, so fault-mutation B (widening == Reasoning to != Content) would not be caught for the tool-body dialect.

Also, preserved requests now bypass the cache-readiness verification of their anchor unconditionally:

// helios/src/scheduler/checkpoints.rs:478-483
if raw_anchor >= request.prompt_tokens
    || request.prefix_tokens == raw_anchor as u64
    || !self.budget_interior_anchor(request)
{
    return Some(raw_anchor);
}

versus the check at :504-519 (history.key_at(raw_anchor) … cache.ready_by_prefix(&key)). On main the same prompt could reach that check when costs were known and affordable; now it never does. This is not a regression in kind — main's None => fraction > 0.0 fallback (:547) also kept the raw anchor unverified — but the bypass is now unconditional rather than cost-conditional.

Fix: add a ToolBody fixture assertion (or drop it from the description), and note the unverified-anchor behavior in the docs sentence that describes the preserved rule so a reader knows the anchor may not be resumable if prefill ends early.

Claim accuracy — items checked and found correct

Open questions / not found

  1. Merge order with open #655 (same function, same four docs, "Ready To Merge"). Nothing in #697 records the intended rebase order; #660's reviews flagged this overlap twice.
  2. Snapshot-capacity cost of the extra Endpoint row per preserved turn — no measurement anywhere, and the body does not discuss it.
  3. Whether the commits carry Design-Signed-Off-By: — not verified in this review; the PR body does not mention it.
  4. Why there is no CI run and no Autobot intake comment at head bfae28a, when every neighbour in the series received both within ~2h. Not determinable from repository state.
  5. Whether the Nemotron 90 → 229 prefill-launch increase is inherent (two chunks per preserved turn, uncharged) or fixable by the accounting change in F1/F3 — the PR discloses it without attribution, and answering it needs the harness.
  6. SM120 TP4 non-thinking workloads were not re-benchmarked. The justification (preserve_message_anchor == false on OutputStart::Content → unchanged code path) is supported by the admission_reused_tokens == 512 unit test but not by hardware measurement; acceptable, but the "unchanged path" claim covers only identity of the predicate, not behavior of the shared downstream code.