Recommendation: Changes Requested
PR #655 is a lean, well-scoped (~20 net production lines) fix for three genuine upstream serving scenarios where ActionCosts::fresh_duration(GraphKind::Snapshot, 1) self-locks terminal Endpoint checkpoint capture behind unknown_cost skips, backed by clean live SM120 A/B evidence and green CI. There are no merge-blocking defects, but three should-fix issues remain before landing: the Fixes #534 claim auto-closes an issue whose cold-boot premise was rebutted twice as fork-specific without addressing that thread, two supporting design docs now contradict the updated rule in docs/scheduling-runtime-design.md, and under concurrent Snapshot work (or client cancel before Snapshot execution) a burned probe slot can fail to refresh smallest_batch_key.
Merge Risk
Level: Low
- Production footprint is tightly localized to
ActionCosts(Estimate::last_probe_ns,smallest_batch_key,probe_duration,record_probe) andRequestScheduler::allocate_terminal_capture, with no wire/Protobuf, CLI, config-default, or metric-schema changes. - Extra work is strictly bounded to at most one
Snapshotcopy perestimate_ttl_ns(30 s default), prefill extras remain gated on fresh costs,checkpoint_extra_work_fraction == 0.0is preserved byte-identically,deferred_prefillreturns early before probing, andlast_probe_nsis isolated fromlast_attempt_ns/refresh_orderso funded timing refresh (#540) is unaffected. - Worst-case failure mode is transient loss of a single 30 s probe window (falling back to the pre-PR
unknown_costskip behavior until the next TTL), with no cache-ownership, fencing, or data-corruption hazard.
Walkthrough
helios/src/scheduler/cost.rs: Addedlast_probe_ns: Option<u64>toEstimate(initializedNoneinActionCosts::prepared), extractedsmallest_batch_key(kind, tokens)(shared byfresh_duration,probe_duration, andrecord_probe), addedprobe_duration(returningSome(estimate.nanos)when not fresh and outside the TTL cooldown—0when unmeasured, retained duration when stale), and addedrecord_probeplus a unit test (probe_duration_uses_smallest_declared_batch_and_bounds_by_ttl).helios/src/scheduler/checkpoints.rs: UpdatedRequestScheduler::allocate_terminal_captureso that whenfresh_duration(GraphKind::Snapshot, 1)returnsNoneandcheckpoint_extra_work_fraction > 0.0, it falls back toprobe_duration(GraphKind::Snapshot, 1), runs the existing work-budget and marginal-gain storage-quote checks against that duration, and callsrecord_probe(GraphKind::Snapshot, 1)only when a snapshot row is actually allocated (snapshot.is_some()). Added two unit tests covering unmeasured and stale/zero-budget terminal capture probing.docs/scheduling-runtime-design.md: Updated the checkpoint extra-work specification (lines 617-629) to distinguish prefill extras (still disabled when snapshot cost is unmeasured or stale) from the bounded one-probe-per-estimate_ttl_nsterminal capture whenscheduler_checkpoint_extra_work_fraction > 0.
Pre-merge Checks
- [PASS] Security / malicious screen: Pure scheduler arithmetic and documentation; no I/O, FFI, parsing, privilege, or untrusted-input surface introduced.
- [PASS] Charter & value fit: Model- and core-agnostic (
smallest_batch_keyuses declared core metadata, no per-model branch or magic default), minimal footprint in the right runtime layer, directly supports host/Selene prefix-cache retention. - [WARN] Related / duplicate / conflict check:
Fixes #534auto-closes an issue whose cold-boot deadlock was rebutted twice as fork-specific (PrefillTailMerge) without addressing the rebuttal; open draft #301 edits the sameEstimatestruct incost.rs(complementary for warm restarts, expected small rebase). - [WARN] Tests & verification evidence: CI (including
helios-lifecycleTLA+ conformance and Kani) is green on2d9454fand live SM120 A/B covers the three claimed scenarios; however, new tests callmeasure(...)manually rather than exercising an end-to-endplan -> commit -> completeSnapshot refresh cycle, and the Validation section omits noting whyscripts/scheduling_simis N/A (no checkpoint model).
Blockers
None.
Should Fix
- Do not auto-close #534 without addressing its fork-specific premise (PR description): Issue #534 reported a cold-boot
captures == 0deadlock that bothmark-yong(2026-11-28) andflare-autobot(2026-11-30) traced to a third-party fork (AzallazA/hyperflare-inference,PrefillTailMerge). This PR fixes three genuinely reproducible upstream scenarios (>30 s decode, >30 s idle on a cached anchor, warm disk/pool restart) rather than #534's cold-boot deadlock. ChangeFixes #534toRelated to #534(or explicitly document the upstream vs. fork distinction on #534) so merging does not silently close the issue under a disputed premise. - Update the contradicting checkpoint-rule docs (
docs/core-design.md:1452-1453,helios/README.md:378-379): Both files still state the pre-change rule ("Unknown prefill costs or unknown or stale snapshot-copy costs exclude extras without excluding the selected anchor" and "Unknown costs exclude extras while preserving best-effort anchor retention"), directly contradicting the new terminal-capture probe now documented atdocs/scheduling-runtime-design.md:620-626. PerAGENTS.md:52-60(and merged precedents #285 and #568), add a one-clause update to both files so the specification stays consistent across documents. - Handle probe-slot loss under concurrent
batch > 1Snapshot coalescing and pre-execution cancellation (helios/src/scheduler/checkpoints.rs:1071-1074,helios/src/scheduler/cost.rs:783-786, 865-890):probe_duration/fresh_durationtarget onlyself.batches(GraphKind::Snapshot).first()(typicallybatch = 1), whileActionCosts::observe(cost.rs:865-890) updates onlystep.batch_capacity. On cores exporting multipleSnapshotbatch sizes (ignition/components/capacity.py:66-68), if a probed terminal capture shares aselect_plantick with anotherRequestPhase::Snapshotrequest (e.g., an unconditionalAnchorcapture atcheckpoints.rs:962-963, aConditionedWindowcapture atscheduler.rs:2864-2866, or afinish_early/preempt_newestcapture atscheduler.rs:1447-1450),policy.rs:1147-1156, 1424-1426selects the widerbatch >= 2cohort whenever both batches are unmeasured or both are stale.observethen recordsbatch >= 2, leavingfresh_duration(GraphKind::Snapshot, 1) == Nonewhilelast_probe_nsis already burned for 30 s.- Similarly, if a client cancels (
scheduler.cancel,scheduler.rs:3022-3024, 3116) in the window betweenallocate_terminal_capture(at EOS) and Snapshot execution, the global TTL slot stays burned with no observation. - Important constraint on the fix: Do not simply move
record_probeto completion—if multiple requests finish in the samecomplete_innerloop (scheduler.rs:2854-2903) or before the first Snapshot step finishes, leavinglast_probe_nsunstamped at allocation would admit multiple concurrent probes at once (violating the 1-per-TTL bound and immediately forcingbatch > 1coalescing). Instead, keep allocation-time gating, clear/restorelast_probe_nsif a probing request retires without its probed Snapshot key being observed (or allowfresh_duration/ probe refresh to be satisfied or retried when a coalesced batch runs), and add an end-to-endplan -> commit -> completetest verifying that a probed terminal capture closes the loop throughobserve_execution.
Subtract / Simplify
- Collapse the triplicated
unknown_costskip inallocate_terminal_capture(helios/src/scheduler/checkpoints.rs:1032-1049): Three separate branches incrementself.stats.checkpoint_skip_unknown_cost += 1andreturn Ok(None). Computingfresh,probed, andcostonce and matching(cost, accounting.initial_prefill_ns)collapses 18 lines to ~11 with a single skip/return site:let fresh = self.costs.fresh_duration(GraphKind::Snapshot, 1); let probed = fresh.is_none() && self.policy.checkpoint_extra_work_fraction > 0.0; let cost = match fresh { Some(cost) => Some(cost), None if probed => self.costs.probe_duration(GraphKind::Snapshot, 1), None => None, }; let (Some(cost), Some(prefill)) = (cost, accounting.initial_prefill_ns) else { self.stats.checkpoint_skip_unknown_cost += 1; return Ok(None); }; - De-duplicate the verbatim test fixtures in
helios/src/scheduler/cost.rs:1016-1055:probe_duration_uses_smallest_declared_batch_and_bounds_by_ttlrepeats the exact 15-lineGraphDescriptorand 10-lineScheduledStepliterals fromfresh_duration_uses_smallest_declared_batch_when_batch_one_is_absentdirectly above it (cost.rs:983-1008). Extracting a tiny shared helper (e.g.,fn snapshot_b2_fixture() -> (ActionCosts, ScheduledStep)) removes ~30 lines of boilerplate.
Nits
docs/scheduling-runtime-design.md:622-626: Consider noting explicitly that an unmeasured probe is priced at0until observed (whereas a stale probe uses the retained duration), and optionally add a brief clause todocs/cli-design.md:699-709for operators reading the--scheduler-checkpoint-extra-work-fractionflag docs.- PR Validation section: Briefly note that
scripts/scheduling_simhas no checkpoint/probe model (consistent with #568) and thatverification/helios-lifecycle/check.pyran via CI (helios-lifecycle.yml) with no row-ownership state transitions added toCheckpointReservation.tla.
Dropped on verification
- Upstream F1 (Blocker/Major: "zero-priced first probe bypasses work budget and under-reports
flare_checkpoint_extra_work_nanoseconds_total; fix with a non-zero fallback"): Dropped as Major/Blocker. On a warm restart allSnapshotentries initialize tonanos == 0(cost.rs:605), and inventing an arbitrary non-zero fallback duration would violate the charter's "no magic defaults" rule. Ordinary dispatch (policy.rs:1309-1311,utility.rs:146-158) andAnchorcaptures (checkpoints.rs:615) already price unmeasured/anchor copies at0, the zero-priced probe happens at most once until measured (stale probes return the retained non-zeroestimate.nanos), anddocs/api.md:355-356documents the counter as charged predicted work. Retained only as a doc-clarity Nit. - Upstream F3 partial claims ("preempted" and "
record.status == 3error" paths burn the probe slot): Dropped as inaccurate.preempt_newest(scheduler.rs:1405-1423) strictly filtersrequest.phase == RequestPhase::Decode, so a request inRequestPhase::Snapshotcannot be preempted. On a completed Snapshot step withrecord.status == 3,self.observe_execution(&submission.step, timing)runs atscheduler.rs:2656before the per-lanerecord.status == 3branch (2684-2688), so any step with positivetiming.gpu_nsstill records a measurement. Only pre-executioncancel()(narrow EOS-to-Snapshot window) and zero/missing GPU timing burn the slot; also rejected the upstream suggestion to naively moverecord_probeto completion because it would allow concurrent probes in a singlecomplete_innerbatch. - Upstream F4 (Major: "missing
scripts/scheduling_sim/learning.pyandCheckpointReservation.tla/check.py --mutationsis a blocking design failure"): Dropped as Major. Verified thatscripts/scheduling_sim/has no checkpoint/unknown_costmodel (same N/A precedent as merged #568 and #285),.github/workflows/helios-lifecycle.ymlalready rancheck.pyandcargo kanion2d9454f(passing), andCheckpointReservation.tla:50-60models row-phase/eviction/deferred-prefill invariants—none of which PR #655 alters. Retained only as a Validation-note Nit. - Upstream F6 (Minor: "stale retained duration exceeding budget causes indefinite
work_budgetself-lock"): Dropped as working-as-designed. Refusing a tiny request whose work allowance is smaller than the retainedSnapshotduration—without burning the probe slot (checkpoints.rs:1056, 1071-1074)—is the exact intended budget guard; any request whose allowance covers the retained cost can still use the unburned probe slot to refresh the estimate. - Upstream F7 (Minor: "
docs/api.md:348-354needs a metric-migration note"): Dropped as low-signal.docs/api.md:348-356defines the skip reason categories (unknown_cost,work_budget,storage) without documenting internal TTL-probing mechanics and remains accurate. - Upstream Scenario 2 overclaim critique ("PR claims scenario 2 fixes prefill extras"): Dropped as false. The PR's Problem section accurately describes the pre-PR symptom (both prefill extras and terminal capture skip), while the Solution section explicitly states "Keep prefill extra cuts disabled while
Snapshotis unmeasured or stale" and the Validation section explicitly attributes the follow-up's+0prefill skips to the terminal probe having measuredSnapshot. - Upstream S4 (Low: "remove
if estimate.fresh(...)guard inprobe_durationatcost.rs:797-799"): Dropped.probe_durationis apub fnonActionCosts; keeping a 3-line self-contained freshness check is safer and clearer than turning it into a caller-enforced precondition.