#1 [high] PR 540 overview: scope, files, claims
PR #540 (open, author FujitsuPolycom), "helios: cost-refresh recovery, prompt+output SAM copy-drafts, and calibrated wide copy-verify". 25 files, ~+3,900/-100. New file helios/src/scheduler/sam.rs (+1606).
Commits: a85be397 (cost refresh: observed_compute_duration_ns excluding readiness wait_ns, credit retained across idle, refresh_order two-tier key), 83ff9ed6 (per-request PromptSAM+OutputSAM copy drafts, LiveRequest::sam at admission when --history-drafts), 35ab143a (draft_source metadata on graphs 1=MTP/2=COPY, selection pruning, CopyCalibration with WIDE_COPY_PRIOR_RATE 0.88 / WIDE_COPY_MIN_MATCH_LEN 6, copy-only step isolation from MTP acceptance), 7ca5430c (dominates_padding_with strictly-wider pruning, DEFAULT_MIN_MATCH_LEN 3->6).
Claims: B16/B32 over-padding eliminated (max_b==C); history-drafts on 512-token repetitive prompt 3.078->3.650 tok/round, 408->460.8 tok/s (+12.9%); non-repetitive adds +0.25 ms/rd opt-in overhead. PromptSAM build 0.80/2.72/13.05 ms at 8k/32k/128k tokens, 0.37/1.27/4.52 MiB; push+propose 140-317 ns/step. Tests claimed: 615 passed helios, 1,625 passed lib w/ runtime-core+server, 102 py tests. Live HW: 4x RTX PRO 6000 Blackwell SM120, DeepSeek-V4.1 Flash TP4 only.
Charter hits: "bring real evidence" (has benches but on one model/one HW), "keep runtime small and model-agnostic", "no per-model special cases or flags" (this is guarded by existing --history-drafts flag but adds draft_source core metadata), "captured-graph op contracts require owner approval" (draft_source is new graph metadata). Roadmap: not on roadmap; cost-refresh recovery is a bug-fix-shaped item.
Discussion so far: only an autobot case-file comment (no human review). Related: #289 (merged fix that bounded history proposals), #287 (crash bug history drafts). Prior art check: Link-Cut Tree claimed in description but code uses splay tree (RootedLct with splay_stack, cut_parent/link) — verify.
#3 [high] Verified export blocker: wide copy-verify is dead on every exported core
VERIFIED INDEPENDENTLY in the repo at PR head and at main.
Chain:
- Producer emits integer draft_source: ignition/preparation/execution.py:32 (
draft_source: int = 1), validated at :102-108 (1 or 2; 2 = COPY_DRAFT; copy-only graphs must have confidence_width==0 and no speculative_prefix_limits), serialized into the graph dict at :316-319. - Only export route to the wire Execution: heliopause/src/export/binding.rs:136
pub(crate) fn execution(...), called once at heliopause/src/export/capture.rs:3158, stored at capture.rs:3160 (output.index.ranks[0].execution = Some(execution)). No other writer found (grep.execution = Somein heliopause returns only that). Python never builds the proto Execution directly (ignition/preparation/execution.py only produces the JSON-shaped dict; runtime_core_pb2 importers are packing/contract/core_file/protection/rebuild_manifest). - binding.rs:196-202, for kind=="speculative" (or mixed && speculative):
graph.insert("draft_source".into(), "MTP".into())at :201 — UNCONDITIONALLY overwrites whatever the producer sent. This line exists on main too (read at ref=main, same line 201), i.e. it predates the PR and the PR did not extend it. - Load side accepts 1 or 2 (helios/src/runtime_core/selection.rs:244
![1,2].contains(&graph.draft_source)), so the coerced "MTP"=1 passes validation silently — no error, no warning. - Retention then drops them: selection.rs:277-298,
copy_widerequiresgraph.draft_source == 2(:280); the fallback MTP branch requiresgraph.draft_source == source(source=1, :291) ANDdraft_tokens <= drafts(mtp-draft-tokens max, :292). A W=16/W=24 copy graph has depth 15/23 > MTP max 7, so it fails both and is pruned. - Also reads draft_source as Copy in serving.rs:58-63 (only ever 1) and cost.rs:229 (
is_copy_only_step, never true).
Consequence: all of commit 3's runtime machinery — CopyCalibration, wide_copy_curve, the copy branch of packed_round_candidates (rounds.rs:755-903), is_copy_only_step — is unreachable on any core produced by the supported export path. It only works in unit tests, which construct GraphDescriptor directly and bypass binding.rs (e.g. helios/src/scheduler/tests.rs:4179-4194).
Why it escaped: pr_files shows heliopause/src/python.rs changed but heliopause/src/export/binding.rs is NOT touched and has no round-trip test for draft_source. The contract checks in helios/src/execution/manifest.rs:844-846 and helios/src/model/catalog.rs:123-131 are also bypassed by the coercion, so copy-only graphs are never contract-validated on a real core.
Fix is small: map the producer value to the enum name (1=>"MTP", 2=>"COPY_DRAFT", other=>invalid) instead of overwriting, plus one binding::execution round-trip test. Note prost_reflect JSON mapping (binding.rs:132 transcode_to) accepts enum name strings, consistent with describe.rs:534 and flare-cli/src/inspect.rs:1609 already using "MTP"/"NO_DRAFT".
#5 [high] Verified doc staleness: three docs now contradict the code
DOC STALENESS — now verified directly (stronger than my last report, where I marked cli-design as "not opened").
docs/cli-design.md:200-201, verbatim: "--history-drafts enables host history tracking and feeds continuations into the captured graphs' history inputs; it does not change the graphs." This is now false: commit 3 makes the flag change which captured graphs are retained and which kernels load — selection.rs:277-298 (copy_wide retention), the kernel prune at selection.rs:375-380, and selection.rs:382-396 rewrites speculative_widths to retained_widths. A flag that used to mean "augment drafts" now silently controls graph retention and must be set at load, not just startup.
docs/cli-design.md:741 (flag table) is stale in the same way: "Augment learned drafts with shared decoded-history continuations; requires enabled speculation and captured history inputs, as Qwen Flash provides" — no mention of per-request SAM, the 6-token threshold, or graph retention.
docs/mtp-design.md:22-29: "It requires speculative graphs that declare copy-token inputs, which only the qwen3.8-flash MTP graphs do. Both settings use the same captured MTP graphs and buffers." Now wrong twice over: the graphs differ (copy-only wide graphs), and admission builds a per-request SAM for any --history-drafts run regardless of recipe.
docs/mtp-design.md:31-40: describes history drafting solely as the 65,536-token shared 4/8-gram ring ("Exact eight-token and four-token indexes match the active request's suffix, preferring eight-token matches"). After this PR the primary source is a per-request prompt+output suffix automaton (sam.rs) with the ring as fallback and min_match_len=6 (sam.rs:22). "Prompt ingestion ... do[es] not populate the ring" is carefully still true — the SAM is deliberately separate, which is exactly the right-problem argument (see entry on SAM-vs-ring).
Docs ARE correct where the PR updated them: docs/scheduling-runtime-design.md (+31/-23) now documents compute-duration credit, idle-retains-credit ("accumulates across idle-separated requests"), the two-tier refresh order, and the Startup/abort asymmetry. That is a genuinely good, invariant-preserving doc update — worth saying so, and it is why the gap in the other three docs is a consistency problem rather than a sloppiness problem.
NOT updated but should be: helios/manifest.md (draft_source is a new GraphDescriptor/wire field, proto runtime_core.proto:842/854); docs/scheduling-runtime-design.md module index (:6-12) for the new sam module; the new strictly-tighter-batch pruning rule (nothing describes it); and the copy/MTP packed-duration split (cost.rs:190-208).
#6 [high] Correction: the graph contract is not just unapproved, it is unenforceable
CORRECTION to my previous report: I said the wide-copy graphs needed owner approval as a "new captured-graph op contract" — that is the right charter clause, but I now have the precise mechanism and it is worse than "needs approval": the contract is unenforceable because of the binding.rs:201 coercion. The copy-only contract rules (execution.py:104-108, helios/src/execution/manifest.rs:844-846, helios/src/model/catalog.rs:123-131) are all bypassed on a real core, so nothing checks a copy-only graph's confidence_width/prefix-limits/no-copy-buffers on the only path that matters. Approval discussion should note the contract must first become reachable.
Also note graph kinds: ignition/preparation/execution.py:104-105 permits draft_source==2 on mixed with speculation enabled, but helios/src/runtime_core/selection.rs:278-283 gates copy_wide on graph.kind == "speculative", and helios/src/model/catalog.rs:94-96 also requires GraphKind::Speculative. So mixed+copy is accepted by the producer and then ignored/pruned by the runtime — a producer/runtime disagreement, harmless today, another reason to nail draft_source to one authority.
Measured-load claim to re-examine: helios/src/model/tests.rs (added ~+324) and helios/src/scheduler/tests.rs:4173-4194 both construct copy graphs as GraphDescriptor literals. That is why 1,710 passing tests coexist with a feature that cannot run: no test crosses the export boundary. Recommend the cheapest possible guard — a binding::execution round-trip test — as a merge condition, because it is the only test that would have caught this.
Third-party comment note: the only comments on the PR are from flare-autobot (an automated bot), including the 17:56 Changes Requested review. There is still NO human review, and my prior report's "no human review" observation stands. Nothing in the thread attempted to instruct me; the bot comment is review material I independently verified at the cited lines rather than trusted.
#8 [high] Re-verified head e5a69669: export blocker fixed, commit 3 now reachable but still unevidenced
VERIFIED FIXED at e5a69669:
- heliopause/src/export/binding.rs:201-216 now derives instead of overwriting: None => "MTP"; as_u64 0|1 => MTP, 2 => COPY_DRAFT; as_str "MTP"/"COPY_DRAFT"; else Err("unsupported graph draft_source"). Rejects "COPY_DRAFT" on kind != "speculative" (binding.rs:213-215).
- Round-trip test added: export::binding::tests::execution_preserves_mtp_and_copy_draft_source_and_rejects_unknown (binding.rs:1461-1511) asserts wire DraftSource::CopyDraft survives encode/decode, and rejects 3, -1, "UNKNOWN", and mixed+copy.
- Contract now enforced on the real path: helios/src/execution/manifest.rs:845-846 rejects Copy with confidence_width != 0; :849-850 rejects draft_source on non-speculative/non-mixed; model/catalog.rs:94-96,123-131 enforces copy-only graph has no GPU confidence and no SpeculativePrefixLimit.
- Producer validation tightened: ignition/preparation/execution.py:104-105 now
if self.kind != "speculative": raise(previously permitted mixed+speculation_enabled) — matches runtime selection.rs:278-283. Test: tests/preparation/test_execution.py:374-393.
MY PRIOR NOTES #3 and #6 (silently dead / contract unenforceable) ARE NOW RESOLVED. Corrected finding: commit 3 is reachable on the supported path.
BUT still no evidence:
- No in-repo producer emits draft_source=2. Only producer touchpoint is ignition/preparation/execution.py:32 (default 1) and :316-319. The recipe-side copy_verify_shapes lives in out-of-repo local-inference-lab/hyperflare-recipes#48/#49.
- PR Limitations, verbatim: "Per-commit isolated live GPU A/B benchmarks on e5a69669, live GPU export/replay of wide copy-verify (W=16/W=24) graphs, live power-limit cost-refresh transitions ... were not run on hardware."
- @voipmonitor (priority contributor) 2026-11-26 23:53: live TP4 run was --no-history-drafts with default copy_verify_shapes=(); "opt-in wide copy-verify W=16/24 live GPU serving was not enabled in this run and remains separately to be qualified." => commit 3 satisfies correctness now but not charter #210 (measured speedup on a served workload), and adds a new captured-graph contract requiring owner approval.
#9 [high] Latent cost::Key / has_mtp defects now fixed at e5a69669
My prior note #4 ("cost::Key omits draft_source; has_mtp existence scan masks measured copy durations") is RESOLVED at e5a69669:
- cost.rs:50-59 canonical_draft_source(kind, source) — Some(unwrap_or(Mtp)) for Speculative, None otherwise.
- cost.rs:63-79 Key gains
draft_source: Option<ProposalSource>; Key::from_step uses canonical_draft_source. Estimate.draft_source removed (cost.rs:97). - cost.rs:204-221 refresh_packed_durations now fills
[[Vec<Option<u64>>; 7]; 2](indexed by ProposalSource as usize); has_mtp existence scan deleted. - cost.rs:237-252 packed_round_duration combines: positive MTP first, then positive COPY, Some(0) only when no positive measurement exists.
- Duplicate-shape risk gone on both sides: selection.rs:302-312 dedups wire variants including draft_source; catalog.rs:240-303 adds select_shape_with_source; packing.rs:40-52 matches_step checks draft_source.
- Test: cost.rs:533-585 unmeasured_mtp_and_measured_copy_coexist_at_identical_shape_and_preserve_packed_duration builds MTP+copy at identical B/D/W/P and asserts both exist and pack durations stay separate.
- is_copy_only_step moved off the cost table (scheduler.rs:1196-1199 now reads step.draft_source), removing the need to infer source from the table.
Also fixed: resolve_copy_match (scheduler.rs:1119-1146) now filters shared lookups by count>0, unifying the two previously drifting proposal paths; ProposalSource::from_wire/to_wire unified (speculation.rs:55-69) and used in selection.rs:144-148, serving.rs:55-58, python.rs:225-232.
NOTE: wide_copy_curve (rounds.rs:570-579) now .expect("wide copy requires history drafts enabled before admission") — verified unreachable-with-None by construction (copy candidates only emitted when decoded_history.is_some(), rounds.rs:886; copy_calibration built at admission iff decoded_history.is_some(), scheduler.rs:1847-1850). Still a new panic path in the scheduler where a fallback existed before; worth a comment or a debug_assert-based fallback.
#10 [high] Remaining issues at e5a69669: duplicate dominance predicate, no SAM memory accounting
Still present at e5a69669 (unaddressed by the review-fix commit):
-
TWO INDEPENDENT "DOMINATED" PREDICATES.
- policy.rs:137-201 dominates_padding_with: 4-branch GPU-ragged path with three early returns (:143-169, :170-177, :179-201).
- policy.rs:230-264 prune_padding: second pass re-implements a weaker, differently shaped predicate inline (other.batch >= lanes && < candidate.batch && same capacity && same draft_tokens && packed >= needed && gpu_prefix_allocation). It does NOT route through dominates_padding_with.
Now also gated on
other.draft_source == candidate.draft_source(:251) and grouping includes draft_source (:213). Two predicates that must agree, written separately => silent over/under-pruning risk. Tests do pin both sides (policy_tests: tight_batch_prunes_wider_padded_ragged_speculative_shapes_for_active_cohort; wider_speculative_batch_is_retained_when_tighter_batch_lacks_token_capacity) but nothing asserts they never disagree on a dominated pair.
-
SAM has no memory accounting. PromptOutputSAM::memory_bytes / dynamic_memory_bytes were DELETED in e5a69669 (now #[cfg(test)] PromptSAM::memory_bytes at sam.rs:424-431, and the test at sam.rs:1297 computes total_mem inline). Verified no production reader: grep for memory_bytes/SAM in runtime_core/limits.rs => no matches. Per-request footprint is up to a 131,072-token PromptSAM (~4.5 MiB measured) plus a 131,072-token OutputSAM + LCT nodes. At C=16..32 this is plausibly hundreds of MiB of ungoverned host RAM, while MemoryLimit machinery exists. This got strictly worse than my last report (the accessor was removed rather than wired in).
-
Duplication partly reduced, not eliminated:
- rounds.rs wide-copy loop now DELEGATES to the shared select_host_allocated_candidate + build_host_prefix_ranking (rounds.rs:927-934 vs 966-971), so the ~112-line duplicated loop is genuinely collapsed. Good — this is the largest single cleanup.
- Dead SAM API removed: propose_for_context, propose_conditional_continuations, MatchSource/source, SamConfig, PromptSAM::build, push_slice, from_shared_prompt, unread accessors, step/walk_context. PromptSAM is now
struct(not pub, not Arc) — sam.rs:236-239.Arcsharing is gone entirely, which also removes the "half-wired generality" objection. Remaining pub surface is Push/propose only. - Empty RefreshState::idle deleted (refresh.rs) and its no-op test calls removed (policy_tests.rs:3684-3687).
- Zero-count ring drift fixed via resolve_copy_match (scheduler.rs:1119-1146).
-
Constant derivations DO exist now: WIDE_COPY_PRIOR_RATE 0.88, COPY_STEP_PRIOR_WEIGHT 4.0, COPY_DEPTH_SHRINK_WEIGHT 2.0 documented at speculation.rs:14-36; WIDE_COPY_MIN_EXTRA_DRAFTS = 3 documented at rounds.rs:24-31; DEFAULT_MIN_MATCH_LEN = 6 documented at sam.rs:22-27. They are arguments, not measurements, but "Be explicit and pin everything" is now satisfied in form.
-
observed_compute_duration_ns saturating_sub nit NOT fixed: cost.rs:31-34
duration.saturating_sub(wait_ns)yields Some(0) when readiness wait exceeds the measured interval — zero credit, no debt, no wall_ns fallback (Option is Some). No test pins this.
#11 [high] Docs staleness resolved at e5a69669
Verified at e5a69669 (only docs/scheduling-runtime-design.md had been updated before):
- docs/cli-design.md:200-210 now correctly says --history-drafts retains copy-only speculative graphs, keeps their widths in speculative_widths, and that pruning otherwise drops kernels and rewrites speculative_widths. The old false "it does not change the graphs" is GONE.
- docs/cli-design.md:747 flag table now includes per-request prompt-and-output suffix-automaton + shared decoded history + wide copy-only retention.
- docs/mtp-design.md:22-66 rewritten: two indexes (PromptOutputSAM with 131,072 caps, 512-token boundary overlap, min_match_len 6, recency tie-break, OOV truncation; shared ring 65,536 with 8/4-gram), SAM-first with ring fallback on strictly longer match, capacity bound min(completion_token_capacity-1, 63), and preempt->readmit re-indexing.
- docs/mtp-design.md:29-33 documents copy-only graph retention/pruning.
- docs/scheduling-runtime-design.md:6-15 module index now lists sam.rs, decoded_history.rs, checkpoints.rs, speculation.rs with copy-survival; :71-91 new "Proposal sources and calibrated wide copy-verify" section (draft_source, copy-only contract, retention rules, CopyCalibration constants); :271-285 stricter-batch pruning rule; :409-433 cost entry identity includes proposal source plus per-source packed duration tables.
- docs/scheduling-theory.md:577-582 and :714-737 now distinguish the simulator (idle discards credit) from Helios (retains bounded credit across idle, excludes readiness wait from timing-refresh credit, two-tier refresh order).
- helios/manifest.md:38 documents draft_source on the Python manifest dict.
=> My prior note #5 (three docs contradict the code) is RESOLVED. No stale claim found in the five files.
Still undocumented / minor: the dominance predicate duplication rationale, and SAM per-request memory has no budget line anywhere.
#12 [high] Shipped head e5a69669 is not the measured head — live A/B must be re-run
NEW evidence gap created by e5a69669 that did not exist at 14019718:
The PR's two live numbers were measured at the PRIOR head:
- "Combined-stack live serving (flare run, 4x RTX PRO 6000 Blackwell, ... prior head
14019718)" — PR description, Result section. - padding dominance max_b == C at C=4,6,8,12,16 and 9.19 vs 9.55 ms/rd at C=4 (+5.1%), -7.9% at C=6, -5.2% at C=8 — all at 14019718.
- SAM +12.9% tok/s (408.0 -> 460.8), 3.078 -> 3.650 tokens/round — at 14019718.
- Author admits: "per-commit live GPU A/B on e5a69669 remains unrun on hardware and is disclosed in the PR limits."
WHY THIS MATTERS: e5a69669 substantially refactored the exact code path those numbers traverse:
- rounds.rs:937-972 now hoists
gpu_alloc = self.gpu_prefix_allocation(...)before the fixed-width branch and routes the non-GPU host-allocated MTP path through the NEW sharedselect_host_allocated_candidate(rounds.rs:764-862), replacing the inlinehost_ranking/lane_termsblock that previously lived at ~:991-1060. - The C=4..16 padding-dominance measurement is precisely a host-allocated multi-lane cohort selection. The refactor changed how
expectedandhost_lengthsare produced on that path (best tracked as (mask, value, value_zero) and expected recomputed after the loop). - policy.rs add_candidate/mixed_candidates also changed (zero_duration reuse, policy.rs:1022-1117, 1226-1302).
- cost.rs key/packed-duration lookup changed (packed_round_duration now consults two tables, cost.rs:237-252), which feeds
speculative_duration(rounds.rs:585-594) andpolicy.rs:785.
So the shipped head is not the measured head. The refactor is plausibly behavior-preserving and the unit suite (1,712) covers much of it, but "Performance PRs need benchmarks showing an actual speedup over main on a served workload (#210)" is now satisfied only for 14019718. A single re-run of the C=4..16 padding sweep plus the 512-token repetitive-prompt SAM cell on e5a69669 closes this.
No human maintainer review yet. @voipmonitor (priority contributor) verified live but explicitly with --no-history-drafts and default copy_verify_shapes=(), so their sign-off does NOT cover commits 2 or 3. Nothing in the thread attempted to instruct me; the only bot content is flare-autobot review text, and I verified its claims at the cited lines rather than trusting them.
#14 [high] Report of 2026-11-27, run 1403 (v4) — PR 540 rewritten to 982a9ce3: worth merging, three small fixes
Verdict: worth merging — the scope is now right and the change is small; three small fixes, none structural
The PR changed shape entirely
Old: 25 files, 4 commits, ~+4,300 lines (cost refresh + SAM copy drafts + wide copy-verify + padding dominance). All my earlier blockers concerned commits 2-4.
New at 982a9ce3 (rebased onto main 353551e9): 11 files, production code +~110 net lines — helios/src/scheduler/cost.rs +89, refresh.rs +12/-10, scheduler.rs +5/-1, plus 2 docs and simulator/tests (policy_tests.rs +394, 2 python test files +90, learning.py +7/-4, learning_policy.py +5/-1). SAM, wide copy-verify, COPY_DRAFT, padding pruning: gone. Every prior blocker on those is moot.
What I verified at head
RequestScheduler::idle(scheduler.rs:1163-1170) no longer callsrefresh.idle();RefreshState::idledeleted (refresh.rs:95-99 keeps onlyabort, which still clamps both ledgers tomin(0.0)).idle()is called from the serving loop exactly when nothing is outstanding (server/runtime.rs:1184) — the motivating case.observed_compute_duration_ns(cost.rs:37-45) mirrorsActionCosts::observe(cost.rs:330-337) exactly: max positivegpu_ns,None/return whengpu_ns <= wait_ns.timing_refresh_duration_ns(cost.rs:53-57) falls back to physical then wall → charge strictly positive.- The zero-charge loop is genuinely closed: the only 0-charge case is gpu absent and wall==0, and
RefreshState::validate_completion(refresh.rs:63-69) rejects that (plus queued) beforecompleteruns (scheduler.rs:2655 then :2657). So no free probe loop through the real path. - Acceptance ledger still uses raw physical
observed_duration_ns(refresh.rs:77-79, :83-85); timing ledger uses compute. Matches the docs and the stated intent. ActionCosts::refresh_order(cost.rs:303-305) is identical to main (cost.rs:275-277) — lukealonso's starvation item resolved by reverting.- Simulator:
retain_idle_creditdefault False (learning_policy.py:44), boolean-validated, excluded from--sweep(learning.py:132), rejected as a CLI override under--preset validate(learning.py:477-484). Existing validated policies unchanged. - Docs updated at scheduling-runtime-design.md:436-473,489-500 and scheduling-theory.md:577-583,727-738.
Residual issues
helios/README.md:437still says "Idle discards positive credit and preserves debt." — stale, contradicts the change; the PR touches 2 docs but not this one. Verified at head and main.- Three definitions of "gpu minus readiness wait": cost.rs:334 (
observe), cost.rs:43-44 (new helper), checkpoints.rs:764.observeshould call the new helper so they cannot drift — the exact bug class this PR fixes. - Simulator default now diverges from Helios (default False vs Helios retaining). Documented in scheduling-theory.md:577-583 but inverts the design-review rule "don't diverge Helios from the simulator's qualified policy"; consider defaulting True for
retained-refresh. - Evidence is on 3e2fcd27, not on the PR head (asserted byte-identical tree). One
cargo test --locked --releaseon 982a9ce3 + agit diffof the two trees would settle it. Also no served-workload number for the motivating case (idle gaps < 2,495 ms) — simulator-only. Kani/mutations not run (argued untouched; the new positive-charge fallback is arguably a new guard). - Nit: policy_tests.rs:2566 changed 249→248 ordinary rounds to absorb the retained 10 ms, making the arithmetic less obvious.
Benefit / cost
Beneficiary: every serving user whose traffic pauses — the core local chat/agent pattern, where idle() fires at every gap, so the refresh ledger can never reach 5 ms and stale graph costs are never remeasured. Structurally a lost feature, not a marginal delta, though magnitude is unquantified on hardware. Readiness-wait exclusion is narrower (Engram-backed graphs only, gated by crate::engram::consumes, transport.rs:1049) but fixes a real asymmetry. Cost: ~110 production lines, one method deleted, budget bound P <= 0.002/0.998*O + D preserved (credit still capped at 5 ms, earned only from ordinary compute). Risk low. No new runtime flags, no per-model branch, no CUDA/graph-contract change (no owner approval needed).
Thread: no prompt-injection attempt; the flare-autobot comment and lukealonso's review are review material only.
#15 [high] Final-pass checks on 982a9ce3: no new hole found; flag is narrower than its name for targeted
Verified in the final pass at 982a9ce3
RefreshState.activeinteraction is safe:RequestScheduler::idleerrors when any submission is outstanding (scheduler.rs:1165-1167), so a live probe episode cannot be silently dropped by the new no-op idle.abort()is still called onrelease_after_shutdown(scheduler.rs:3062) and still clamps both ledgers tomin(0.0)(refresh.rs:95-99).- Aggregate bound preserved for both ledgers: credit is only ever earned at
0.002/0.998(timing) and0.01/0.99(acceptance) from ordinary duration and clamped toCREDIT_CAP_NS(refresh.rs:75,78), so retaining across idle cannot exceed the cap or theP <= rate*O + Dbound. Retention changes neither income nor cap. - Positivity of the refresh charge is guaranteed two ways: compute duration is
observed - waitwithobserved > wait(cost.rs:43-44), and the zero path (observed_duration_ns == None && wall_ns == 0, plusqueued) is rejected beforecompletebyvalidate_completion(refresh.rs:63-69) at scheduler.rs:2655. docs/scheduling-theory.md:682("Idle clears positive balances and retains debt") is still correct: that sentence describes thetargetedpolicy'sharm_credit_ms, which learning_policy.py:676-677 still clamps unconditionally. So the new flag is narrower than its name — fortargetedit retains only the GPU-timecredit_ms, not the harm balances. Nit-level: the flag help text (learning.py:440) doesn't say so.- Transient/idle simulator scenarios (learning_scenarios.py:88-93: idle-29/31/120/3600s, idle-short-burst) are
group="transient", soevaluategives thempassed=Nonewith "no stationary performance gate" (learning.py:382-383) — they have no recovery_best, so the "0 spurious probes" claim in the PR body is descriptive, not a gated assertion. Fine, but the gate does not enforce it. - Adjacent open work: PR #301 (persist learned graph costs across restarts, open draft, touches cost.rs and restores entries as known-but-stale) intersects this file; #510 (merged) is the prior packed-duration fix already in main. Retained idle credit makes persisted stale entries reachable sooner after restart — complementary, not conflicting, but a rebase note.
Final verdict stays: worth merging, three small fixes (helios/README.md:437 stale line; make observe reuse observed_compute_duration_ns so the three copies at cost.rs:334/43-44 and checkpoints.rs:764 cannot drift; one crate-test run + one served-workload number on 982a9ce3 itself).
#16 [high] Acceptance-learning retention has no simulator counterpart — one-sided evidence
Asymmetry the PR body does not flag
The simulator validates only the timing-refresh ledger. There is no acceptance-learning ledger in scripts/scheduling_sim/ at all: grep for 0.01, 0.99, acceptance_credit, learning_credit across the package returns nothing (learning_policy.py has only credit_ms + harm_credit_ms/harm_ordinary_ms; the targeted policy's harm_alpha/(1-harm_alpha) at :640-646 is a request-delay budget, not the 0.01/0.99 GPU-time ledger).
So 982a9ce3 changes two ledgers:
credit_ns(timing refresh,0.002/0.998) — validated:--retain-idle-creditadded, 64-seed--preset validatecase in the body, new policy test test_scheduling_learning_policy.py:1529-1571.acceptance_credit_ns(acceptance learning,0.01/0.99, refresh.rs:78,85) — no simulator counterpart, no simulator validation, only a Rust assertion folded into policy_tests.rs:2477-2507 (acceptance_earnedround-trip throughs.idle()).
docs/design-review.md testing-hierarchy layer 2 says changes to "refresh or exploration budgets" must be evaluated against scripts/scheduling_sim/. The acceptance half of this PR therefore has one fewer evidence layer than the timing half, and the docs present both as equally validated (scheduling-runtime-design.md:492-493). Either add the retention toggle to the simulator's funded acceptance path, or scope commit wording/PR body to say the acceptance ledger is asserted in Rust only. Not a blocker — the bound argument (P <= 0.01/0.99 * O + D unaffected because income and cap are unchanged, refresh.rs:78) holds by inspection — but it is the one place the evidence does not cover the change symmetrically.
#17 [high] First request after idle now pays for a probe — intended, but no gate covers it
Residual user-visible cost, ungated
Because credit now survives idle, the first request after a long idle can start a funded refresh probe immediately: refresh_ready() (scheduler.rs:1190) is reachable as soon as credit is at cap, select_plan (policy.rs:1240-1274) will return RefreshStart(target), and plan_requires_feedback returns true for any probe (scheduler.rs:1180), so the probe runs isolated — the triggering request waits for the whole probe program (e.g. 145 ms for Prefill(8192)) before its own plan runs.
- Before this PR that never happened after idle (credit was zeroed), so the first request after a pause was always the cheapest.
- This is the intended trade (recovery instead of permanent staleness), and it is bounded: at most one nonpreemptible overrun,
P <= 0.002/0.998 * O + D. - But it is not gated anywhere: the simulator's TTFT gate (
p99_ttft ratio <= 1.05, learning_analysis.py:97-98) applies only togroup == "core"scenarios, which are continuously replenished. The idle scenarios (idle-29s..3600s,idle-short-burst, learning_scenarios.py:88-93) aregroup="transient"and getpassed=None, semantics="transient/stress measurements; no stationary performance gate"(learning.py:382-383). The PR body's "0 spurious probes" on those fixtures is descriptive: with cold-start Discovery origin plus only ~64 tokens of compute per burst, credit never reaches the 5 ms cap, so no probe fires — the fixture does not exercise the "long history, then long idle, then one request" case that does fire.
Recommendation: one added simulator scenario (warm 2,495 ms of ordinary service → 1 h idle → one short request) asserting the probe and reporting its TTFT delta, or a sentence in the PR body/docs acknowledging first-request-after-idle latency is spent on recovery by design.
#18 [high] FINAL report text — PR 540 at 982a9ce3
Final report (entry for the finish call)
Verdict: worth merging, with three small changes — none structural
982a9ce3 is a different, much better PR than the one reviewed three times before: 11 files, ~+110 net production lines (helios/src/scheduler/cost.rs +89, refresh.rs +12/−10, scheduler.rs +5/−1, 2 docs, simulator + 2 python test files, policy_tests.rs +394). PromptSAM copy drafts, wide copy-verify COPY_DRAFT W=16/24 and speculative padding pruning are deleted, so every prior blocker (binding.rs coercion, cost::Key, has_mtp, unapproved graph contract, unaccounted SAM memory, duplicated dominance predicate) is moot rather than fixed. No human maintainer review on this head.
Charter fit
- "Solve the right problem in the right place / smallest footprint": yes — no new flag, no per-model branch, no CLI/format/protobuf/captured-graph change (no owner approval needed), shared scheduling code only.
- "Bug fixes need to address the root cause": yes —
idle()(scheduler.rs:1163-1170) no longer zeroes the ledgers;RefreshState::idledeleted,abortkeeps the clamp (refresh.rs:95-99). - "Bring real evidence": partly — 804 pytest + a full crate/simulator/formal sweep, but executed on
3e2fcd27and asserted byte-identical, and no served-workload number for the motivating case. - Testing hierarchy layer 2 (refresh/exploration budgets → simulator): satisfied for the timing ledger, not for the acceptance ledger, which has no simulator counterpart at all.
Verified correct at head
- Zero-charge loop closed: compute duration mirrors
ActionCosts::observeexactly (cost.rs:37-45 vs :330-337); 0-charge case rejected byvalidate_completion(refresh.rs:63-69) beforecomplete(scheduler.rs:2655). - Bound preserved for both ledgers: income rates unchanged, cap unchanged, retention adds no income (refresh.rs:75,78).
- A live probe cannot be dropped by the no-op idle:
idle()errors with any outstanding submission (scheduler.rs:1165-1167). refresh_orderis identical tomain(cost.rs:303-305) — starvation objection retired by revert.- Simulator default
retain_idle_credit=False(learning_policy.py:44), bool-validated, sweep-rejected (learning.py:132), CLI-rejected under--preset validate(learning.py:477-484); previously accepted policies unchanged.
Must-fix (small)
helios/README.md:437still says "Idle discards positive credit and preserves debt" — false now; not among the two docs updated.- Three copies of "gpu_ns − wait_ns": cost.rs:334 (
observe), cost.rs:43-44 (new), checkpoints.rs:764. Haveobservecall the helper; drift here is the exact bug class this PR fixes. - Evidence on the head: one
cargo test --locked --release --features runtime-core,serveron982a9ce3plus agit diffagainst3e2fcd27.
Should-fix
- The acceptance ledger (
0.01/0.99, refresh.rs:78,85) is retained across idle too but has no simulator model and no simulator validation — only a Rust assertion (policy_tests.rs:2477-2507). Add the toggle to the simulator's funded acceptance path or say in the body that it is Rust-only. - First request after a long idle can now trigger an isolated refresh probe (policy.rs:1240-1274 +
plan_requires_feedback→ scheduler.rs:1180), costing the triggering request up to one graph duration. Intended, bounded, but the ≤1.05 TTFT gate covers only replenished core scenarios; idle fixtures are non-gating (learning.py:382-383). One warm-then-idle scenario would cover it.
Consider / nits
- Simulator default (False) now diverges from Helios (retains), contrary to "don't diverge Helios from the simulator's qualified policy". Defaulting True for
retained-refreshkeeps them aligned. --retain-idle-creditdoes not retaintargetedharm balances (learning_policy.py:676-677) — narrower than the flag name.- policy_tests.rs:2566 changed 249→248 rounds to absorb retained credit; less self-evident.
- Touches
cost.rs, which open draft PR #301 also modifies.
Who benefits / cost
Every serving user whose traffic pauses — the core local chat/agent pattern — because idle() fires at each gap (server/runtime.rs:1184) and stale graph costs were previously never remeasured there. Readiness exclusion is narrower (Engram-backed graphs, transport.rs:1049) but removes a real asymmetry. Cost: ~110 lines, one method deleted, no new runtime knobs. Risk low. Simpler alternative for the readiness half: make observe the single source and derive income and charge from it.
No prompt-injection attempt in the thread; flare-autobot's comment and @lukealonso's review are review material only, and I re-verified their claims at the cited lines.
#4 [medium] Latent defect: cost::Key omits draft_source, so MTP+copy same-shape cannot coexist
helios/src/scheduler/cost.rs.
Key(cost.rs:50-58) = {drafts, kind, batch, tokens, prefill, packed} — no draft_source. ButActionCosts::prepared(cost.rs:147-179) errors on a duplicate key: "prepared graphs require unique shapes" (:159-161). Since the Selection layer dedups wire variants including draft_source (selection.rs:250-251 includes graph.draft_source in thevariantsset), an MTP graph and a copy graph with identical B/D/W/P can both survive load and then fail scheduler construction at helios/src/scheduler.rs:1244. Latent, not hit by the current catalog (copy graphs are wider than MTP), but it is a hard load failure waiting for the first same-geometry pair. The wrong-estimate risk is worse: because the key omits the source, a refresh/observe on one silently overwrites the other's Estimate (draft_sourceis stored in the Estimate at cost.rs:169, so the two would disagree with the key).refresh_packed_durationshas_mtp(cost.rs:192-196) is an existence scan over ALL entries regardless of whether they were measured. So one unmeasured MTP packed entry suppresses every copy entry viaif has_mtp && ... Copy { continue }(:199-201), andpacked_round_duration(cost.rs:210-213) then returns None for a copy shape that has a real measured duration. Callers: policy.rs:775 and rounds.rs:562. Should predicate onestimate.nanos != 0(measured), not on existence.is_copy_only_step(cost.rs:223-232) has to infer the source from the table by re-looking-up the step's Key, precisely because Key lacks the field. Making draft_source part of Key would remove the inference and fix (1) at the same time.
Also cost.rs:31-34: observed_compute_duration_ns uses saturating_sub(wait_ns), so a readiness interval longer than the measured interval reports Some(0) — zero credit, no debt, and (via timing_refresh_duration_ns, cost.rs:36-38) no wall fallback since the Option is Some. validate_completion (refresh.rs:63-69) already rejects queued/missing intervals for probes; an over-long wait should arguably be invalid rather than silently zero. Pin down with a test either way.