Verdict: worth merging, with three small changes — none structural
982a9ce3 is a different, much better PR than the one reviewed before. It is now 11 files and roughly +110 net production lines (helios/src/scheduler/cost.rs +89, refresh.rs +12/−10, scheduler.rs +5/−1, two docs, the simulator, two Python test files, and policy_tests.rs +394). PromptSAM copy drafts, wide copy-verify COPY_DRAFT W=16/24 and speculative padding pruning are deleted, so every earlier blocker (the binding.rs (not opened) coercion, cost::Key, has_mtp, the unapproved copy-only graph contract, unaccounted SAM memory, the duplicated dominance predicate) is moot rather than fixed. There is still no human maintainer review on this head; the existing human review applies to commits that no longer exist.
What decides it — charter fit
- "Solve the right problem in the right place / smallest footprint in shared code": yes. No new flag, no per-model branch, no CLI, format, Protobuf or captured-graph change (so no owner approval is needed), and no new runtime knob. It is ~110 lines inside the scheduler that owns the policy.
- "Bug fixes need to address the root cause": yes.
RequestScheduler::idle(scheduler.rs:1163-1170) no longer zeroes the ledgers,RefreshState::idleis deleted, andabortkeeps the clamp (refresh.rs:95-99). The readiness half removes the asymmetry betweenActionCosts::observe(cost.rs:330-337, recordsgpu_ns - wait_ns) and how refresh income and episode charges were computed. - "Bring real evidence" (#210): partly. 804 pytest plus a full crate, simulator and TLA+ sweep is reported — but run on
3e2fcd27and asserted byte-identical, and there is no served-workload number for the motivating case. - Testing hierarchy, layer 2 (refresh/exploration budgets must go through
scripts/scheduling_sim/): satisfied for the timing ledger, not for the acceptance ledger, which has no simulator counterpart at all.
What I verified myself at head
- The zero-charge refresh loop is genuinely closed.
observed_compute_duration_ns(cost.rs:37-45) mirrorsActionCosts::observeexactly — max positivegpu_ns,Nonewhengpu_ns <= wait_ns.timing_refresh_duration_ns(cost.rs:53-57) falls back to physical then wall time, and the only remaining 0-charge case (no GPU sample andwall_ns == 0, plusqueued) is rejected byRefreshState::validate_completion(refresh.rs:63-69) beforecompleteruns (scheduler.rs:2655). No free probe loop survives the real path. - The aggregate bound holds for both ledgers. Income rates (
0.002/0.998,0.01/0.99) and the 5 ms cap are unchanged (refresh.rs:75,78), and retention adds no income, soP <= rate * O + Dis untouched. - The no-op idle cannot drop a live probe.
idle()still errors with any outstanding submission (scheduler.rs:1165-1167), so an active episode can never be silently forgotten. ActionCosts::refresh_order(cost.rs:303-305) is identical tomain(:275-277) — the starvation objection is retired by reverting it.- Simulator:
retain_idle_creditdefaults toFalse(learning_policy.py:44), is boolean-validated, is rejected from--sweep(learning.py:132), and is rejected as a CLI override under--preset validate(learning.py:477-484), so every previously accepted policy is bit-for-bit unchanged.
Must fix before merge (all small)
helios/README.md:437still says "Idle discards positive credit and preserves debt." That is false now. The PR updatesdocs/scheduling-runtime-design.md:436-500anddocs/scheduling-theory.md:577-583,727-738but not this file, which is the one an engine contributor reads.- Three copies of
gpu_ns − wait_ns:cost.rs:334(observe), the newcost.rs:43-44, andcheckpoints.rs:764. Makeobservecall the new helper. Drift between these definitions is exactly the defect class this PR exists to fix, so leaving them duplicated invites the regression back. - Evidence on the actual head: one
cargo test --locked --release --features runtime-core,serveron982a9ce3, plus agit diffproving the tree matches3e2fcd27. Right now "byte-identical" is an assertion, not an artifact.
Should fix
- The acceptance ledger has one-sided evidence. This PR retains
acceptance_credit_ns(refresh.rs:78,85) across idle too, butscripts/scheduling_sim/has no acceptance-learning ledger at all — searches for0.01,0.99,acceptance_creditreturn nothing, and thetargetedpolicy'sharm_alpha/(1-harm_alpha)is a request-delay budget, not this GPU-time ledger. The only coverage is a Rust assertion (policy_tests.rs:2477-2507). Either add the toggle to the simulator's funded acceptance path or state in the body that the acceptance half is Rust-only; the docs currently present both as equally validated (scheduling-runtime-design.md:492-493). - The first request after a long idle now pays for a probe. With credit retained,
refresh_ready()(scheduler.rs:1190) is reachable immediately on resume,select_planreturnsRefreshStart(policy.rs:1240-1274), andplan_requires_feedbackis true for any probe (scheduler.rs:1180), so the triggering request waits out an isolated probe it would never have paid for before. This is the intended trade and is bounded (one nonpreemptible overrun), but nothing gates it: the ≤1.05 p99 TTFT gate covers onlygroup == "core"replenished scenarios, while the idle fixtures (learning_scenarios.py:88-93) aregroup="transient"withpassed=Noneand no stationary gate (learning.py:382-383). The "0 spurious probes" claim is descriptive — those fixtures never reach the 5 ms cap, so they do not exercise "long history, long idle, one request". One such simulator scenario, or one sentence in the body, closes it.
Consider / nits
- The simulator default (
False) now diverges from Helios (which retains), against the design-review rule about not diverging Helios from the simulator's qualified policy. Documented atscheduling-theory.md:577-583, but defaultingTrueforretained-refresh— the policy whose stated purpose is to mirror Helios — would keep them aligned. --retain-idle-creditdoes not retain thetargetedpolicy's harm balances (learning_policy.py:676-677), so the flag is narrower than its name.policy_tests.rs:2566moved the loop from 249 to 248 rounds to absorb the retained 10 ms; the surrounding arithmetic is now less self-evident.- This touches
cost.rs, which open draft PR #301 also modifies (complementary — retained credit makes restored stale entries reachable sooner — but a rebase note).
Who benefits, how much, at what cost
Every serving user whose traffic pauses: idle() fires from the serving loop at each gap (server/runtime.rs:1184), so under the core local chat/agent workload the refresh ledger could never reach 5 ms and stale graph costs were never remeasured at all. That is a lost capability, not a marginal delta — the magnitude is, however, unquantified on hardware. The readiness-wait exclusion is narrower (only Engram-consuming graphs, transport.rs:1049) but fixes a real estimate-versus-charge asymmetry. Cost: ~110 lines, one method deleted, no new flags, no CUDA or graph-contract surface, risk low. The simpler route to the readiness half is the same one I recommend in fix 2: make cost::observe the single definition of compute duration and derive both income and charge from it.
Thread hygiene: no prompt-injection attempt. flare-autobot's comment and @lukealonso's review are review material only; I re-verified their substantive claims at the cited lines rather than trusting them.