Case file — PR #655: helios: probe unmeasured or stale snapshot cost once per TTL on terminal capture
Author: yatesdr (COLLABORATOR; Discord "D-Rock") · State: open, ready for review, opened and last updated 2026-12-01 · Base: main · Head: 2d9454f · Size: 3 files, +253/−9 · CI on head: passed · Labels: none · Reviews: none · Linked: "Fixes #534"
Key findings
- The issue this PR claims to fix is disputed in its own thread, and the PR does not mention it. Issue #534 reports a cold-boot deadlock where
Snapshotis never measured. On 2026-11-28 mark-yong traced that deadlock to a third-party SM120 TP3 fork (AzallazA/hyperflare-inference,ba6a4c11) carryingPrefillTailMerge/prefill_merge_min_rows(ported from closed PR #69, symbols absent upstream), showed that on upstreammain(353551e9)checkpoint_anchorfalls back toprompt_tokenssoanchor > startholds and the first request measures Snapshot, and concluded "unless this reproduces on pure main without PrefillTailMerge, this belongs on the fork and can probably be closed here." On 2026-11-30 a flare-autobot comment on #534 said it "does not reproduce in NVIDIA/hyperflare-inference on origin/main atc146d7be", that "no upstream code change is proposed", and warned that "adding an unconditional terminal-capture probe … would alter the documented freshness contract in docs/scheduling-runtime-design.md … without a demonstrated defect" — recommending closure as fork-specific. PR #655, opened the next day, does exactly that probe and cites neither rebuttal. It reframes the problem onto three other serving scenarios (>30 s decodes, >30 s inter-request idle on an already-cached anchor, warm restart with--prefix-cache-disk/--prefix-cache-pool) and supplies a live before/after for those. Both of the closest field reports of the symptom (#534 itself, and #600) came from forks, which makes "is this an upstream defect at all" the central open question for the decider. - The probe slot is one per
Estimateentry (global across requests), not per request (cost.rs:806-813,checkpoints.rs:1032-1045). Whichever request first needs a terminal capture takes the slot; every other request's terminal capture within the same 30 s TTL still skipsunknown_cost. The new test asserts exactly this (h2skips,unknown_cost == 1, checkpoints.rs:4163-4174). The description's "once per TTL" is literally accurate but reads as more relief than it delivers. - The first probe of a never-measured entry returns
Some(0)(probe_duration, cost.rs:794-804), so that capture can never fail the work-budget check (checkpoints.rs:1050-1054) and is recorded at zero inrequest.checkpoint_copy_ns→stats.checkpoint_extra_work_ns(checkpoints.rs:1091-1096).flare_checkpoint_extra_work_nanoseconds_total(documented as summing charged predicted work, docs/api.md:355) therefore under-reports one copy per TTL. The new test asserts the zero (assert_eq!(scheduler.request(h1).unwrap().checkpoint_copy_ns, 0), checkpoints.rs:4159-4161). Not stated in the description. - Only the terminal-capture gate is relaxed; the prefill-extras gates are not.
checkpoint_selection_uncached(checkpoints.rs:624-626) andcheckpoint_copy_allowed(checkpoints.rs:965-967) still return unknown/false on unmeasured or staleSnapshot. The description's scenario 2 says "both prefill extras and terminalEndpointcapture skip withunknown_cost"; the PR fixes half of that, and the doc edit now says so ("disable prefill extras", docs/scheduling-runtime-design.md:620-626).docs/core-design.md:1452-1455,helios/README.md:378-379anddocs/cli-design.md:696-709still describe the old rule and were not updated — a doc-consistency gap that merged precedents #285 and #568 both avoided by updating documents in lockstep. - Two of the three validation layers that
docs/design-review.mdcalls mandatory for timing-estimation changes are absent, and are not disclosed as skipped. design-review.md:195-208 requires evaluation against the Python simulator and thescripts/scheduling_sim/learning.py(not opened) screening + 64-seed catalog for "timing estimation, refresh or exploration budgets"; design-review.md:209-230 and 247-251 requireverification/helios-lifecycle/check.py(not opened) (and--mutationswhen safety guards change) for changes to snapshot aliases/allocation. #655 reports onlycargo check(4 crates) and unit tests — no simulator run or model (the simulator has no checkpoint/unknown_cost/probe model at all), no lifecycle run or TLA extension. Contrast: #568, which changed this veryallocate_terminal_capturefunction, extendedverification/helios-lifecycle/CheckpointReservation.tlawith aTerminalDestinationaction and rancheck.py (not opened) --mutationstwice; #540 and #645 ran the simulator catalog. Counterpoint: #285, the analogous earlier fix, also supplied only live-hardware A/B. - Stacking and overlap. #655 sits directly on #645's one-day-old rewrite of the same two files (cost.rs +742/−12, checkpoints.rs +229/−36, merged 2026-11-30) and reproduces #285's retained-cost pattern for the
Snapshothalf. It edits theEstimatestruct that open draft #301 ("persist learned graph costs across serving restarts") also edits (verified: on pr/301,Estimateat cost.rs:54 has nolast_probe_nsand there is noprobe_duration), so a textual rebase is expected; conceptually #301 removes #655's unmeasured warm-restart case but not its stale case, which is #655's stale branch. Neither PR cites the other. #654 shares the checkpoint/doc files but is an unrelated mechanism (first-output age pricing).
The change
In plain terms. allocate_terminal_capture used to refuse to allocate a terminal Endpoint checkpoint unless ActionCosts::fresh_duration(GraphKind::Snapshot, 1) returned a measured duration no older than estimate_ttl_ns (30 s default). Because a Snapshot step only runs when some request has an armed capture, that estimate cannot refresh itself: if it is zero or expired, every terminal capture increments flare_checkpoint_skips_total{reason="unknown_cost"} forever, and the skipped checkpoint is neither retained in the GPU prefix tree nor offered to host/disk offload. The PR adds a bounded escape hatch: when the cost is not fresh and checkpoint_extra_work_fraction > 0.0, price the capture with probe_duration and proceed through the normal work-budget and storage-quote checks; if a snapshot is actually obtained, stamp record_probe so the next probe cannot happen for another TTL.
Files and size (+253/−9, 3 files):
helios/src/scheduler/cost.rs(+~90/−5):Estimategainslast_probe_ns: Option<u64>(cost.rs:490), initialisedNoneinprepared(cost.rs:610); newsmallest_batch_key(kind, tokens)(cost.rs:783-786) returnsKey { drafts: 0, kind, batch: self.batches(kind).first(), tokens, prefill: 0, packed: 0 };fresh_duration(788-792) refactored onto it; newprobe_duration(794-804) andrecord_probe(806-813). Plus one unit test (cost.rs:1015-1068).helios/src/scheduler/checkpoints.rs(+~60/−4): the singlefresh_durationgate becomes a 3-arm match (1032-1045);record_probeis called only insideif snapshot.is_some()(1071-1074), so work-budget refusal (1056) andcheckpoint_skip_storage(1080) do not consume the TTL slot; the probed cost feeds the allowance check (1050-1054) andrequest.checkpoint_copy_ns(1077). Plus two integration-style tests (checkpoints.rs:4122-4262).docs/scheduling-runtime-design.md(+9/−4): 617-629 — the "unknown or stale snapshot-copy costs disable prefill extras" paragraph gains the one-probe-per-estimate_ttl_nssentence (622-626), priced against the retained duration when stale.
What it does that the description does not say (all verified in code):
- The zero-cost first probe and the resulting under-counting of
checkpoint_extra_work_nanoseconds_total(finding 3). - The probe slot is global per
Estimate, not per request (finding 2). record_probeis stamped at allocation time, before the copy runs: a dispatch that is refused, cancelled or preempted before the Snapshot step burns the TTL slot with no measurement. Neither new test covers this.- When the entry is stale rather than unmeasured, the capture is priced at the retained duration, which the work budget can refuse (new test:
checkpoint_skip_work_budget == 1,unknown_cost == 0, checkpoints.rs:4209-4216) — so a budget-starved server can go more than one TTL window without refreshing. - The
deferred_prefillearly return (checkpoints.rs:1026-1028, from #613/#550) precedes the probe, so deferred requests cannot consume the slot — correct, but undocumented and untested. - Three docs left stale (finding 4).
What the description says that the change does not do: scenario 2's prefill-extras half (finding 4). Everything else in the description matches the diff: no Protobuf/core-package/CLI/metric-schema change; gated entirely by the existing scheduler_checkpoint_extra_work_fraction (default 0.05, policy.rs:40); nothing happens at fraction 0 (new test, checkpoints.rs:4243-4261).
Differences from the fix sketched in #534: the issue's snippet hard-coded batch: 1 keys and reused last_attempt_ns (self.now_ns.max(1)); the PR shares smallest_batch_key with fresh_duration, so it honours a core whose smallest declared Snapshot batch is not 1, and uses a separate last_probe_ns so probing does not perturb refresh_order/last_attempt_ns used by the funded timing-refresh path (cost.rs:820-829; policy.rs:1530-1606; scheduler.rs:2427-2430). The shared-key helper is what answers mark-yong's batch>1 concern for the probe path — though not for measurement (next section).
The why
Reported problem. #534 ("Checkpoint captures deadlock on an unmeasured snapshot cost: host prefix cache never receives anything", semireg, opened 2026-11-26, still open, labels area:caching/area:selene/bug/performance/priority:P2/triage:investigate) reports flare_checkpoint_captures_total flat at 0, flare_graph_launches_total{kind="snapshot"} flat, unknown_cost skips ~1/request, nothing published to Selene, host DRAM/NVMe prefix cache never hitting, for the whole boot on DeepSeek-V4.1-Flash FP8 TP3 SM120. It claims to be at least one cause of #327 ("Prefill ram cache fills but is never reused") and cites #285 and #292 as precedent.
The self-locking mechanism, verified. fresh_duration(kind, tokens) reads exactly one entry: the smallest declared batch with tokens = 1 (cost.rs:788-792, 783-786). Estimate::fresh requires nanos != 0 and now - observed_at_ns < ttl_ns (cost.rs:515-517), and stale_keys() filters nanos != 0 (cost.rs:815-818), so an unmeasured entry is invisible to the funded refresh path. Only an observed ScheduledStep whose full key is exactly that shape can fill it (observe, cost.rs:857-891, matches the step's actual batch_capacity). A Snapshot step that runs at batch 2 does not measure the batch-1 entry — mark-yong's concern (b) in #534 — and mark-yong's concern (a), anchor <= start so no Anchor cut runs, is exactly #655's scenario 2. The probe targets the same key fresh_duration reads, so it cannot drift to another batch; but it also does not make a batch-2 measurement satisfy fresh_duration. plan_requires_feedback (scheduler.rs:1109-1150, !is_fresh at 1141-1142) forces an unmeasured/zero-priced Snapshot phase to report completion feedback, which is how the probe actually closes the loop through observe.
How long wanted. #285 (dbotwinick, merged 2026-11-13) fixed the prefill half of this class and explicitly left the snapshot half ("the fresh snapshot-copy requirement still governs optional captures"); #292 (iein, closed 2026-11-18) observed 14 unknown_cost skips on a fresh server and closed without isolating them; #534 (2026-11-26) escalated to a deadlock report; #655 (2026-12-01) is the fix. Five weeks from first written acknowledgement.
Related work
| Item | State | Relationship |
|---|---|---|
| #285 fix(cache): retain measured prefill costs after expiry | merged 2026-11-13 | Direct precedent: same self-locking pattern, prefill half; its evidence was live GB10 A/B (TTFT 5.72–5.78 s → 0.43–0.44 s after a 31 s idle gap); it did not report simulator/TLA runs, so #655's omission is consistent with merged precedent here. It authored the doc paragraph #655 edits. |
| #292 branch reuse lost at 0.05 fraction | closed 2026-11-18 | Early observation of unmeasured-snapshot unknown_cost skips (11 work_budget, 14 unknown_cost), never isolated; #655 changes the gate, not the budget rule, so #292's other half stands. |
| #534 checkpoint captures deadlock | open, 2026-11-26 | The "Fixes" target; premise rebutted twice in-thread (see Key finding 1). Refers to #600. |
| #301 persist learned graph costs across restarts | open draft, 2026-11-15 | Competing edit to Estimate/prepared in the same file; would cure the unmeasured warm-restart case only, leaving #655's stale case load-bearing. Neither cites the other; expect a rebase. |
| #540 retain bounded timing-refresh credit across idle | merged 2026-11-29 | Adjacent: keeps funded timing refresh alive across idle. #655 deliberately keeps last_probe_ns out of refresh_order/last_attempt_ns so the two do not double-count refresh budget. #655's description does not mention it. |
| #645 prefill scheduling/cost modeling overhaul | merged 2026-11-30 | The base #655 is stacked on: rewrote cost.rs and checkpoints.rs and touched the same doc section one day before #655 branched. Not reversed, extended. Load-bearing: #655's stale test's 51_200 ns allowance depends on #645's prefill predictor. |
| #568 bound optional Endpoint checkpoint eviction | merged 2026-11-28 | Immediate ancestor of the storage-quote check the probe now reaches (quote_snapshots_with_budget, checkpoints.rs:1059-1070) and the TLA precedent for this function. |
| #582 / #613 / #550 | merged 2026-11-29 | Established the fraction == 0.0 conventions and the deferred_prefill early return #655 preserves. |
| #654 first-output age pricing | open | Shares checkpoints.rs + the same doc section; unrelated mechanism. |
#600 same unknown_cost symptom on a different fork image |
open | With #534, the pattern that upstream-defect claims of this kind originate in forks. |
Recent activity
No default-branch commit since #655's branch point (571a447) touched its three files. The immediate context is e85019b9 (#645, Luke Alonso, merged 2026-11-30) rewriting the same two files plus this doc section, 5deacda9 (#568, Luke Alonso, 2026-11-28) adding the marginal-gain storage quote, c3489b23 (#582, FujitsuPolycom, 2026-11-29) setting the zero-budget conventions, and 97cfeb00 (#285, dbotwinick, 2026-11-13) writing the doc paragraph. Same-day default-branch commits (cd1daa3e #638, a4720050 #625, flare-autobot) touch unrelated subsystems. Nothing in 60 days reverses the freshness contract #655 relaxes: #655 is a forward extension, not a reversal of anyone's work — the only reversal is rhetorical, against the flare-autobot recommendation on #534.
Area ownership over 180 days: helios/src commits — Luke Alonso 233, Martin Vit 52, yatesdr 47. docs — Luke Alonso 387, Martin Vit 55, yatesdr 47.
People
- yatesdr (author, COLLABORATOR, Discord "D-Rock"): 80 merged / 10 closed / 5 open in 180 days. Owns almost exactly this path: #459 "Price checkpoint candidates without walking every prefill chunk" (merged 2026-11-22, same Discord handle), #354 "Estimate checkpoint work without quoting snapshot storage", #357, #415, and commits
7f1ac303"Size ordinary prefill graphs to quoted checkpoint work" and10bc91ad"Estimate checkpoint work without quoting snapshot storage" on checkpoints.rs. Also prior history on this user-facing symptom: on #327 (2026-11-21) they asked the reporter to rebuild on main and posted a controlled GB10/SM121 Qwen3.8-27B DRAM-tier repeat showing host cache does restore (22,878 tokens, 0.17 s vs 9.36 s) when sized correctly — the same complaint #534 says it explains. - Luke Alonso (maintainer): authored #645, #568, #426-adjacent work in these files; has not engaged with #655.
- dbotwinick (#285, the analogous fix), FujitsuPolycom (#540, #582), iein (#292, #550), shadownetX (#301), semireg (#534 filer), mark-yong (strongest technical rebuttal of #534 — on the issue, not the PR), obviouslymarky/mayhem4markets/jcartu (independent #327 reporters).
- Engagement on #655 itself: none — zero comments, zero reviews, zero labels.
Community
No PR-level discussion at all (pr_comments → "No comments"). The only community signal around the change is on the linked issue, and it is sceptical: both #534 comments recommend closing it as fork-specific (2026-11-28, 2026-11-30). Downstream interest exists in #327 (7 comments, several independent reporters, "0% hit rate on RAM prefix cache", "GPU KV 79.7%") and #600 (same unknown_cost pattern on a different fork image). Discord contact "D-Rock" matches the author's other PRs, so internal interest is plausible but not recorded in the PR.
Project fit
Charter statements that line up:
- Vision ("long conversations, coding agents, and heavy tool use") — the three fixed scenarios are those workloads; goals ("Store prefix-cache checkpoints in host memory and share them across Flare instances via Selene") — the PR's direct benefit is that terminal checkpoints reach the host tier again.
- "Keep the runtime small and model-agnostic":
smallest_batch_keyreadsself.batches(kind).first()from prepared core metadata rather than hardcoding batch 1 (as #534's snippet did), so it stays model- and core-agnostic and adds no per-model branch. - "Be explicit and pin everything. No magic defaults": no new default; gated by the existing fraction (policy.rs:40, docs/cli-design.md:696-709).
- "PR descriptions: four parts (why, what changed, claimed result, evidence)" — satisfied and unusually thorough; "Solve the right problem in the right place / smallest footprint" — ~20 production lines in two shared scheduler files; "Bug fixes need to address the root cause" — it addresses the gate, not the symptom.
- design-review.md:186 "
cargo checkdoes not substitute forcargo test" — both are reported.
Charter / design-review statements that do not line up:
- "Bring real evidence… Bug fixes need to address the root cause" combined with "What gets merged: … a reproducible bug": the linked bug's reproducibility upstream is the disputed point (finding 1). The PR's own reproduction is on one GPU, one model, and it does not reproduce #534's cold-boot deadlock, only the three other scenarios.
- design-review.md:195-208 (simulator +
learning.py(not opened) screening/64-seed catalog for timing-estimation rules) and 209-230/247-251 (lifecyclecheck.py(not opened) /--mutationsfor snapshot allocation) — absent, not disclosed as skipped (finding 5). - "Supported matrix & compatibility: check interactions across every supported model, cache scheme, parallel layout, multi-host setup, and hardware target … verify existing data, artifacts and exported cores still load": only
Qwen3.8-Flash-NextTP1 SM120 with disk cache is exercised; the compatibility claim is structural, and no core load-and-serve is reported. - Nothing touches the roadmap items (in-process SDK #6, Engram #267, FlashInfer #215) or any non-goal.
Claims and evidence
- "Fixes #534" via three serving scenarios — evidence: live A/B,
Qwen3.8-Flash-NextTP1, 1× RTX PRO 6000 (SM120),--prefix-cache-memory 4G --prefix-cache-disk … --prefix-cache-disk-limit 16G --lossless-kv-compression off, main3801ff1dvs PR2d9454fe. 33 s idle pause on a fully cached prompt (2922/2922): endpoint captures +0/unknown_cost+1 → +1/+0, and the follow-up's prefillunknown_cost+1 → +0. Warm disk restart (flare_host_cache_hits_total = 1, 2917 reused tokens): +0/+2 → +1/+1 (prefill only). 6000 completion tokens in 31.833 s: both endpoint checkpoints captured at EOS. Well-formed before/after with named SHAs, but no logs, metric dumps or checked-in harness are attached; single GPU, single model, no TP/multi-host; no throughput or TTFT effect of the recovered captures is measured (the 4.5 s → <0.1 s TTFT in #534, or 9.36 s → 0.17 s in the author's #327 comment, are not reproduced here). - Test counts — helios 1,758 (plus
core::cache::selection_tests::failed_default_clear_keeps_the_selected_entryas non-root), flare 242, flare-cli 211 + two individually re-run flakes, 6FLARE_TEST_TEMPLATE_DIRtests left to CI. CI on head is green; the new tests are visible in the diff and drive real entry points (allocate_terminal_capture,probe_duration/record_probe), which design-review.md:187-189 asks for. - "No Protobuf, core-package, CLI, or metric schema changes. Existing cores load and serve without re-export" — verified structurally from the 3-file diff (no wire/CLI/metric code touched); "load and serve" was not exercised.
- "Behavior is shared across all cache schemes and models that declare
GraphKind::Snapshot" — verified by inspection: the only new conditions arecheckpoint_extra_work_fraction > 0.0and the core's declared smallest Snapshot batch; no model or cache-scheme branch. - Absent against a documented gate — no
learning.py(not opened) screen/validate run or simulator model for the new rule; nocheck.py(not opened) /--mutationsrun or TLA extension (finding 5). - Description gap — the description's scenario 2 asserts both prefill extras and terminal capture skip; only the terminal half is fixed (finding 4).
Reach
- Users/operators: anyone running with the default
scheduler_checkpoint_extra_work_fraction = 0.05(policy.rs:39-40;ignition/cli/config.py:39(not opened);--scheduler-checkpoint-extra-work-fraction, docs/cli-design.md:696-709). At 0.0 behaviour is byte-identical (new test, checkpoints.rs:4243-4261). Beneficiaries: host/DRAM/NVMe and Selene-pool restores, because captured terminal checkpoints are what the host tier receives. - Observable signal changes:
flare_checkpoint_captures_total{role="endpoint"}rises where it was 0;flare_checkpoint_skips_total{reason="unknown_cost"}falls;flare_checkpoint_extra_work_nanoseconds_totalunder-reports one probed copy per TTL (zero-priced first probe; docs/api.md:348-355 for counter semantics). - Cost ceiling: at most one extra Snapshot copy per
estimate_ttl_ns(30 s, policy.rs:23/39) is admitted outside the measured-cost path; prefill extras stay disabled while stale, so prefill splitting cannot increase. - Compatibility/dependencies: no new config key, flag, env var, metric, Protobuf field or dependency; no core re-export.
ActionCostsis shared by every graph kind, so the struct edit is the widest blast radius — and the exact spot open draft #301 also edits. - Documentation: only
docs/scheduling-runtime-design.mdupdated;docs/core-design.md:1452-1455,helios/README.md:374-380,docs/cli-design.md:696-709,docs/api.md:348-356left describing the old rule.
Process
Ready for review (not draft), hours old at the time of the packet, CI green on 2d9454f, no labels, no reviewers assigned, no reviews, no comments, not stale against main. Nothing has been escalated or requested; the linked issue carries an explicit recommendation to close, and the PR carries no rebuttal to it.
Open questions / what could not be found
- Does the
unknown_costself-lock reproduce on unmodified upstreammain, as #655 asserts, or only on forks carryingPrefillTailMergeas mark-yong and the flare-autobot comment claim? #655 gives no cold-boot upstream reproduction and does not address either rebuttal; its live A/B covers the three other scenarios only. - Was the
scripts/scheduling_simcatalog ever run for this rule, and is there a simulator counterpart that should have been updated? Nothing in the repo models the checkpoint/unknown_costgate, so the qualified-policy comparison design-review.md:195-208 asks for cannot be done today without adding simulator support first. - Is the zero-priced first probe (and the resulting
checkpoint_extra_work_nanoseconds_totalunder-count) acceptable to operators who size off that counter? No rationale is given either way, in the PR or the doc. - Should the probe be stamped on copy completion rather than allocation, so a refused or cancelled dispatch does not burn the TTL slot? Not discussed or tested.
- Why is the prefill-extras gate (
checkpoint_selection_uncachedat checkpoints.rs:624-626,checkpoint_copy_allowedat 965-967) left on the strict rule when the terminal path is relaxed? The doc now states the asymmetry but does not justify it; the description's scenario 2 implies the user would expect both. - Interaction with #301 if it lands: two competing edits to
Estimate/prepared, and #301's restored-but-stale estimates land straight in #655's stale branch. No cross-reference exists in either direction. - No maintainer position has been recorded anywhere on the PR, the issue, or in the linked #327 thread about whether this class of fix is wanted upstream.