#1 [high] Blocker verified: export binding coerces draft_source to MTP
Verified in code at head 7ca5430:
- Producer: ignition/preparation/execution.py:32 (GraphSignature.draft_source int=1), :102-108 validation (copy requires speculative, confidence_width==0, no speculative_prefix_limits), :316-319 emits
draft_source=signature.draft_sourceinto manifest graph when draft_tokens is not None. - Reader A (in-process GraphExecutor): heliopause/src/python.rs:225-233 reads 0/1/2, rejects other, defaults Mtp for speculative kind. Uses -> GraphDescriptor.draft_source (Option).
- Reader B (core export): heliopause/src/export/binding.rs:136
pub(crate) fn execution(value, allocations) -> wire::Execution; at :196-202 forkind == "speculative" || kind=="mixed" && speculativeit unconditionally doesgraph.insert("draft_source".into(), "MTP".into())— overwrites the manifest value. Called from heliopause/src/export/capture.rs:3158 in the only export path (capture_rank << export_capture pyfunction, invoked from ignition/preparation/runtime_core.py:140). - Wire: helios/proto/runtime_core.proto:842/854
DraftSource { NO_DRAFT=0; MTP=1; COPY_DRAFT=2; }; load decodes faithfully at helios/src/runtime_core/serving.rs:58-63. - Consequence at load: helios/src/runtime_core/selection.rs:184 retain_wide_copy = source==1 && history_enabled && fixed.is_none(); :277-298 copy_wide requires graph.draft_source == 2 && draft_tokens > drafts; wrong label falls into the MTP branch at :291-293 which requires draft_tokens <= drafts → graph pruned. So exported cores never carry wide copy graphs; failure is silent.
- Secondary: coercion bypasses copy-only validation helios/src/execution/manifest.rs:845-846 and helios/src/model/catalog.rs:93-96 (copy graph w/ confidence_width != 0 would pass).
- Note also encoding divergence: binding.rs writes enum NAME string, python.rs reads integer u32; no round-trip test (tests/preparation/test_execution.py:299-302 and test_packed_speculative_contract.py:54 only test the pb encode of manifests, not binding::execution).
- Unverifiable from repo (no CI): the PR's pytest claims. Flag as "established by code reading; a round-trip test in binding.rs would make it an observed failure".
#2 [high] PR #540 overview + verified stale docs
Head 7ca5430, 25 files, +3965/−119. Four commits: (a) a85be397 refresh recovery; (b) 83ff9ed6 per-request prompt+output SAM (helios/src/scheduler/sam.rs, new, +1606); (c) 35ab143a draft_source=2 wide copy-verify graphs; (d) 7ca5430c padding dominance + DEFAULT_MIN_MATCH_LEN 3→6. Description: Why/What changed/Result/Evidence & Limitations all present, Discord: Dooner present (no @). Claims 615 + 1,625 CPU tests, GPU 4x RTX PRO 6000 SM120 DeepSeek-V4.1 Flash TP4. Headline live numbers labelled "combined-stack". Limitations: copy-only W=16/W=24 GPU export/replay not benchmarked; power-limit cost refresh not live. No CI checks on head commit — all test claims unverifiable from repo (read_item shows only one discussion comment, the autobot case file).
Charter/rules cited by lenses: AGENTS.md:52-56 docs specify present state; :72-112 four-part description; :155-205 scope; :188-193 no speculative abstraction; :431-444 model core compat; :446-465 configuration; docs/design-review.md:14-52 principles 1/3 (shared mechanisms, reject per-model flags); :22-26 new operation contract needs owner approval.
Key doc staleness verified by me:
- docs/cli-design.md:200-202 "
--history-draftsenables host history tracking and feeds continuations into the captured graphs' history inputs; it does not change the graphs." — false after (c): helios/src/runtime_core/selection.rs:182-184, 277-298, 382-396 retain/prune copy-only graphs and rewritespeculative_widthsand drop kernels (core.graphs.retain at :375, prune_kernels :380). So the flag changes the loaded graph set. This is the one prose item that is a real contradiction of the user contract. - docs/mtp-design.md:22-40 still describes only the shared 65,536-token ring with 8/4-token indexes, "return up to seven observed continuation tokens", "Both settings use the same captured MTP graphs and buffers." SAM path (sam.rs:22 min_match_len 6, :24-32 caps 131,072/131,072/512 overlap) undocumented; ring is now fallback only when strictly longer (scheduler.rs:1143-1148).
- docs/scheduling-runtime-design.md:6-12 module index omits sam.rs; :249-254 padding-dominance paragraph no longer describes prune_padding second pass (policy.rs:221-254) which can discard a shape whose packed capacity is SMALLER than the survivor's; :396-399 (packed duration minimum across shapes) no longer matches cost.rs:190-208 has_mtp exclusion (verified cost.rs code at :190-232).
- helios/manifest.md:29-53 graph dictionary omits
draft_source(verified list at :30-52 has no draft_source). - docs/mtp-design.md:359 does mention draft_source generically ("draft_source: draft depth D, verification width, and proposal source").
- docs/scheduling-runtime-design.md:425-450 refresh prose matches code (refresh.rs:71-105, cost refresh_order cost.rs:287-296) — good, no finding.
#3 [high] Subtraction findings verified (idle, dead SAM API, duplicate match fn, dead curve branch)
Verified independently; all citations are head 7ca5430.
-
RefreshState::idleispub fn idle(&mut self) {}at helios/src/scheduler/refresh.rs:95-99 with an 8-line doc comment explaining it does nothing. Caller helios/src/scheduler.rs:1277-1283 (RequestScheduler::idlevalidates submissions then calls it); server caller helios/src/server/runtime.rs:1184. Zeroing out: retention is now the ABSENCE of mutation. Tests that call.idle()and assert credit unchanged: policy_tests.rs:2610, 2626, 2638, 2689, 2699, 2730, 2751, 3685, 5714, 5720, 5765. Removal: drop method + call line, keep the submissions guard; ~20 lines. -
Dead/test-only SAM API (production uses only PromptOutputSAM::new, propose, push_token, into_padded_i64 — verified by search_code: scheduler.rs:1128/1179 propose, :1234/:3017 push_token, :1852 new, :1151 into_padded_i64):
- propose_for_context sam.rs:1068-1110 (43 lines) — caller only sam.rs:1463.
- propose_conditional_continuations sam.rs:1112-1189 (~78 lines) — caller only sam.rs:1505; doc says "building block for conditional copy lookup tables in 2-deep pipelined execution", no such consumer exists.
- MatchSource enum sam.rs:64-69 + MatchProposal.source :80-81 + constructor sites :1217/1219, :1263/1265 — read only by tests :1301/:1309/:1321/:1336.
- PromptSAM::build sam.rs:283 — used only by tests :1519, :1569.
- push_slice sam.rs:1023 — tests only.
- accessors (PromptSAM state_count/transition_count/memory_bytes :462-476; PromptOutputSAM *_memory_bytes/config/prompt_len :949-984) — tests + #[ignore] microbenchmark at :1560-1600.
pub mod samat scheduler.rs:23 makes this an exported surface. ~150-180 lines.
-
Duplicate match algorithm: helios/src/scheduler.rs:1112-1159 request_history_proposal_with_match_len vs :1163-1205 request_copy_match_stats — same clamp (:1117-1119 vs :1168-1170), same early exit (:1120-1122 vs :1171-1173), same request lookup, same SAM propose + OOV truncation (:1127-1138 vs :1178-1186), same ring lookup (:1139-1142 vs :1187-1194), same strictly-longer tie-break (:1145 vs :1197). Already drifted: shared result filtered by
.filter(|&(count,_)| count>0)at :1194 in one copy only. Precedent for the wrapper: decoded_history.rs:180-183 lookup wraps lookup_with_match_len. ~40 lines. -
wide_copy_curve fallback duplicate + dead branch: rounds.rs:541-548
elsearm re-derives the geometric prior speculation.rs:110-151 CopyCalibration::curve already produces (seeded at speculation.rs:113 with WIDE_COPY_PRIOR_RATE; curve prior = rate.powi(depth+1) at ~:132). Branch unreachable: LiveRequest.sam and .copy_calibration are both set only under decoded_history.is_some() at scheduler.rs:1849-1856, enable_history_drafts refuses after any submission/admission (:1086-1092), and the wide-copy block is only entered when decoded_history.is_some() (rounds.rs:759). Also the fallback ignoresoptimistic, so the two curves disagree. ~10-15 lines. -
Duplicate proposal-source ladder: serving.rs:58-63, heliopause/src/python.rs:225-233, selection.rs:144-148 (config string → 1/2). ProposalSource::parse exists at speculation.rs:30-38. ~15 lines.
#4 [high] Report support: export fix shape, cost-key trap, preempt/readmit, rejected duplicate claim
Verification notes for the report (all at head 7ca5430).
A. Export path detail: heliopause/src/export/binding.rs:136 execution() deserializes the JSON into the wire Execution via prost_reflect (message() at :123-134), which needs the proto enum NAME. That is why :201 hard-inserts "MTP". Correct fix: map the manifest integer (1→"MTP", 2→"COPY_DRAFT", absent speculative→"MTP", else error), i.e. derive the name instead of overwriting. Also applies to mixed speculative graphs (the :196 condition covers them, and ignition/preparation/execution.py:104-108 allows draft_source=2 on mixed) while helios/src/runtime_core/selection.rs:279 requires kind=="speculative" for copy_wide.
B. Cost-semantics trap (stronger than the prose lens stated): helios/src/scheduler/cost.rs:192-196 has_mtp is an entry existence scan (not freshness). So in a mixed catalog, one UNMEASURED MTP packed entry (nanos 0) suppresses every measured copy entry (:199-201), and packed_round_duration (:210-213) then returns None for a shape that was measured. Contradicts docs/scheduling-runtime-design.md:396-399 ("returns zero only when every matching shape is unmeasured").
Also: cost::Key (cost.rs:151-158 or so) OMITS draft_source, and prepared() rejects duplicate keys (:159-161), so an MTP graph and a copy graph with identical B/D/W/P cannot coexist in one core ("prepared graphs require unique shapes"); is_copy_only_step (:223-232) therefore infers the source from the table entry rather than the step. Putting the source into Key fixes both.
C. Preempt/readmit: helios/src/server/runtime.rs:2068-2108 park rebuilds incoming.prompt.tokens = live.tokens() ++ appended (i.e. prompt + generated), and readmission rebuilds sam from that prompt at scheduler.rs:1849-1852 while resume_decoded_sequence (scheduler.rs:1212-1223) restores only decoded_sequence. Prompt SAM is capped at the trailing 131,072 tokens with a 512-token boundary overlap, so previously generated text is indexed through the prompt rather than the output automaton. Worst case is wasted verification slots, not wrong commits; no test covers it. Ask for one brute-force-oracle test (sam.rs:1236 oracle) or a PerRequestCopyState that holds sam+calibration together.
D. Python/Rust contract mismatch (nit): ignition/preparation/execution.py:104-108 permits draft_source=2 on mixed speculative graphs; helios/src/runtime_core/selection.rs:277-283 retains wide copy only for kind == "speculative", and helios/src/model/catalog.rs:94 copy_only_graph also requires Speculative. Reject 2 on mixed in Python, or support it in selection.
E. Candidate.expected vs Candidate.rate (policy.rs:89-90): I checked whether the subtractive claim holds and it does not. rounds.rs:899/1058 set rate: ValueRate::new(nanos, value, age) (nonzero duration) while expected is the zero-duration counterfactual built at rounds.rs:886-885/1048-1054 and policy.rs:1415-1425; ValueRate::new at utility.rs:122-131 divides by duration, and the refresh comparison (policy.rs:1285-1290) needs the zero-duration value. Neither is derivable from the other without the age price, so expected is a genuine second quantity. Do NOT ask the author to drop it; the only optional cleanup is naming the two accumulators' intent. Excluded from Subtract.
#5 [high] Final report structure (blockers/should-fix/subtract/nits)
FINAL BLOCKER LIST (1): B1. heliopause/src/export/binding.rs:196-202 overwrites draft_source with "MTP" for every speculative/mixed-speculative graph during the JSON→wire conversion used by export_capture (capture.rs:3158). Copy graphs (draft_source=2) are emitted by ignition/preparation/execution.py:316-319 but arrive at load as MTP, and helios/src/runtime_core/selection.rs:277-298 prunes them (copy_wide needs 2; MTP branch needs draft_tokens <= drafts). Wide copy-verify is dead on every exported core, silently. Fix: derive the enum name from the manifest value (1→"MTP", 2→"COPY_DRAFT", absent-speculative→"MTP", else invalid()), and add a round-trip test on binding::execution.
SHOULD FIX (9): docs/cli-design.md:200-202 + mtp-design.md:22-29 contradiction; PR split/attribution of the four outcomes; second proposal-source dimension + bypasses; cost source belongs in Key (also fixes duplicate-shape rejection + has_mtp existence-not-freshness + docs:396-399 mismatch); stale/missing design prose (mtp-design.md:31-40, scheduling-runtime-design.md:6-12 and :249-254, helios/manifest.md:29-53); unsourced calibration constants (0.88/4.0/2.0/+3/6); preempt-readmit SAM indexing untested; Python allows draft_source=2 on mixed but Rust requires speculative; evidence gaps (no CI on head, no load-and-serve of an already-exported W=8 core, SAM build cost paid at admission per request not stated).
SUBTRACT (~550-685 of +3,965): test consolidation (~150-250); rounds.rs copy-only loop (~100); dead SAM API (~150); duplicate match fn in scheduler.rs (~40); dead wide_copy_curve else (~12); empty RefreshState::idle + its no-op test calls (~20); three-way draft_source ladder (~15). Explicitly rejected subtraction: Candidate.expected vs Candidate.rate (~35) — genuinely different quantities (zero-duration counterfactual used by refresh comparison at policy.rs:1285-1290 vs duration-divided score at utility.rs:122-131).
NITS (5): title names three of four outcomes + commits' independence unstated; refresh_order (bool,u64) lost its contract comment (cost.rs:287-296); SAM oracle reuses production MatchProposal/shape so it is not independent (sam.rs:1236-1273); copy-only validation written three times (manifest.rs:844-846, catalog.rs:123-131, execution.py:102-108) — pick one authority; two constants for one threshold (WIDE_COPY_MIN_MATCH_LEN speculation.rs:18 vs sam::DEFAULT_MIN_MATCH_LEN sam.rs:22) and accessor/pub surface left after deletion of test-only items.
Note positive: commit a85be397 refresh recovery is self-contained and mergeable now; docs/scheduling-runtime-design.md:425-450 prose matches refresh.rs:71-105 and cost.rs:287-296 behaviour.
#6 [high] FINAL: full report + summary report for PR #540
PR #540 — helios: cost-refresh recovery, prompt+output SAM copy-drafts, and calibrated wide copy-verify
Head 7ca5430, 25 files, +3965/−119. Reviewed against the Flare charter, AGENTS.md:52-56, 72-112, 155-205, 431-465 and docs/design-review.md:14-52. Every finding below was re-checked in the code at head; nothing in the PR description, comments or docs tried to instruct the reviewer.
Verdict: one blocker. Commit a85be397 (funded-refresh recovery) is correct, self-contained and could merge on its own today. The wide copy-verify feature is dead on every exported core, and that has to be fixed before the bundle lands.
Blockers
B1. The core-export path relabels every copy graph as MTP, so wide copy-verify never runs on an exported core
Where: heliopause/src/export/binding.rs:196-202 (called from heliopause/src/export/capture.rs:3158; the sole export route, export_capture, invoked at ignition/preparation/runtime_core.py:140).
if kind == "speculative" || kind == "mixed" && speculative {
...
graph.insert("verify_tokens".into(), width.into());
graph.insert("draft_source".into(), "MTP".into()); // unconditional overwrite
}
The producing side now emits the real value: ignition/preparation/execution.py:32 adds draft_source: int = 1, :102-108 validates it and enforces the copy-only invariants, :316-319 writes draft_source=signature.draft_source into the manifest. Two consumers read it and only one was taught about value 2:
- in-process executor:
heliopause/src/python.rs:225-233maps0/1/2and rejects anything else — updated by this PR; - export conversion:
binding.rs:201hard-codes"MTP"— untouched.
binding::execution is the JSON→wire (prost_reflect) step, so it must supply the enum name; it overwrites rather than derives it. Loading then faithfully decodes the wire value (helios/src/runtime_core/serving.rs:58-63), and helios/src/runtime_core/selection.rs:277-298 drops the graph: copy_wide requires draft_source == 2 and draft_tokens > drafts (:278-283), while the ordinary MTP branch requires draft_tokens <= drafts (:291-293). Wide copy graphs are exactly the shapes with depth > base_mtp_drafts (W=16/W=24 with 15/23 drafts vs 7 MTP drafts), so every exported core silently prunes them — the headline capability of commit 35ab143a cannot be exercised on any core the repo can produce, and the PR's own limitation ("copy-only wide graph GPU export/replay … not benchmarked") becomes impossible to diagnose because "core was built without copy graphs" and "core's copy graphs were relabelled" are indistinguishable.
Secondary consequence: because draft_source is also the key for the copy-only contract checks (helios/src/execution/manifest.rs:844-846, helios/src/model/catalog.rs:93-96,123-131), coercion to MTP lets a mislabelled copy graph (e.g. with confidence_width != 0) pass validation as well as be pruned.
Fix (smaller replacement, not an addition): derive the name instead of overwriting —
1 => "MTP", 2 => "COPY_DRAFT", absent on a speculative graph => "MTP", anything else => invalid(...) — one match arm replacing the constant. Add one round-trip test over binding::execution asserting draft_source == DraftSource::CopyDraft as i32 for a manifest carrying 2; that is what turns this from a code reading into an observed failure, and it is the test the PR is missing (the Python tests at tests/preparation/test_execution.py:299-302 and test_packed_speculative_contract.py:54 only cover the manifest encoder).
Should Fix
S1. --history-drafts now changes the loaded graph set, but the CLI and MTP specs still say it does not
docs/cli-design.md:200-202: "--history-drafts enables host history tracking and feeds continuations into the captured graphs' history inputs; it does not change the graphs." After commit 3 the flag decides graph selection: helios/src/runtime_core/selection.rs:182-184 computes retain_wide_copy, :277-298 retains or prunes copy-only graphs, :375-380 drops unselected graphs' kernels (core.graphs.retain, prune_kernels), :382-396 rewrites speculative_widths (and a fixed width disables the copy path entirely, since retain_wide_copy needs fixed.is_none()). The PR's own test wide_copy_graphs_retain_only_when_history_drafts_enabled (selection.rs:1876) asserts widths [1,6,16,24] vs [1,6].
Fix: in docs/cli-design.md:200-202 and the :742 table row, and in docs/mtp-design.md:22-29 ("Both settings use the same captured MTP graphs and buffers"), state that the flag also elects optional copy-draft-only wide graphs when the core carries them and only in adaptive mode without a fixed width. Three sentences, no new code.
S2. The documents that own this behaviour were not updated (one omits the new field entirely)
docs/mtp-design.md:31-40still describes only the shared 65,536-token ring with "exact eight-token and four-token indexes" returning "up to seven observed continuation tokens". After commit 2 the ring is the fallback used only when it matches strictly longer (helios/src/scheduler.rs:1143-1148), and the primary path is a per-request prompt+output automaton withmin_match_len = 6(sam.rs:22), a 131,072-token prompt cap (:25), a 131,072-token output cap (:28) and a 512-token boundary overlap (:32).docs/scheduling-runtime-design.md:6-12enumerates the modules that implement the design and omitssam.rs, so a reader following the document's own pointer cannot reach the copy-proposal implementation. Nothing in the document describes the copy-only graph contract (draft_source == 2), theCopyCalibrationprior, or the wide-copy eligibility gate.docs/scheduling-runtime-design.md:249-254says pruning discards a shape "whose capacities are all at least as large as an alternative".prune_padding's new second pass (helios/src/scheduler/policy.rs:221-254) discards a ragged GPU-allocated speculative candidate when a strictly tighter batch covers the cohort's needed target rows, so the survivor'spacked_token_capacitymay be strictly smaller. This is the paragraph that justifies themax_b == Cresult; it no longer describes the rule.helios/manifest.md:29-53specifies the graph dictionary field by field and omitsdraft_source, whichheliopause/src/python.rs:225-233now reads (0/1/2, default MTP for speculative). An author following the spec gets the default and then failscatalog::validate. Fix: rewrite themtp-design.md:22-41paragraph around the SAM-first mechanism with the ring as fallback (caps and the six-token minimum in prose, since neither threshold is flag-exposed), addsam.rsto the module index and a short section fordraft_source/wide copy-verify toscheduling-runtime-design.md, state the new covering condition in the pruning paragraph, and adddraft_sourcetomanifest.md.
S3. Two authorities for the proposal source, and it is not in the cost key — so cost semantics depend on which other graphs the core contains
The head already declares a source: speculative_proposal_source → ProposalSource (helios/src/scheduler/speculation.rs:23-38), driving selection at selection.rs:144-199. The PR adds a second, per-graph draft_source, then needs copy-specific bypasses in shared code: selection.rs:184, :277-298 (copy graphs skip the draft_source == source, draft_tokens <= drafts, fixed-width and mtp_verification_token_budget filters), :382-396 (config speculative_widths rewritten to advertised widths that no MTP graph implements), cost.rs:190-208 (has_mtp), cost.rs:223-232 (is_copy_only_step), rounds.rs:752-790 (a whole copy-only candidate branch). Behaviour is now a function of (config, manifest field, and which other graphs were exported).
The concrete defect inside this: cost::Key (cost.rs:50-58) has no draft_source, yet prepared() rejects duplicate keys (:159-161, "prepared graphs require unique shapes"), so an MTP and a copy graph with identical B/D/W/P cannot coexist; and is_copy_only_step therefore has to look the source up in the table instead of reading the step. Worse, refresh_packed_durations's has_mtp (:192-196) is an existence scan, not a freshness one: one unmeasured MTP packed entry suppresses every measured copy entry (:199-201), and packed_round_duration (:210-213) then returns None for a shape that was measured — contradicting docs/scheduling-runtime-design.md:396-399.
Fix (subtractive): add draft_source to cost::Key, so is_copy_only_step and packed_round_shapes read the step/key directly and two sources may share a geometry; replace the existence scan with an explicitly keyed per-source table. Then keep a single authority for "may this shape be scheduled" (a scheduler-level predicate over the captured shape list) rather than repeating it in selection.rs, cost.rs and rounds.rs.
S4. Calibrated constants ship without a derivation
WIDE_COPY_PRIOR_RATE = 0.88, WIDE_COPY_MIN_MATCH_LEN = 6, COPY_STEP_PRIOR_WEIGHT = 4.0, COPY_DEPTH_SHRINK_WEIGHT = 2.0 (helios/src/scheduler/speculation.rs:15-21), min_copy_len = base_mtp_drafts.saturating_add(3) (helios/src/scheduler/rounds.rs:766) and DEFAULT_MIN_MATCH_LEN = 6 (sam.rs:22). The description argues only the 6 (one 512-token repetitive prompt) and says nothing about 0.88, 4.0, 2.0 or +3. These decide when a graph is scheduled.
Fix: one sentence of derivation per constant in the design doc, or make the policy decisions explicit named fields; state why the copy depth margin is three.
S5. Evidence: the claims that carry the bundle are not separable, and one cost is reported without saying where it is paid
- The PR bundles four outcomes into 25 files (+3965/−119) against
AGENTS.md:194-199. "Combined-stack" honest labelling means neither commit 4's padding-dominance effect nor commits 2–3's3.078 → 3.650 emitted tokens/roundcan be attributed or bisected; the refresh fix needs none of them. Report per-commit live numbers for the padding-dominance and SAM/wide-copy changes, or split. PromptSAM::buildat13.05 ms / 4.52 MiB(131,072 tokens) is not a background cost:admitbuilds it synchronously per admitted request (scheduler.rs:1849-1852), i.e. up to ~4.5 MiB of host memory per live request and an admission stall proportional to prompt length. The description reports the microbenchmark without that scope; no live admission-latency measurement on a long prompt is disclosed.- No checks are reported on the head commit, and the compatibility claim ("existing W=8-only cores load, prune, pack, and schedule") rests on a unit test (
helios/src/model/tests.rs:1866-1888,selection.rs:1876) rather than a load-and-serve of a previously exported core, whichAGENTS.md:431-444asks for. Fix: per-commit numbers, the admission-cost sentence, and one loaded-core check (or an explicit statement that it was not run).
S6. Python allows draft_source = 2 on mixed speculative graphs; Rust requires speculative
ignition/preparation/execution.py:104-108 validates copy graphs as speculative or speculation-enabled mixed, while helios/src/runtime_core/selection.rs:278-283 retains copy-wide only for kind == "speculative" (and model/catalog.rs:94 agrees). A mixed copy graph is exportable and unloadable.
Fix (one line): reject 2 on mixed where it is validated, and delete the mixed clause; or support it — but not both.
Subtract / Simplify
Could remove ~550–685 of the +3,965 added lines with no decision or assertion lost. Ranked by saving:
- ~150–250 test lines re-prove the same path.
helios/src/model/tests.rs:846-953(history_draft_packing_forwards_per_request_prompt_sam_continuations, 108 lines) repeats the pack-and-assert flow of:1861-2075(215 lines, and the only test that exercisesdraft_source = 2end to end);:1873-1888repeats the "legacy W=8 core still loads" assertion owned byhelios/src/runtime_core/selection.rs:1876-1940;helios/src/scheduler/tests.rs:1995-2127re-proves sam.rs's own unit tests, of which only the admission wiring and request isolation are scheduler-specific. Keep the wide-copy packing test, fold the 846-953 case into it as assertions, keep the selection test as the legacy-load proof, trim 1995-2127 to admission + isolation. - ~100 lines: the copy-only candidate loop duplicates the ordinary one.
helios/src/scheduler/rounds.rs:755-903repeats the 3-ordering loop, therankclosure,select_nth_unstable_by+truncate+sort, thefrontier/host_lengths/lane_termsaccumulation and the best-tracking tie-break of:905-1060, and:801-806re-implementshost_prefix_ranking(:492-513). One loop taking a per-slot curve provider (plus the availability gate) collapsescurves/copy_curves(:747-748) into one array. - ~150 lines of SAM API with no production caller (
pub mod sam,helios/src/scheduler.rs:23):propose_conditional_continuations(sam.rs:1112-1189+ test:1491-1514) — its doc names "2-deep pipelined execution", which exists nowhere in this tree or the description;propose_for_context(:1068-1110+ oracle call:1463);MatchSource+MatchProposal::source+ its four constructor sites and four test assertions (:64-69, 80-81, 1217/1219, 1263/1265);PromptSAM::build(:283);push_slice(:1023); the accessor block except what the#[ignore]benchmark reads. Re-point the randomized oracle atproposeso the surviving matching path keeps brute-force coverage — that is the one real cost of the deletion. - ~40 lines: the same match algorithm twice.
helios/src/scheduler.rs:1112-1159and:1163-1205share the clamp, the early exit, the request lookup, the SAM propose with OOV truncation, the ring lookup and the strictly-longer tie-break; they have already drifted (.filter(|&(count, _)| count > 0)at:1194in one copy only, so a zero-count ring result is a match in one path and not in the other). Keep one private helper returning(tokens, count, match_len);decoded_history.rs:180-183is the precedent for the wrapper. - ~20 lines:
RefreshState::idleis an empty function.helios/src/scheduler/refresh.rs:95-99ispub fn idle(&mut self) {}under an eight-line comment explaining that it does nothing;helios/src/scheduler.rs:1277-1283validates the queue and calls it. Retention is now the absence of mutation. Delete the method and the call, keep the submissions guard, drop the ~10.idle().unwrap()assertions that now assert nothing (policy_tests.rs:2610, 2638, 2689, 2699, 2730, 2751, 5714, 5720, 5765, 3685). - ~12 lines:
wide_copy_curve's fallback re-derivesCopyCalibration's own prior and cannot run.rounds.rs:541-548reproduces the geometric prior seeded atspeculation.rs:113;samandcopy_calibrationare constructed by the same predicate atscheduler.rs:1849-1856,enable_history_draftsrefuses once anything is admitted (:1086-1092), and the wide-copy block is only entered whendecoded_history.is_some()(rounds.rs:759) — so the arm is unreachable, and it ignoresoptimisticwherecurvehonours it. Take the calibration unconditionally. - ~15 lines: the
0/1/2 → Option<ProposalSource>ladder is written three times (helios/src/runtime_core/serving.rs:58-63,heliopause/src/python.rs:225-233,helios/src/runtime_core/selection.rs:144-148), with three error messages.ProposalSource::parse(speculation.rs:30-38) is the existing pattern: addfrom_wire/to_wirenext to it, letpython.rsalone own the absent-key default, and compare enums rather thanu64inselection.rs.
Explicitly not asking for removal: Candidate.expected alongside Candidate.rate (policy.rs:89-90). rate is expected / duration − age·duration/2 (utility.rs:122-131) for nonzero durations (rounds.rs:899, 1058), while expected is the zero-duration counterfactual the refresh comparison needs (policy.rs:1285-1290, :1415-1425); neither is recoverable from the other without re-deriving the age price. The MutableEdges/Link-Cut-Tree machinery in sam.rs likewise has no smaller equivalent in the repository for O(log M) recency under the 131,072-token cap.
Nits
- Title and commit independence. The title names three of four outcomes (commit 4, padding dominance +
DEFAULT_MIN_MATCH_LEN3→6, is the fourth and the headlinemax_b == Cresult depends on it); one sentence saying which commits depend on which would tell a reviewer what must land together. refresh_orderlost its contract comment (cost.rs:287-296):(bool, u64)means "attempted while stale with no valid observation, then attempt time". Neighbouring helpers keep their invariants inline (:21-48, 210-213). One comment line, or a named struct.- The SAM oracle is not independent of production code (
sam.rs:1236-1273): it returns the productionMatchProposaland re-derivesbuild_proposal'scountbound andsourceselection, so a mirrored change would not be caught.decoded_history.rs:228-252returns plain tuples — the better shape. - Copy-only validation is written three times (
execution/manifest.rs:844-846,model/catalog.rs:123-131(superset, load-time),ignition/preparation/execution.py:102-108). Keep the catalog gate, drop the manifest clause; andWIDE_COPY_MIN_MATCH_LEN(speculation.rs:18) duplicatessam::DEFAULT_MIN_MATCH_LEN(sam.rs:22) — two constants for one threshold that must stay equal (rounds.rs:776gates on the first while proposals are gated by the second). - Positive, no action: the refresh work is well scoped —
observed_compute_duration_ns/timing_refresh_duration_nsexclude readiness wait while acceptance learning keeps raw time (cost.rs:31-38,refresh.rs:71-93),abortstill discards positive credit (refresh.rs:101-105), and the two-tierrefresh_ordergenuinely fixes "probe the older, smaller shape first";docs/scheduling-runtime-design.md:425-450matches that behaviour exactly. Commita85be397could merge today.
Summary report (GitHub post)
Not ready to merge: one blocker. The refresh-recovery commit is ready on its own; the wide copy-verify feature does not survive export.
Blockers
heliopause/src/export/binding.rs:201overwritesdraft_sourcewith"MTP"for every speculative graph while converting the manifest to the wireExecution, sodraft_source = 2copy graphs arrive at load as MTP and are pruned byhelios/src/runtime_core/selection.rs:277-298. Wide copy-verify never runs on any exported core, silently, and the coercion also skips the copy-only contract checks (manifest.rs:844-846,catalog.rs:123-131). Derive the name (2 => "COPY_DRAFT", unknown=> error) instead of overwriting, and add onebinding::executionround-trip test.
Should fix
docs/cli-design.md:200-202(and:742,docs/mtp-design.md:22-29) still say--history-drafts"does not change the graphs"; it now retains/prunes copy-only graphs, drops kernels and rewritesspeculative_widths.- Fill the documentation gaps in three places, not more:
mtp-design.md:31-40→ SAM-first with the ring as fallback (caps,min_match_len = 6);scheduling-runtime-design.md:6-12module index + a shortdraft_source/wide-copy section, and:249-254→ the new strictly-tighter-batch covering rule;helios/manifest.md:29-53→draft_source. - One authority for the proposal source: put
draft_sourceincost::Key(fixes duplicate-shape rejection,is_copy_only_stepinferring the source from the table, andhas_mtp's existence scan suppressing measured copy entries — which contradictsscheduling-runtime-design.md:396-399), and answer "may this shape be scheduled" in one scheduler predicate instead ofselection.rs+cost.rs+rounds.rs. - Give
0.88,4.0,2.0,+3and6a stated derivation (only the6is argued today), and rejectdraft_source = 2onmixedinignition/preparation/execution.py:104-108, which Rust (selection.rs:278-283) does not accept. - Evidence: per-commit live numbers (the bundle's four outcomes cannot be attributed), state that the
13.05 ms / 4.52 MiBSAM build is paid synchronously at admission per request, and add one load-and-serve of an already-exported W=8 core plus one preempt→readmit SAM test (re-admission re-indexes generated text through the prompt; worst case wasted verification slots).
Subtract / Simplify — could remove ~550–685 of the +3,965 added lines
- ~150–250 test lines: fold
model/tests.rs:846-953into:1861-2075, drop the duplicated legacy-load assertion (:1873-1888), trimscheduler/tests.rs:1995-2127to admission + isolation. - ~100 lines:
rounds.rs:755-903copy-only loop duplicates:905-1060; use one loop with a per-slot curve provider. - ~150 lines of test-only SAM API:
propose_conditional_continuations(sam.rs:1112-1189, no consumer),propose_for_context,MatchSource/source,PromptSAM::build,push_slice, unread accessors; re-point the oracle atpropose. - ~87 lines of duplication: one private helper for
scheduler.rs:1112-1205(already drifted on the zero-count ring case), delete the unreachable/duplicatingwide_copy_curveelse (rounds.rs:541-548), delete the emptyRefreshState::idle+ its no-op test calls, oneProposalSource::from_wireinstead of three ladders. Do not dropCandidate.expected— it is a real second quantity.
Nits (5): title omits the fourth outcome / commit dependencies; refresh_order's (bool, u64) lost its contract comment; the SAM oracle shares production shapes; copy-only validation in three places and two constants for one threshold; positive note — a85be397 is well scoped and scheduling-runtime-design.md:425-450 matches it.
#7 [high] Research summary
Both reports are written and saved as scratchpad entry 6 ("FINAL: full report + summary report for PR #540"); entries 1-5 hold the verification notes with citations.
How I verified. I re-checked every finding the lenses raised against the code at head 7ca5430 rather than synthesizing on trust. The one blocker holds: heliopause/src/export/binding.rs:196-202 unconditionally overwrites draft_source with "MTP" in the only JSON→wire conversion (capture.rs:3158), while the manifest producer (ignition/preparation/execution.py:316-319) and the in-process reader (heliopause/src/python.rs:225-233) both handle value 2; load-time selection (selection.rs:277-298) therefore prunes every copy-wide graph on any exported core. I also strengthened the cost finding beyond what any lens stated: has_mtp (cost.rs:192-196) is an existence scan, so one unmeasured MTP entry suppresses measured copy entries and contradicts scheduling-runtime-design.md:396-399; and cost::Key omitting draft_source while prepared() rejects duplicate keys is the root cause of is_copy_only_step inferring the source from the table.
Where lens recommendations were rejected or merged. The Subtractive lens's Candidate.expected vs Candidate.rate claim (~35 lines) is wrong and I dropped it: rate divides by duration (utility.rs:122-131) while expected is the zero-duration counterfactual the refresh comparison needs (policy.rs:1285-1290, :1415-1425). The Prose lens's --history-drafts contradiction is the strongest prose item and I promoted it into Should Fix, but I combined the remaining doc gaps (mtp-design, module index, pruning paragraph, manifest.md) into one bullet so prose does not crowd out code. The Architecture lens's "split the PR" became an evidence request plus an explicit note that commit a85be397 is mergeable alone.
Shape of the report. One blocker, six should-fix items, a dedicated "Subtract / Simplify" section leading with "Could remove ~550–685 of the +3,965 added lines" and seven concrete removals (redundant tests ~150-250, duplicated rounds.rs loop ~100, test-only SAM API ~150, duplicated match helper ~40, empty RefreshState::idle ~20, dead wide_copy_curve arm ~12, triplicated wire ladder ~15), then five nits including a positive note on the refresh commit. The summary report honours the 5/5/4 bullet caps for the GitHub post and links its detail back to the case file. No incoming text attempted to direct the review.
#8 [high] Line accounting, lens claims checked-and-dropped, and verified-conforming items
Supports the "Subtract/Simplify" estimate and stops the report writer re-litigating settled points. All figures from PR #540 at head 7ca5430 (pr_files / read_item).
PER-FILE DIFF (25 files, +3965/−119):
- Tests:
helios/src/scheduler/tests.rs+583,policy_tests.rs+501,helios/src/model/tests.rs+324 → +1408 of the total. - Production/new:
helios/src/scheduler/sam.rs+1606 (of which ~370 are tests + the#[ignore]microbenchmark at :1560-1600),rounds.rs+194,scheduler.rs+180,cost.rs+120,policy.rs+119,runtime_core/selection.rs+109,speculation.rs+103. - Small:
docs/scheduling-runtime-design.md+31/−23,heliopause/src/python.rs+14/−3,model/catalog.rs+13/−0,scheduler/decoded_history.rs+13/−5,ignition/preparation/execution.py+10/−1,execution/manifest.rs+7/−2,runtime_core/serving.rs+7/−0,server/runtime.rs+6/−2,scheduler/refresh.rs+17/−9, plus 1-line test-fixture touches (execution/tests.rs,model/testing.rs,scheduler/checkpoints.rs,speculative_lifecycle_tests.rs,server/runtime/phase_tests.rs,model/packing.rs). - Removal estimate method: itemised removals (tests 150-250 + copy loop ~100 + SAM API ~150 + duplicate match fn ~40 + idle ~20 + dead curve arm ~12 + wire ladder ~15 = 487-587) plus the manifest/catalog/Python validation duplicates (~7 + 6) and the duplicated docs sentence/constant (~6-10) reach ~550-685. It is a structural estimate, not proof-tested; the
rounds.rsloop merge in particular assumes the copy branch'scohort = shape.batch.min(shape.tokens)andlimit <= base_mtp_drafts + 1gate map onto the ordinary loop's limit without changing masks.
LENS CLAIMS CHECKED AND DROPPED OR MERGED (report should not repeat them):
- REJECTED — Subtractive #6 "
Candidate.expectedduplicatesrate(~35 lines)":rate=expected/duration − age·duration/2for nonzero durations (rounds.rs:899, 1058;utility.rs:122-131),expectedis the zero-duration counterfactual used by the refresh comparison (policy.rs:1285-1290) and recomputed at:1415-1425. Not derivable; keep both. - DROPPED — Correctness lens candidates it itself dropped:
refresh_ordertiering (verifiedpolicy.rs:1302breakonly fires on the tier transition, so all tier-0 targets are scanned andcompare_refreshpicks the max — matches the documented claim), and copy shapes leaking into fixed-width MTP duration folds (unreachable:selection.rs:184,293gatescopy_wideonfixed.is_none(), androunds.rs:755-764skips copy shapes there). - MERGED, not dropped — Correctness's "silent coercion bypasses copy-only contract" is part of blocker B1 (same line, same fix), not a separate item.
- MERGED — Prose's #1
--history-draftscontradiction is the strongest prose item; the other four prose findings (mtp-design ring paragraph, module index, pruning paragraph,helios/manifest.mdomission) are consolidated into one Should-Fix bullet so prose does not crowd out code. - MERGED — Architecture's "split the PR" becomes an evidence request (per-commit live numbers) plus the explicit note that
a85be397is mergeable alone; not a demand to re-cut the branch. - KEPT SEPARATE because no other lens caught it — Python permits
draft_source = 2onmixed(execution.py:104-108) while Rust requireskind == "speculative"(selection.rs:278-283,catalog.rs:94).
VERIFIED CONFORMING (state as positive, no request):
- Refresh recovery:
observed_compute_duration_ns/timing_refresh_duration_nsexclude measured readiness wait while acceptance keeps raw duration (cost.rs:31-38,refresh.rs:71-93);abortstill discards positive credit (refresh.rs:101-105); two-tierrefresh_order(cost.rs:287-296) fixes "probe the older, smaller shape first";docs/scheduling-runtime-design.md:425-450matches the code, including theP <= 0.002/0.998·O + Dand 2,495 ms funding statements (:452-463). - Wire/protobuf: no schema change;
helios/proto/runtime_core.proto:842,854already hadDraftSource { NO_DRAFT, MTP, COPY_DRAFT }; default MTP preserves existing cores (AGENTS.md:437-440). draft_sourcedecode at load (serving.rs:58-63) and the geometry checks (manifest.rs:840-851) are correct for 0/1/2; the only defect is the export writer.- SPDX header/copyright in
sam.rs:1-5matchesspeculation.rs:1-5;wide_copy_curve/expected_copy_tokenscorrectly wrappowered_curve/expected_speculative_tokens(only the fallback arm is wrong); per-request forecast caching (rounds.rs:747-748, 794-795) follows the existing lane-forecast pattern. - PR description has all four required sections in order, the Discord line (
Dooner, no@), honest "combined-stack" labelling and a real Limitations list — no prose-formality blocker. - No test/CI run on the head commit, so the reported 615 / 1,625 counts and the SAM microbenchmark are unverified from the repository; the GPU numbers are unverifiable by construction. Say so once in Should Fix (evidence), not repeatedly.
#10 [high] FINAL (round 5) — full report + summary for PR #540 at head 14019718
PR #540 head 14019718, base main f377dc85, 25 files +3968/−119 (pr_files). Verified at head: binding.rs:201 clobbers draft_source="MTP" (same on main, result 27); selection.rs:184,277-298,382-396; cost.rs:50-58 Key has no draft_source, :159-161 duplicate reject, :192-201 has_mtp existence scan, :223-232, :234-244, :287-296; rounds.rs:541-553 unreachable else, :747-748 curves/copy_curves, :755-800+, :905-1060; scheduler.rs:1094-1097 test-only history_proposal (result 30), :1112-1205 duplicate match fns (drift at :1144-1148 vs :1194), :1849-1852 SAM built in admit; sam.rs:22,25,28,32,283,929-947,1023,1070,1118, doc :1112-1117 "2-deep pipelined execution"; refresh.rs:95-99 empty idle; cli-design.md:200-201 and :741; mtp-design.md:22-29,31-40,359; scheduling-runtime-design.md:6-12,249-254,396-399,430-496; helios/manifest.md:29-53; execution.py:102-108; speculation.rs:15-21.
CORRECTION: prefill natural-fit discovery (policy.rs natural_fit_prefill_capacity, docs scheduling-runtime-design.md prefill paragraph) is ALREADY on main (ba35da3f #538; main:policy.rs:357) — NOT part of this PR despite appearing in the since-last-turn diff (which also includes base commits f377dc85/ba35da3f). Do not attribute it. Ditto docs/preparation-development.md and runtime_core.proto joint_tuning removal (f377dc85).
FULL REPORT and SUMMARY in this note below. Verdict: one blocker; subtraction ~500-600 lines.
See body of report in the delivered answer; key structure: Blockers: B1 export relabel. Should fix: S1 flag/drops docs; S2 doc gaps (mtp-design SAM-first, module index, :249-254, :396-399, manifest.md); S3 single proposal-source authority + cost::Key (also fixes duplicate-shape rejection and has_mtp suppressing measured copy shape); S4 unsourced constants; S5 evidence (admission-time SAM build, per-commit numbers, no exported-core load test, preempt/readmit untested); S6 python allows copy on mixed, Rust doesn't. Subtract: tests ~150-250, rounds copy loop ~100, dead SAM API ~150, duplicate match fn ~40, idle ~20, wide_copy_curve else ~12, ladder ~15 => ~500-600. Nits (5): title/commit dependency; refresh_order comment; SAM oracle not independent; copy-only validation three times + duplicate 6 constant; sam.rs:1112-1117 false definite reference. Positive: refresh recovery commit self-contained.
#12 [high] Research summary
Both reports are written and saved as scratchpad entry #10 ("FINAL (round 5)"), with verification notes in #10/#11 and the earlier entries #1–#8. They were reconciled across the six lenses in favour of subtraction, and re-verified against head 14019718.
Verdict: Changes Requested — one blocker.
- Blocker (B1):
heliopause/src/export/binding.rs:201unconditionally writesdraft_source = "MTP"on the only manifest→wire route (capture.rs:3158(not opened)), so graphs emitted with2(ignition/preparation/execution.py:32,316-319) load as MTP and are pruned byhelios/src/runtime_core/selection.rs:277-298. Wide copy-verify never runs on an exported core, silently, and the coercion also skips the copy-only contract checks (execution/manifest.rs:844-846(not opened),model/catalog.rs:93-131(not opened)). Fix is smaller than the current code: derive the enum name (2 => "COPY_DRAFT", unknown=> invalid) plus onebinding::executionround-trip test (confirmed absent: nearest binding tests,:1348/:1431, do not touch the field). - Should fix (6): the
--history-drafts"does not change the graphs" contradiction (cli-design.md:200-201,741,mtp-design.md:22-29); the doc gaps that own the new semantics (mtp-design.md:31-40,scheduling-runtime-design.md:6-12,249-254,396-399,scheduling-theory.md:577-579,714-729,helios/manifest.md:29-53); one proposal-source authority withdraft_sourceincost::Key(which also removes the duplicate-shape rejection atcost.rs:159-161, theis_copy_only_steptable lookup:223-232, and thehas_mtpexistence scan:192-201that lets an unmeasured MTP entry mask a measured copy shape); unsourced constants0.88/4.0/2.0/+3; evidence (admission-time SAM build, per-commit numbers, an exported-core load test, a preempt→readmit test); andexecution.py:104-108accepting copy graphs onmixed, whichselection.rs:278-283refuses to load. - Subtract / Simplify: ~500–600 of the +3,968 added lines — overlapping end-to-end tests (~150–250), the duplicate copy-only candidate loop in
rounds.rs:755-903plus the unreachablewide_copy_curveelse (:541-548) (~112), ~150 lines of caller-less SAM API, one helper for the already-drifted match functions atscheduler.rs:1112-1205(~40), the emptiedRefreshState::idleand its 11 call sites (~20), and oneProposalSource::from_wirein place of three ladders (~15).Candidate.expectedis explicitly kept — it is a real second quantity. - Nits: 5.
One correction established while reviewing: the prefill natural-fit discovery and joint-tuning removal visible in the supplied diff belong to base commits (ba35da3f #538, f377dc85) and are not attributable to this PR. Positive noted: commit 1b0db227 (funded-refresh recovery) is self-contained and mergeable on its own.
#13 [high] Verbatim summary-post text + subtraction arithmetic for PR #540 report
PR #540, head 14019718. This note holds the exact summary report to post, so the final write-up needs no reconstruction.
SUMMARY POST (verbatim):
Recommendation: Changes Requested. One blocker. Commit 1b0db227 (funded-refresh recovery) is correct, self-contained, and could merge on its own today.
Blockers
heliopause/src/export/binding.rs:201overwritesdraft_sourcewith"MTP"on the only manifest→wire path (capture.rs:3158), so graphs the producer emits with2(ignition/preparation/execution.py:32,316-319) load as MTP and are pruned byhelios/src/runtime_core/selection.rs:277-298(copy_wideneeds 2; the MTP branch needsdraft_tokens <= drafts). Wide copy-verify is dead on every exported core, silently — and the coercion also skips the copy-only contract checks (execution/manifest.rs:844-846,model/catalog.rs:93-131). Derive instead of overwrite (2 => "COPY_DRAFT", unknown=> invalid(...)) and add onebinding::executionround-trip test.
Should fix
- Three doc statements now contradict the code:
docs/cli-design.md:200-201(+:741) anddocs/mtp-design.md:22-29say--history-drafts"does not change the graphs", butselection.rs:277-298,375-396prunes copy graphs, drops kernels and rewritesspeculative_widths. - Fill existing docs, not new ones:
mtp-design.md:31-40→ SAM-first with the ring as fallback (caps, min match 6);scheduling-runtime-design.md:6-12module index + a shortdraft_source/wide-copy section,:249-254→ the stricter-batch pruning rule,:396-399→ the copy/MTP packed-duration split, andscheduling-theory.md:577-579,714-729→ retained idle credit + two-tier order;helios/manifest.md:29-53→draft_source. - One authority for the proposal source, and put it in
cost::Key(cost.rs:50-58): todayprepared()rejects duplicate shapes (:159-161) so an MTP and a copy graph at identical B/D/W/P cannot coexist,is_copy_only_step(:223-232) must infer the source from the table, andhas_mtp(:192-196) is an existence scan — one unmeasured MTP entry makespacked_round_durationreturnNonefor a measured copy shape. - Give
0.88,4.0,2.0,+3(and the changed6) a stated derivation (speculation.rs:15-21,rounds.rs:766,sam.rs:22); only the6is argued. Also rejectdraft_source = 2onmixedinignition/preparation/execution.py:104-108, whichselection.rs:278-283refuses to load. - Evidence: state that
PromptSAM::build(13.05 ms / 4.52 MiB) runs synchronously at admission per request (scheduler.rs:1849-1852), add per-commit live numbers for the padding-dominance and SAM/wide-copy changes (the four outcomes cannot be attributed as bundled), one load-and-serve of an already-exported core, and one preempt→readmit SAM test.
Subtract / Simplify — could remove ~500–600 of the +3,968 added lines:
- ~150–250 test lines: fold
model/tests.rs:846-953into:1861-2075, drop the duplicate legacy-load assertion (:1873-1888), trimscheduler/tests.rs:1995-2127to admission + isolation. - ~100 lines:
rounds.rs:755-903duplicates the ordinary candidate loop at:905-1060; one loop with a per-slot curve provider also collapsescurves/copy_curves(:747-748) — and thewide_copy_curveelse(:541-548) is unreachable, so delete it too. - ~150 lines of SAM API with no production caller:
propose_conditional_continuations(sam.rs:1118-1189),propose_for_context(:1070),MatchSource/source,PromptSAM::build,push_slice,from_shared_prompt, unread accessors,SamConfig; re-point the oracle atpropose. - ~40 + ~20 + ~15 lines: one private helper for
scheduler.rs:1112-1205(already drifted on the zero-count ring case), delete the emptyRefreshState::idle(refresh.rs:95-99) and its no-op test calls, oneProposalSource::from_wireinstead of three ladders (serving.rs:58-63,python.rs:225-233,selection.rs:144-148). Do not dropCandidate.expected— it is a real second quantity.
Nits: 5 — title/commit dependency; undocumented refresh_order tuple (cost.rs:287-296); SAM oracle mirrors production (sam.rs:1236-1273); copy-only validation and the 6 threshold each written more than once; sam.rs:1112-1117 cites a "2-deep pipelined execution" that does not exist.
ARITHMETIC behind ~500–600 (sum of the ranges above: 150–250 + 100 + 12 + 150 + 40 + 20 + 15 = 487–587, rounded to ~500–600 against +3,968 added lines).
DELIBERATELY NOT SUBTRACTED (so the writer does not re-add them):
Candidate.expected(policy.rs:89-90; setrounds.rs:724-733,896,1052,policy.rs:1096,1295,1479) —rateis expected-per-ns minus age price,expectedis the zero-duration counterfactual used bycompare_refresh(policy.rs:1332-1338).MutableEdges/RootedLctinsam.rs(~600 lines) — the O(log M) recency machinery; no equivalent in the repo; the#[ignore]microbenchmark reads it.draft_sourceonGraphDescriptoritself — required by cost/serving/selection; only the duplicate decoding and the missing cost-key dimension are findings.- The four behaviours — each maps to a stated gap with a measurement.
CORRECTION to keep out of the report as PR-attributable: prefill natural-fit discovery (policy.rs:422, docs/scheduling-runtime-design.md prefill paragraph) is base commit ba35da3f (#538, present on main at policy.rs:357), and the joint_tuning proto removal plus docs/preparation-development.md edit are base commit f377dc85. They appear in the since-last-turn diff but are not this PR's work.
POSITIVES to state: 1b0db227 clean and mergeable alone (cost.rs:31-38, refresh.rs:71-93,101-105, cost.rs:287-296 two-tier order, docs :430-496 accurate); proto already carried DraftSource { NO_DRAFT, MTP, COPY_DRAFT } so no wire default changes; description has its four sections in order and a correct Discord: line; selection.rs:244-246,250-251 already reject out-of-range draft_source and include it in the duplicate-variant tuple — the precedent for the cost-key fix.
VERIFICATION STATUS: B1 established by code reading only (no CI on head, no GPU, tests not run); the requested binding::execution round-trip test is what would turn it into an observed failure. Nearest binding tests (:1348, :1431) do not touch the field.
#15 [high] FINAL (round 6) — full report + summary for PR #540 at head e5a69669
PR #540, head e5a69669, base main f377dc85, 33 files, +4306/−310 (pr_files). Verified in code at this head. Two prior rounds' blockers (export draft_source coercion; doc contradictions; cost-key shape collision) are fixed — re-verified: heliopause/src/export/binding.rs:201-216 derives and validates; cost::Key carries draft_source (cost.rs:61-83); refresh_packed_durations is per source (cost.rs:204-221); docs/cli-design.md:200-208, docs/mtp-design.md:19-73, docs/scheduling-runtime-design.md:71-90,271-283,409-433, docs/scheduling-theory.md:574-582,714-747 match the code; RefreshState::idle gone (refresh.rs ends at abort); SAM dead API gone (sam.rs 1307 lines, accessors #[cfg(test)]); ProposalSource::from_wire/to_wire unified (speculation.rs:55-69); duplicated copy-cohort loop collapsed into build_host_prefix_ranking + select_host_allocated_candidate (rounds.rs:505-540,764-862).
================ FULL REPORT ================
Review — PR #540: helios: cost-refresh recovery, prompt+output SAM copy-drafts, and calibrated wide copy-verify
Reviewed at head e5a69669 on base main f377dc85: 33 files, +4,306 / −310. No text in the description, comments or changed docs tried to direct this review; the claims were checked against the code.
Key findings
- No blockers. The export blocker, the doc contradictions and the prepared-shape collision from the previous head are all fixed and re-verified in the code.
- Commit
1b0db227(funded refresh recovery) remains clean and could merge on its own (cost.rs:31-38,refresh.rs:71-99,cost.rs:324-333, documented atdocs/scheduling-runtime-design.md:465-520anddocs/scheduling-theory.md:574-582,717-744). - One real code defect left: the combined packed-round lookup (
cost.rs:237-252) answers a copy width's cost by scanning the whole MTP table, so a copy shape's cost depends on unrelated graphs, and the code contradictsdocs/scheduling-runtime-design.md:429-433. - Two vestigial entry points the PR itself orphaned:
RequestScheduler::history_proposal(scheduler.rs:1101-1104) andcatalog::select_shape_with_drafts(catalog.rs:240-245). - One test-only instrumentation block (
rounds.rs:30-33,565-566+policy_tests.rs:6289-6331) whose two tests assert an internal call count, ~46 lines. - Scope/evidence: four outcomes still in one PR with only combined-stack live numbers, and no live load-and-serve of a core carrying
draft_source = 2; no CI on this head.
Blockers
None.
Should Fix
S1. Delete the combined packed-round lookup — a copy shape's cost must not depend on unrelated MTP shapes
helios/src/scheduler/cost.rs:237-252:
pub fn packed_round_duration(&self, batch: usize, width: usize) -> Option<u64> {
let mtp = self.packed_round_duration_for(ProposalSource::Mtp, batch, width);
let copy = self.packed_round_duration_for(ProposalSource::Copy, batch, width);
match (mtp, copy) {
...
(None, Some(0)) if !self.packed_round_durations[ProposalSource::Mtp as usize]
.iter().any(|row| row.iter().any(Option::is_some)) => Some(0),
_ => None,
}
}
The commit removed the has_mtp existence scan from refresh_packed_durations (:204-221 now writes both tables unconditionally and uses min_measured_duration) and then reintroduced the same whole-table scan one level up: a copy-only (batch, width) returns Some(0) or None depending on whether any MTP packed shape at any batch or width happens to be measured. docs/scheduling-runtime-design.md:429-433 promises the combined lookup returns zero "only when covering shapes exist without a positive measurement"; the :244-249 arm tests a different predicate, so code and doc disagree, and the cost of a graph depends on what else the core contains — the coupling this commit set out to remove.
Change: delete packed_round_duration and have its two callers pass the source they are pricing — helios/src/scheduler/rounds.rs:585-589 (speculative_duration) and helios/src/scheduler/policy.rs:782-788 (continuation_candidate) both follow a speculative round in an MTP context and can use packed_round_duration_for(self.proposal_source, batch, width). Re-point the four packed_round_duration(...) assertions at cost.rs:449-463 at the source-qualified accessor and state the two tables separately in :429-433.
Why: it is the last non-local cost dependency in the file, it contradicts the document the PR just rewrote, and it is a net deletion (≈12 lines) rather than more code.
S2. Delete RequestScheduler::history_proposal — test-only, and it is the prompt-blind path this PR replaces
helios/src/scheduler.rs:1101-1104:
pub fn history_proposal(&self, context: &[u32], maximum: usize) -> (Vec<i64>, usize) {
let maximum = maximum.min(self.capabilities.completion_token_capacity - 1).min(speculation::COPY_DRAFT_CAPACITY);
self.decoded_history.as_ref().map_or((vec![-1; maximum], 0), |history| history.lookup(context, maximum))
}
Both production callers moved to request_history_proposal in this PR (model/packing.rs:405, server/runtime.rs:2146); the survivors are tests only (scheduler/tests.rs:1956-1991,2069, server/runtime/phase_tests.rs:583,1835). It ignores LiveRequest.sam entirely — exactly the prompt-blind behaviour the PR exists to replace — keeps a pub invitation for a future caller to reintroduce it, and duplicates the capacity clamp with a different overflow rule (completion_token_capacity - 1 panics on zero capacity; clamp_copy_capacity at :1106-1110 uses saturating_sub(1)).
Change: delete the method; move the shared-ring assertions onto request_history_proposal (those tests already admit live requests); keep DecodedHistory::lookup (decoded_history.rs:180-183) as the ring's own oracle by making it #[cfg(test)] (or delete and call lookup_with_match_len from its tests).
Why: −4 lines, −1 duplicated clamp, −1 bypass route; nothing loses coverage because the ring stays reachable as the SAM fallback.
S3. One home for "speculative graphs default to Mtp", and drop the unreachable "any source" arms
cost::canonical_draft_source (cost.rs:50-59) states the rule but is pub(super), so it is hand-written again twice:
helios/src/model/catalog.rs:296-299:graph.draft_source.unwrap_or(speculation::ProposalSource::Mtp) == draft_source.unwrap()helios/src/model/packing.rs:48-51:self.draft_source.unwrap_or(...::Mtp) == step.draft_source.unwrap()
Both also open with step.draft_source.is_none() || …, an "any source" wildcard that is unreachable: every speculative Candidate gets cost::canonical_draft_source(kind, None) (policy.rs:1074) or shape.draft_source from a canonical Key (rounds.rs:848,1075), so a speculative ScheduledStep always carries Some.
Change: move the rule to speculation.rs as ProposalSource::canonical(kind, Option<Self>) (next to parse/from_wire/to_wire), use it from cost.rs:81,170,292,313, Candidate::cost_key (policy.rs:98), catalog.rs:296-299 and packing.rs:48-51, and delete both is_none() wildcard arms and the two unwrap()s they license.
Why: the enum's other semantics already live in speculation.rs and are called from four modules; one rule with two copies has already cost a review round, and deleting the wildcards also removes a way for a step to bind the wrong graph.
S4. Delete the CURVE_EVALUATIONS counter and its two tests
helios/src/scheduler/rounds.rs:30-33 (#[cfg(test)] thread_local! CURVE_EVALUATIONS), the bump at :565-566, and policy_tests.rs:6289-6331 (mixed_refresh_value_reuses_each_decoding_lanes_forecast, decode_refresh_value_reuses_each_decoding_lanes_forecast).
Change: delete all three (≈46 lines). Keep the behaviour the counter was added to guard: the single-forecast pricing at policy.rs:1052-1056 and :1258-1266 with zero_duration[slot].
Why: no production reader; the tests assert evaluations <= shapes.len() * lanes, an implementation detail that cannot fail if the sharing is later rewritten into an equally cheap form. The reuse is one line a reader can see. (cost.rs:15-19 ENTRY_LOOKUPS is the same pattern but pre-existing on main.)
S5. Docs accuracy: the implementation-status list and the two history-draft glosses
docs/mtp-design.md:542-544 still lists copy proposals as coming only from helios/src/scheduler/decoded_history.rs, omitting sam.rs (the primary per-request source, scheduler.rs:1112-1153) and the copy-only wide graph family the PR adds — inconsistent with the same document at :26-34. docs/api.md:295-296 and docs/cli-design.md:1790 gloss --history-drafts / flare_history_drafts_enabled as shared-history only.
Change: add "per-request prompt+output suffix automaton (helios/src/scheduler/sam.rs), with the shared ring as fallback (decoded_history.rs)" and "copy-only wide speculative graphs (draft_source = COPY_DRAFT)" to the status list; reword the two glosses to "per-request suffix automaton and shared decoded history".
Why: every repository document is a present-state specification; a reader of the status list concludes the headline feature does not exist.
S6. Evidence: per-commit numbers and one exported-core load
The four bundled outcomes (1b0db227 refresh recovery; padding dominance + min_match_len 3→6; SAM; wide copy-verify) share one combined-stack measurement, so none can be attributed or bisected; @voipmonitor's live TP4 run used the default --no-history-drafts, so the wide copy paths never executed on hardware; and no run loaded a core carrying draft_source = 2 (the binding.rs:1467-1511 round-trip is a unit test). No CI on e5a69669.
Change: report per-commit live numbers, and one load-and-serve of an exported W = 16 / W = 24 core (plan + completion), which turns the compatibility claim from a unit round-trip into a demonstration. Keep the disclosed limits in the description.
Why: the charter's compatibility obligation is "verify that existing data, artifacts, and exported cores still load"; the copy-only cohort gates (rounds.rs:886-916) have only hand-built CPU fixtures behind them.
Subtract / Simplify
Could remove ~85–90 of the +4,306 added lines. The PR is already near-minimal after e5a69669 — the earlier candidates (SAM conditional/context API, MatchSource, SamConfig, empty RefreshState::idle, the doubled copy-match algorithm, the duplicated copy-cohort loop, the three-way draft_source ladder, the unreachable wide_copy_curve arm, the duplicated legacy-load assertion) are all gone and were re-checked. What remains:
- ≈46 lines — test-only instrumentation.
rounds.rs:30-33, the bump at:565-566, and bothpolicy_tests.rs:6289-6331tests (S4). No production reader; asserts an implementation detail. - ≈12 lines — the combined packed-round lookup.
cost.rs:237-252: delete and letrounds.rs:588/policy.rs:785passself.proposal_source; the four assertions atcost.rs:449-463move to the source-qualified accessor (S1). - ≈14 lines — vestigial entry points.
scheduler.rs:1101-1104history_proposal(4) with its duplicate clamp;decoded_history.rs:180-183lookupwrapper becomes#[cfg(test)](4);catalog.rs:240-245select_shape_with_drafts, whose only caller isselect_shapetwo lines above passingdrafts = 0(6). - ≈12 lines — the 3-ordering cohort preamble written twice.
rounds.rs:785-803(select_host_allocated_candidate) and:1019-1030(packed_round_candidates) are byte-identical; oneordered_cohort(...)helper serves both (both already havefull,base,limits,order,frontierin scope). Alsorounds.rs:920-926clones a whole per-lane curve per wide copy shape (probabilities[slot] = curve.clone()) althoughbuild_host_prefix_rankingonly reads it — borrow the cachedcopy_curvesentry (2 lines, one allocation per shape per plan). - ≈8 lines — unreachable "any source" arms.
catalog.rs:296-299,packing.rs:48-51(S3). - ≈2 lines — two constants for one threshold.
speculation.rs:25 WIDE_COPY_MIN_MATCH_LEN = 6andsam.rs:23 DEFAULT_MIN_MATCH_LEN = 6must stay equal or the gate atrounds.rs:905silently stops agreeing withpropose; reference thesamconstant (or drop the rounds gate, sinceproposealready refuses shorter matches).
Deliberately not subtracted: draft_source in cost::Key / Candidate / ScheduledStep and the per-source packed_round_durations (their absence was the bug e5a69669 fixed; test cost.rs:533-586); Candidate.expected (the zero-duration counterfactual read by compare_refresh, policy.rs:1349-1354); MutableEdges/RootedLct in sam.rs (~600 lines, the price of the claimed O(log M) recency update); max_mtp_draft_tokens' filter (cost.rs:262-272 — a per-source maximum would add state to save a once-per-plan scan).
Nits (5)
- Capability tuples omit
draft_source.helios/src/model.rs:358-360(completion_inputs) and:369-370(speculative_allocations, type atscheduler.rs:108) key on(batch, drafts, width, packed)only, sogpu_prefix_allocation(rounds.rs:443-446) cannot distinguish an MTP GPU graph from an identically shaped copy graph. It is unreachable today because selection keeps MTP depths<= draftsand copy depths> drafts(selection.rs:277-298), so the two can never collide — but that invariant is implicit. Prefer one comment (ordebug_assert) over threading a sixth tuple element throughmodel.rs,rounds.rs,scheduler.rs:2496,2596. draft_source = 0andMixed + COPY_DRAFTare normalised differently per layer.heliopause/src/python.rs:225-231maps an explicit0toNone;heliopause/src/export/binding.rs:204maps0to"MTP";runtime_core/selection.rs:244rejects0on speculative graphs;execution/manifest.rs:849-850acceptsdraft_source.is_some()onMixedwhileignition/preparation/execution.py:104andbinding.rs:213-215reject it. Pick one rule — the cheapest is to makemanifest.rs:850rejectdraft_source.is_some()on anything butSpeculative(matching the producer and exporter) and leavepython.rsmapping0throughfrom_wire.RequestScheduler::idle(scheduler.rs:1267-1277) is a validator with a five-line doc comment describing retention it does not implement. Rename toassert_idle(one production caller,server/runtime.rs:1184), cut the doc to one line, and leave the retention argument todocs/scheduling-theory.md:574-582, which now states it.- The
6-token copy-match threshold still rests on one prompt.sam.rs:22-30andspeculation.rs:21-25now state a derivation for0.88,4.0,2.0andWIDE_COPY_MIN_EXTRA_DRAFTS = 3, but the6is argued from a single 512-token repetitive code-edit prompt. One non-code prompt (prose) showing the collision rate below 6 would settle it. binding.rs:216writesdraft_sourceunconditionally, including when the derived value is the proto3 default — the same "always write" shape that produced the previous blocker. Harmless on the wire; write it only when it differs from the default, or leave a one-line comment that the value is derived, not defaulted.
What is verified clean (no action)
- Export:
binding.rs:201-216derivesMTP/COPY_DRAFT, rejects unknown values and copy on non-speculative graphs;binding.rs:1467-1511round-trips0/1/2, unknown integer/string andmixed+copy. - Cost identity:
cost::Keycarriesdraft_source(cost.rs:61-83),preparedkeys on the canonical source (:163-171), so an MTP and a copy graph at identical B/D/W/P coexist (cost.rs:533-586);Estimate.draft_sourceandhas_mtpare gone;is_copy_only_stepreads the step (scheduler.rs:1196-1199). - Refresh recovery:
observed_compute_duration_ns/timing_refresh_duration_nsexclude measured readiness wait while acceptance keeps raw time (cost.rs:31-38,refresh.rs:71-93);abortstill discards positive credit (refresh.rs:95-99);refresh_order's two-tier(bool, u64)key (cost.rs:324-333) matchesdocs/scheduling-theory.md:717-744. - SAM/copy paths:
resolve_copy_matchbacks both entry points and the previously drifted zero-count ring case is fixed (scheduler.rs:1112-1182);wide_copy_curveusesexpectfor an invariant admission guarantees (rounds.rs:570-579);BoundGraph::matches_stepreplaces two inline closures (packing.rs:40-53). - Docs now match the code:
docs/cli-design.md:200-208,747,docs/mtp-design.md:19-73,386-387,docs/scheduling-runtime-design.md:6-15,71-90,271-283,409-433,docs/scheduling-theory.md:574-582,717-747,helios/manifest.md:38. - Producer/loader agree:
ignition/preparation/execution.py:102-108rejectsdraft_source = 2on non-speculative graphs, matchingselection.rs:240-247; testtests/preparation/test_execution.py:372-393.
Open questions
- No CI on
e5a69669; the reported 1,712 / 620 / 207 / 71 counts and the SAM microbenchmark were not re-run here, and no GPU path was exercised. - Whether the combined
packed_round_durationwas meant to keep serving a mixed MTP+copy catalog (and therefore whetherself.proposal_sourceis the right replacement) is the only design question left; if a caller ever needs "either source", that requirement should be named at the call site rather than hidden in the cost table.
================ SUMMARY REPORT (GitHub post) ===============
Autobot Review
Full Review · Value Proposition · Case File
Recommendation: Approve with minor follow-ups
No blockers. e5a69669 fixes everything from the last round (export draft_source, cost-key identity, doc contradictions, dead SAM API) and re-verified clean in code. Commit 1b0db227 (funded-refresh recovery) is self-contained and could merge alone today. The items below are small deletions, not new work.
Should fix:
- Delete the combined
packed_round_duration(cost.rs:237-252): its(None, Some(0))arm scans the whole MTP table, so a copy shape's cost depends on unrelated graphs, and it contradictsdocs/scheduling-runtime-design.md:429-433. Haverounds.rs:588andpolicy.rs:785callpacked_round_duration_for(self.proposal_source, …). - Delete
RequestScheduler::history_proposal(scheduler.rs:1101-1104): test-only after this PR, it bypasses the SAM and duplicatesclamp_copy_capacitywith a- 1that panics on zero capacity. Re-point the ring assertions atrequest_history_proposal. - Move
cost::canonical_draft_source(cost.rs:50-59) tospeculation.rsasProposalSource::canonical, and use it atcatalog.rs:296-299andpacking.rs:48-51; delete bothdraft_source.is_none()arms, which are unreachable (every speculative step carriesSome). - Delete
CURVE_EVALUATIONS(rounds.rs:30-33,565-566) and both tests (policy_tests.rs:6289-6331): ~46 lines asserting an internal call count; the single-forecast pricing is already visible inpolicy.rs:1052-1056,1258-1266. - Evidence and one doc list: add per-commit live numbers (four outcomes share one combined-stack run, and the TP4 run used
--no-history-drafts), one load-and-serve of an exporteddraft_source = 2core, and add SAM + copy-only wide graphs todocs/mtp-design.md:542-544(plus the ring-only glosses atdocs/api.md:295-296,docs/cli-design.md:1790).
Subtract / Simplify:
Could remove ~85–90 of +4,306 added lines:
- ~46 lines: the test-only
CURVE_EVALUATIONScounter and its two call-count tests. - ~24 lines: the combined lookup (~12) and the 3-ordering cohort preamble written twice at
rounds.rs:785-803and:1019-1030(~10), plus the whole-curveclone()at:925. - ~14 lines:
history_proposal+ its duplicated clamp, theDecodedHistory::lookupwrapper, andcatalog::select_shape_with_drafts(only caller passesdrafts = 0). - ~10 lines: the two unreachable "any source" arms and
WIDE_COPY_MIN_MATCH_LENduplicatingsam::DEFAULT_MIN_MATCH_LEN.
Nits: 5
Capability tuples omit draft_source (unreachable today — state the invariant, don't thread a sixth field); 0/Mixed + COPY_DRAFT normalised differently in python.rs, binding.rs, selection.rs:244 and manifest.rs:850 (make manifest.rs reject it like the producer); rename idle → assert_idle and cut its five-line doc; the 6-token threshold still rests on one prompt; binding.rs:216 writes the default draft_source unconditionally.
#16 [high] Research summary
Both reports are written and saved as scratchpad entry #15 ("FINAL (round 6) — full report + summary for PR #540 at head e5a69669"), with the verification notes in #1–#14.
Verdict at e5a69669 (33 files, +4,306/−310): no blockers, Approve with minor follow-ups. I re-verified in code that the previous round's three blocking items are fixed: heliopause/src/export/binding.rs:201-216 now derives and validates draft_source (0|1|"MTP" → MTP, 2|"COPY_DRAFT" → COPY_DRAFT, unknown → error, copy on non-speculative → error, round-trip test at :1467-1511); cost::Key carries draft_source (cost.rs:61-83) with per-source packed tables (:204-221); and docs/cli-design.md:200-208, docs/mtp-design.md:19-73, docs/scheduling-runtime-design.md:71-90,271-283,409-433, docs/scheduling-theory.md:574-582 (not opened),717-747 and helios/manifest.md:38 (not opened) now match the code. Commit 1b0db227 (funded-refresh recovery) remains clean and mergeable alone.
Remaining should-fix, all reductions rather than additions: delete the combined packed_round_duration whose (None, Some(0)) arm reintroduces a whole-table MTP existence scan (and contradicts docs/scheduling-runtime-design.md:429-433); delete the test-only history_proposal that bypasses the SAM and duplicates clamp_copy_capacity with a panicking - 1; give canonical_draft_source one home in speculation.rs and drop the two unreachable "any source" arms; delete the test-only CURVE_EVALUATIONS counter and its two call-count tests; and add per-commit live numbers plus one load-and-serve of an exported draft_source = 2 core, with the SAM/copy-only graph omission in docs/mtp-design.md:542-544 folded into that same bullet so prose does not crowd out code.
Subtract / Simplify has its own section in both reports and preserves the estimate: could remove ~85–90 of the +4,306 added lines, split as ~46 (test-only counter + two tests), ~24 (combined lookup + the 3-ordering cohort preamble written twice at rounds.rs:785-803 and :1019-1030 + the whole-curve clone at :925), ~14 (history_proposal, the DecodedHistory::lookup wrapper, catalog::select_shape_with_drafts), ~10 (unreachable is_none() arms and the duplicated 6). Items that must not be subtracted are stated explicitly (draft_source in cost::Key, Candidate.expected, MutableEdges/RootedLct, max_mtp_draft_tokens' filter), so no lens can re-add them. Five nits remain, led by the capability tuples omitting draft_source (unreachable today — state the invariant rather than threading a sixth field) and the inconsistent normalisation of 0 / Mixed + COPY_DRAFT across python.rs, binding.rs, selection.rs:244 and manifest.rs:850. No CI on this head and no GPU path was exercised, so those evidence limits are disclosed rather than assumed green.
#17 [high] Round 6 reconciliation: lens claims accepted/rejected, per-file sizes, subtraction arithmetic at e5a69669
Supports scratchpad #15 (the final full report + summary). All figures verified by reading code at head e5a69669 (33 files, +4,306/−310 via pr_files).
PER-FILE SIZES AT THIS HEAD (pr_files): docs/cli-design.md +10/−4; docs/mtp-design.md +49/−22; docs/scheduling-runtime-design.md +78/−36; docs/scheduling-theory.md +30/−15; heliopause/src/export/binding.rs +64/−1; heliopause/src/python.rs +12/−3; helios/manifest.md +1; execution/manifest.rs +7/−2; execution/tests.rs +3/−2; model/catalog.rs +27/−1; model/packing.rs +21/−18; model/testing.rs +1/−1; model/tests.rs +301/−2; runtime_core/selection.rs +113/−14; runtime_core/serving.rs +3; scheduler.rs +175/−10; scheduler/checkpoints.rs +4; scheduler/cost.rs +232/−28; scheduler/decoded_history.rs +13/−5; scheduler/planning_tests.rs +1/−1; scheduler/policy.rs +154/−30; scheduler/policy_tests.rs +553/−24; scheduler/refresh.rs +12/−10; scheduler/rounds.rs +269/−70; scheduler/sam.rs (added) +1307; scheduler/speculation.rs +136/−1; scheduler/speculative_lifecycle_tests.rs +1; scheduler/tests.rs +530/−3; server/metrics/scheduler.rs +1/−1; server/runtime.rs +10/−5; server/runtime/phase_tests.rs +156; ignition/preparation/execution.py +10/−1; tests/preparation/test_execution.py +22.
LENS CLAIMS ACCEPTED (became the should-fix list):
- Architecture S1 + Conventions 1 + Correctness nit + Prose nit 3 are ONE finding →
cost.rs:237-252combined lookup. Accepted as Should Fix S1, but rewritten subtractively: delete the accessor and pass the source atrounds.rs:588andpolicy.rs:785, rather than Conventions' "add acoveredtable" (that would be +code). NOTE: Conventions' proposed fix (a parallelcovered: [[Vec<bool>; 7]; 2]) was REJECTED in favour of the deletion, per the subtraction-first editorial rule. - Simplicity 1 + Subtractive 4 →
history_proposaltest-only (Should Fix S2). Verified: grep at head shows only test callers (scheduler/tests.rs:1956,1970-1991,2069;server/runtime/phase_tests.rs:583,1835); production callers aremodel/packing.rs:405andserver/runtime.rs:2146. - Conventions 3 + Architecture S3 → single authority for "speculative defaults to Mtp" (Should Fix S3). The Conventions nit about
max_mtp_draft_tokensscanning entries was REJECTED as subtraction (a per-source maximum adds state to save a once-per-plan scan) — recorded under "deliberately not subtracted". - Subtractive 1 + Conventions nit 1 →
CURVE_EVALUATIONScounter and two tests (Should Fix S4). Note the code they guard is a legitimate behaviour change requested by @shieldstar; only the instrumentation goes. - Prose should-fix 1 + nits 2 → docs (Should Fix S5), compressed into one bullet with the evidence item (S6) per the editorial rule that prose formalities must not crowd out code.
LENS CLAIMS MERGED OR DROPPED (do not resurrect):
- Correctness's "should fix: capability tables omit
draft_source" → DOWNGRADED to Nit 1, not Should Fix, because it is unreachable at this head:selection.rs:277-298keeps MTP depths<= draftsand copy depths> drafts, andpolicy.rs:248-258dominance now comparesdraft_source, so an MTP and copy graph can never share(B,D,W,P)with GPU allocation on one of them. The report asks for a stated invariant, explicitly NOT a sixth tuple element threaded throughmodel.rs/rounds.rs/scheduler.rs:2496,2596(that would be the addition the subtraction rule forbids). - Architecture S2 "split the PR into three" → converted to an evidence request (S6) plus the positive statement that
1b0db227merges alone. Not a demand to re-cut the branch. - Architecture S4 (
0meansNoneone way,"MTP"the other) and S3'sMixed + COPY_DRAFTinconsistency → merged into Nit 2, with the cheapest single rule named: makeexecution/manifest.rs:849-850rejectdraft_source.is_some()on anything butSpeculative(matchingignition/preparation/execution.py:102-108andbinding.rs:213-215). - Correctness's original nit text ("cost.rs:244-249 returns None where docs promise Some(0)") is the same defect as S1 — do not list it separately.
- Subtractive 3 (
base_zero/pending_value_zero/refresh_expectedre-deriveValueRate::new(0, expected, _)): DROPPED.refresh_expectednow readszero_duration[slot](policy.rs:1289-1292), andcompare_refreshstill needs the zero-durationValueRateto keep the leading duration ordinal inValueRate::compare(utility.rs:134-139). Removing it would change tie-breaking. - Subtractive 5's "duplicated min-match constant" was KEPT but reduced to ~2 lines; its "delete the manifests'
draft_source == Copy && confidence_width != 0clause" (execution/manifest.rs:844-846) was DROPPED — it fires beforecatalog.rs:123-131on the load path and costs 3 lines, so deleting it buys nothing while losing the earlier error. - All five lenses agree there is no blocker at this head; the previous round's blocker was re-verified fixed independently by Architecture, Correctness and Prose.
VERIFIED CONFORMING AT THIS HEAD (state as positive, no request): refresh.rs ends at abort with idle gone; SAM accessors are #[cfg(test)] (sam.rs:169-172,420-430,680,818-823); ProposalSource::{parse,from_wire,to_wire} at speculation.rs:46-69 are used from serving.rs:58, python.rs:225-231, selection.rs:141-148; build_host_prefix_ranking (rounds.rs:502-540) + select_host_allocated_candidate (:764-862) replace the duplicated copy loop; wide_copy_curve uses expect for an admission invariant (:570-579); resolve_copy_match (scheduler.rs:1112-1150) backs both proposal entry points and fixes the zero-count ring drift; cost.rs:533-586 proves identical-shape MTP + copy coexistence; docs/scheduling-runtime-design.md:429-433 prose is correct as written (the defect is that cost.rs:244-249 does not implement it).
SUBTRACTION ARITHMETIC (sums to ~86, stated as ~85–90): 46 (rounds.rs:30-33 + :565-566 + policy_tests.rs:6289-6331) + 12 (cost.rs:237-252) + 14 (scheduler.rs:1101-1104, decoded_history.rs:180-183, catalog.rs:240-245) + 12 (cohort preamble duplication rounds.rs:785-803 vs :1019-1030 ≈10, curve clone :925 ≈2) + 8 (catalog.rs:296-299, packing.rs:48-51) + 2 (WIDE_COPY_MIN_MATCH_LEN vs sam::DEFAULT_MIN_MATCH_LEN) = 94; reported conservatively as ~85–90 after allowing the cohort helper to cost a few lines. Method is a static estimate; no build was run.
UNRUN / LIMITS: no CI on e5a69669; the reported 1,712 / 620 / 207 / 71 test counts and the SAM microbenchmark were not re-run; no GPU path (including the wide copy-verify W=16/24 cohorts) was exercised. @voipmonitor's live TP4 verification used the default --no-history-drafts, so the copy-only paths did not run on hardware in that evidence either.
#19 [high] FINAL (round 7) — full report + summary for PR #540 at 982a9ce3
PR #540 head 982a9ce3, base main 353551e9. 10 files, +647/−47. Files: docs/scheduling-runtime-design.md (+29/−17), docs/scheduling-theory.md (+16/−7), helios/src/scheduler.rs (+5/−1), helios/src/scheduler/cost.rs (+89/−0), helios/src/scheduler/policy_tests.rs (+394/−7), helios/src/scheduler/refresh.rs (+12/−10), scripts/scheduling_sim/learning.py (+7/−4), scripts/scheduling_sim/learning_policy.py (+5/−1), tests/test_scheduling_learning_experiments.py (+47/−0), tests/test_scheduling_learning_policy.py (+43/−0).
VERIFIED IN CODE THIS ROUND:
- refresh.rs now 101 lines: CREDIT_CAP_NS:9, INCOME_RATE:10 (private), ACCEPTANCE_INCOME_RATE:11 (private), validate_completion:63-69, complete:71-93 (Ordinary credits compute duration :74-76 + acceptance on physical :77-79; probe charges acceptance raw :83-85, timing via timing_refresh_duration_ns :87), abort:95-99 (min(0.0)); no
idle. - cost.rs:21-29 observed_duration_ns; 31-45 observed_compute_duration_ns (docstring :33 "Mirrors ActionCosts::observe"); 43 uses gpu.max(wall) for !queued; 47-57 timing_refresh_duration_ns; 298-301 stale_keys; 303-305 refresh_order = observed_at.max(last_attempt); 330-337 ActionCosts::observe (saturating_sub, no wall); unit test 443-502.
- scheduler.rs:1158-1168
pub fn idle(&mut self)= only a submissions.is_empty() check + 5-line doc; single production caller server/runtime.rs:1184 (inside else of executor.outstanding()>0 at 1177); test sites include policy_tests.rs:5909/5952/6041 and error-path 2483. - policy_tests.rs:4364-4406 engine_with_terminal_prefill (existing fixture), 5812-5878 large_prefill_engine (near-verbatim third copy; differs only limits 131_072/8192/1 slot and durations 10MS/12MS), 5881-5962 idle-recovery test, 5964-6057 starvation test (D=145ms), 6059-6137 readiness exclusion, 6139-6182 zero-charge loop guard.
- docs 436-444, 449-452, 456-461, 470-474, 492-499 (scheduling-runtime-design.md), scheduling-theory.md 576-583 and 729-738.
- simulator: learning_policy.py:47 retain_idle_credit=False, 83-84 bool check, 671-677 idle clamps only when flag; learning.py:48-56 configuration_id, 105-109 CLI→parameters tuple, 132 categorical set, 134-137 numeric allow-list, 437-440 --retain-idle-credit, 477-484 validate guard (flag rejected by --preset validate); tests/test_scheduling_learning_experiments.py:492-509 (partial_blocks precedent) vs 746-790 (new 45-line near-duplicate); tests/test_scheduling_learning_policy.py:1519-1520 (last probe term) vs 1561-1562 (max(145,30)).
REJECTED LENS CLAIMS (do not re-litigate):
- Architecture N2 "timing_refresh_duration_ns's
unwrap_or(timing.wall_ns)unreachable": WRONG. validate_completion (refresh.rs:63-69) accepts gpu-timing-absent + wall_ns>0; then compute=None, observed_duration_ns=None, third fallback returns wall. Exercised by cost.rs:464-466 (wall 100_000). Fallback chain is needed; keep it. - Conventions nit "use refresh::INCOME_RATE in asserts": INCOME_RATE/ACCEPTANCE_INCOME_RATE are private consts (refresh.rs:10-11), not
pub(super)like CREDIT_CAP_NS:9 — using them means widening visibility. Downgraded to nit with that caveat. - Conventions S2 "extract shared sample helper for observe/compute": Simplitude+Subtractive oppose code addition and note the two predicates differ deliberately (observe records raw device sample, no wall); only two trivial extractors could be shared. Reduced to a docstring-wording nit.
- Simulator delete-the-flag suggestions: flag is dual-valued and is the evidence layer design-review.md:190-203 requires; kept.
REPORT STRUCTURE (counts): Blockers 0; Should fix 4; Subtract/Simplify 4; Nits 6. Should fix: (1) helios/README.md:432-437 stale idle rule + missing readiness-wait exclusion; (2) policy_tests.rs:5812-5878 fixture duplicate → parameterize 4364-4406 (~35 lines); (3) tests/test_scheduling_learning_experiments.py:746-790 parametrize against 492-509, keep only the main() argv-rejection case (~30 lines); (4) learning_policy.py:47 default False + docs/scheduling-theory.md:730-737 — say the 64-seed validate run encodes retain_idle_credit=True in --configs (flag form is rejected by --preset validate), and consider flipping the default for retained-refresh. Subtract: (1) cost.rs:443-502 delete duplicate unit test (~58); (2) delete RequestScheduler::idle + call at runtime.rs:1184 + ~10 test sites (~12); (3) inline timing_refresh_duration_ns into refresh.rs:87 and reword the "strictly positive" claim (~10); (4) de-duplicate doc restatements (idle + readiness ≤4x in one section) (~15). Total ~125-140 of 647. Nits: N1 cost.rs:31-36 docstring parity overstatement; N2 cost.rs:303-305 refresh_order 0-sentinel; N3 bound re-derived with different overrun terms (policy_tests 5961/6056 vs test_scheduling_learning_policy.py 1561-1562; doc says most recent probe); N4 learning.py four hand-maintained PolicyConfig lists; N5 PR body "strictly positive charge" + unresolved named main failure without assertion/baseline; N6 income-rate literals in new asserts. NOT RUN: CI on 982a9ce3 (none reported), any Rust/pytest, 64-seed validate, TLA+, GPU/HTTP (tests/server/test_scheduler.py), live disk-readiness stalls. SUMMARY POST text (verbatim, counts 0/4/4/6): "### Recommendation: Merge After Should-Fix\nThe code change is minimal and verified conforming; the one behavioural doc (helios/README.md) still states the retired idle rule, and the remaining work is test duplication to collapse and repeated prose to cut.\n\n### Blockers: None.\n### Should fix: 4\n### Subtract / Simplify: 4 (~125–140 deletable lines)\n### Nits: 6"
#20 [high] Round 7 final: counts 0/4/4/6, subtraction ~95, verbatim summary post
CORRECTION to entry #19 arithmetic (supersedes the 125-140 figure there).
Subtract / Simplify section = 4 items, ~95 lines:
- cost.rs:443-502 duplicate unit test deleted: ~58
- RequestScheduler::idle (scheduler.rs:1158-1168) + runtime.rs:1184 + 10 test sites: ~12
- inline timing_refresh_duration_ns (cost.rs:47-57) into refresh.rs:87: ~10
- doc restatement dedupe (idle fact 4x, readiness exclusion 4x in one section): ~15
Plus Should Fix 2 (policy_tests.rs:5812-5878 collapse) ~35 and Should Fix 3 (tests/test_scheduling_learning_experiments.py:746-790 collapse) ~34 → roughly 160 of the 647 added lines (~25%) fall overall.
FINAL COUNTS: Blockers 0 / Should fix 4 / Subtract-Simplify 4 / Nits 6.
FINAL GITHUB SUMMARY POST (verbatim):
Recommendation: Merge After Should-Fix
The runtime change is minimal and checked out; one operator doc still states the retired idle rule, and the rest is duplicated tests and repeated prose to delete.
Blockers:
None.
Should fix: 4
Subtract / Simplify: 4
Nits: 6
Verified extras for the report body:
- design-review.md:168-241 testing hierarchy; :197-203 "timing estimation or funded refresh require running the screening and 64-seed validation catalog... Do not diverge Helios from the simulator's qualified policy".
- AGENTS.md:52-60 present-state prose rule; AGENTS.md:227 helios/README.md is required reading for Helios scheduling changes.
- docs/scheduling-theory.md:769-786 shows the validate invocation uses --configs nominated.json, so the flag cannot be passed there (learning.py:477-484 rejects it).
- docs/scheduling-theory.md:682 "Idle clears positive balances and retains debt" is the simulator-only
harm_alphaledger (669-686), not a conflict. - policy_tests.rs:2493/2592/2611/2613 are pre-existing hard-coded rate literals; the new ones at 5961/6056/6075/6076/6086 follow local precedent. refresh.rs:10-11 INCOME_RATE/ACCEPTANCE_INCOME_RATE are private (CREDIT_CAP_NS:9 is pub(super)).
- Readiness exclusion verified to band: cost.rs:464-466 covers gpu-timing-absent + wall 100_000 → timing_refresh_duration_ns returns 100_000, so the third fallback IS reachable (rejects Arch N2's dead-code claim).
#21 [high] Round 7 verifications: idle test sites, wrapper call sites, base-diff attribution
Two extra verifications for the report body:
-
Policy tests that carry the idle-retention assertions: policy_tests.rs:2471-2508 (
ordinary_income_excludes_queued_wall_wait_and_idle_retains_credit_while_abort_discards_positive) asserts credit unchanged at 2497-2499 and abort discards positive/keeps debt at 2500-2507; :2544-2616 (refresh_funding_requires_earned_credit_and_accounts_for_repeated_attempts_and_idle) asserts unchanged credit across idle at 2563, 2595, 2615; :2443-2468 asserts debt preserved across idle at 2466-2467. So deletingidle()would make those assertions vacuous — the rename (assert_idle(&self) + 1-line doc) is the safer subtractive form; deletion only if maintainers accept losing that expression. -
After deleting the cost.rs:443-502 test,
cost::timing_refresh_duration_nshas exactly ONE remaining call site (refresh.rs:87) — measured by search: no other helios/src reference. So inlining it into refresh.rs:87 is a clean single-site change. -
The "What they changed" diff included in the round prompt is base-branch churn from OTHER merged PRs (#559, #558, #557, #556, #555, #544, #546, #545, #539, DispatchRing, docs/design-review.md testing hierarchy, AGENTS.md ignition component count). None of it belongs to this PR's diff (pr_files = 10 files listed in entry #19). Do not attribute any of it to PR #540.
#22 [high] FINAL round 7 report text for PR #540 at 982a9ce3 (counts 0/4/4/6)
Review — PR #540: "Retain bounded timing-refresh credit across idle and exclude readiness wait"
Head 982a9ce3, base main 353551e9. 10 files, +647/−47: docs/scheduling-runtime-design.md (+29/−17), docs/scheduling-theory.md (+16/−7), helios/src/scheduler.rs (+5/−1), helios/src/scheduler/cost.rs (+89/−0), helios/src/scheduler/policy_tests.rs (+394/−7), helios/src/scheduler/refresh.rs (+12/−10), scripts/scheduling_sim/learning.py (+7/−4), scripts/scheduling_sim/learning_policy.py (+5/−1), tests/test_scheduling_learning_experiments.py (+47/−0), tests/test_scheduling_learning_policy.py (+43/−0). Nothing in the description, comments or docs tried to direct this review.
Key findings
- No blockers. The change is small and correct where I could check it: refresh income moves to compute duration excluding readiness wait (
refresh.rs:71-79,cost.rs:31-45) while acceptance learning stays on raw physical time (refresh.rs:77-79,:83-85);RefreshState::idleis deleted so retention is the absence of a mutation (refresh.rs:95-99holds onlyabort);ActionCosts::refresh_orderis back toobserved_at_ns.max(last_attempt_ns)(cost.rs:303-305), so the starvation defect raised ate5a69669is gone; and zero-charge refresh loops stay impossible becausevalidate_completion(refresh.rs:63-69) still requires an isolated measured interval. - The PR is now correctly scoped. Earlier heads carried SAM copy drafting, wide copy-verify graphs and batch-padding pruning; all are gone, leaving one coherent outcome with no production flag, no manifest or Protobuf change and no new graph family.
- 4 should-fix items, and only the first is behavioural prose.
helios/README.md:432-437— the crate-level present-state spec — still states the rule this PR deletes and omits the readiness-wait exclusion. The other three are duplication and evidence orientation: a third near-verbatim test fixture, a Python CLI test that repeats an existing one clause for clause, and the simulator'sretained-refreshdefault still modelling the pre-PR runtime. - 4 subtractive items worth ~95 lines, plus ~69 more from the two test-duplication should-fixes: roughly 160 of the 647 added lines (~25%) are removable, essentially all of it in tests and docs. The production diff is minimal and should merge as written.
- Evidence is disclosed, structured and internally consistent, but unrun here. No CI on
982a9ce3; the 804 pytest passes, 1,705 helios tests (one named pre-existingmainfailure), the crate counts, 9 TLA+ models / 590,327 transitions and the 64-seed--preset validaterun (62 scenarios, 35/35 vsttl, 0/2,240 idle spurious probes) were not re-executed; no GPU path was run, so the readiness-wait exclusion — the second half of the PR — is exercised only by syntheticExecutionTimingvalues (cost.rs:443-502,policy_tests.rs:6059-6182).docs/TODO.txt:110-114still lists live Helios qualification of retained costs as open, which is consistent.
Scope note: the branch tip's diff against main also contains unrelated merged work (#556 DispatchRing, #555 capacities, #539/#544/#545/#546/#557/#558/#559, the docs/design-review.md testing hierarchy). None of it is part of this PR; the review covers the ten files above.
Blockers
None.
Should Fix
S1. helios/README.md:432-437 still states the retired idle rule and omits the readiness-wait exclusion
The paragraph reads: "Ordinary valid execution earns refresh credit at 0.002 / 0.998 times its measured duration, capped at 5 ms. … Refresh pays for one complete physical program, including its proposal and verification work. Another refresh waits for full credit. Idle discards positive credit and preserves debt." and links to ../docs/scheduling-runtime-design.md#funded-timing-refresh at :439.
Both claims are now false. RequestScheduler::idle (helios/src/scheduler.rs:1158-1168) touches no ledger, RefreshState::abort (refresh.rs:95-99) is the only min(0.0) clamp, and income is compute duration excluding measured readiness wait (refresh.rs:74-76, cost.rs:31-45), with the refresh charge on the same basis and an unexcluded physical/wall fallback (refresh.rs:87, cost.rs:47-57).
Change: rewrite :432-437 to say credit is 0.002/0.998 of measured compute duration excluding measured readiness wait (samples whose device interval does not exceed the wait earn nothing), that the funded refresh is charged that same compute duration with an unexcluded physical/wall fallback, and that idle retains bounded earned credit (<= 5 ms) and negative debt while abort discards positive credit and preserves debt. The surrounding text at :423-424 already describes the readiness subtraction for cost estimates.
Why: AGENTS.md:52-60 makes every repository document a present-state specification, and AGENTS.md:227 names helios/README.md as required reading for Helios scheduling changes. The PR updated docs/scheduling-runtime-design.md:436-444, :449-452, :456-461, :492-499 and docs/scheduling-theory.md:576-583, :730-737 for exactly these two rules and missed the runtime README the operator reads: the repository now documents two opposite idle policies, and a reader concludes a 1-second-burst workload can never fund a refresh, which is the defect this PR fixes. This is the highest-priority item but not a blocker — the three documents that govern the behaviour are correct.
S2. helios/src/scheduler/policy_tests.rs:5812-5878 — large_prefill_engine is the third copy of one fixture
It reproduces engine_with_terminal_prefill (policy_tests.rs:4364-4406) step for step: same RequestScheduler::new + SchedulerCapabilities block (vision disabled, completion_token_capacity: 16, vocabulary: 1024, empty completion_inputs/speculative_allocations), same prefill_graphs/terminal_prefill_graphs calls, same duration_graphs(1) + retain(kind != Prefill …), same two GraphDescriptor push loops with field-for-field identical literals (batch_capacity: 1, packed_token_capacity: 0, prefill_capacity: 0, input_bindings: vec![], handle: 100 + capacity / 1000 + capacity), and the same trailing measured_graph_durations. A third copy exists at :5443-5508 (cold_deepseek_16k_engine). The new copy differs only in the limits (max_active: 1, request_slots: 1, max_sequence_tokens: 131_072, prefill_chunk_size: 8192, pages: 4096, snapshots: 64 at :5815-5822) and in flat 10 * MS / 12 * MS durations (:5855, :5872) instead of the capacity-derived formulas at :4383, :4400.
Change: parameterize the existing helper — engine_with_terminal_prefill(limits, prefill: &[usize], terminal: &[usize], prefill_ns: impl Fn(usize) -> u64, terminal_ns: impl Fn(usize) -> u64) — and reduce all three builders to calls into it. Test-only refactor. Saves ~35 lines.
Why: GraphDescriptor is extended often (this PR's own fixture restates all fifteen fields), so each addition now needs three edits in one file, and ActionCosts::prepared keys on kind and capacity, so a field drifting in one copy silently makes two tests measure different things.
S3. tests/test_scheduling_learning_experiments.py:746-790 repeats test_partial_block_uncertainty_is_explicit_and_keeps_default_ids clause for clause
The new 45-line test_retain_idle_credit_cli_option_is_boolean_and_excluded_from_validation_overrides asserts the same five things as :492-509 for --partial-blocks: default False (:755 vs :497), flag ⇒ True and id.endswith(":…=True") (:768-769 vs :502-503), sweeps are numeric on --sweep <flag>=0,1 (:770-776 vs :504-506), boolean on PolicyConfig(<field>=None|0|1|"true") (:777-779 vs :507-509), plus one genuinely new case — main(["--preset","validate","--configs",…,"--retain-idle-credit"]) exits 2 (:780-790).
Change: keep the shared body parametrized over ("--partial-blocks", "partial_blocks") / ("--retain-idle-credit", "retain_idle_credit") and keep the main() argv-rejection case, which is the only new behaviour. Saves ~30 lines. The flag plumbing it guards is correct and worth keeping: learning.py:439-440 (store_true, default=None), learning_policy.py:83-84 (real bool), learning.py:48-56 (id suffix only when non-default), :132 (sweep rejection), :477-484 (validate-preset rejection).
Why: behaviour-identical coverage twice means the next flag pays the same 45 lines again, which is the failure mode this test file already exhibits for partial_blocks/mean_estimator.
S4. scripts/scheduling_sim/learning_policy.py:47 — the simulator's retained-refresh default models the policy Helios no longer has
retain_idle_credit: bool = False, and LearningScheduler::idle (learning_policy.py:671-677) clamps credit_ms = min(0.0, credit_ms) only when the flag is set. After this PR, RequestScheduler::idle (helios/src/scheduler.rs:1158-1168) retains unconditionally, so a default retained-refresh run in the simulator models a rule the runtime does not implement — while docs/scheduling-theory.md:730-737 concedes the split ("Without --retain-idle-credit, idle discards positive credit … with --retain-idle-credit (as in Helios)").
The flag is also unreachable through the qualified invocation: docs/scheduling-theory.md:775-778 runs validation as --preset validate --configs nominated.json, and learning.py:477-484 rejects --retain-idle-credit there outright ("validation policy parameters come exclusively from --configs"), so the 64-seed run can only carry the setting inside the --configs JSON.
Change: default retain_idle_credit=True for retained-refresh so the simulator's qualified policy matches the runtime, keeping the boolean reachable through --configs for reproducing the pre-PR rule (or, if the default must stay, make the value mandatory in PolicyConfig.__post_init__ at learning_policy.py:85-88, which already gates funded/estimator). Then add one sentence to docs/scheduling-theory.md:730-737 that the 64-seed --preset validate run encodes the setting in its --configs file, so an operator does not try the flag against the preset.
Why: docs/design-review.md:190-203 — "Do not diverge Helios from the simulator's qualified policy without updating and validating the rule across that catalog" — and AGENTS.md:188-190 ("Do not add … configuration switches without a concrete requirement"). Either outcome removes the divergence; the current state documents it but leaves the default pointing at the retired rule.
Subtract / Simplify
The production change is already minimal: two small helpers, two one-line call changes in RefreshState::complete, deleting RefreshState::idle, and the simulator flag the testing hierarchy requires. Nothing to cut there. Roughly 95 lines are removable in tests and docs, and the two test-duplication should-fixes above add ~65 more (~160 of 647, ~25%). Ranked by lines:
- ~58 lines — delete
helios/src/scheduler/cost.rs:443-502.compute_refresh_duration_excludes_readiness_wait_and_charges_positive_on_zero_computewalks the<,==, missing-GPU andwall_ns == 0matrix at helper level, and every one of those cases is already asserted end to end by tests this same PR adds:policy_tests.rs:6059-6137(income145 ms * 0.002/0.998, acceptance400 ms * 0.01/0.99, dominated casecredit_ns == 0, absent timing both 0, charge-140 ms,costs.duration_key(key) == Some(145 * MS)) and:6139-6182(thewait_ns120 ms /gpu_ns100 ms loop overwall_ns ∈ {0, 130 ms}, observation unchanged,refresh_credit_ns == CREDIT_CAP_NS - max(100, wall)and negative, next planOrdinary). Nothing asserted incost.rsis left unasserted, and both helpers stay exercised throughrefresh.rs:74andrefresh.rs:87. Also drop the doubledtiming_refresh_duration_ns == observed_compute_duration_nspairs at:456-457and:460-461if any case is kept. - ~12 lines — delete
RequestScheduler::idle.helios/src/scheduler.rs:1158-1168no longer touches a ledger; it checkssubmissions.is_empty()and still takes&mut self, under a five-line doc comment arguing a retention policy the function does not implement. Its only production callerhelios/src/server/runtime.rs:1184sits in theelseofif executor.outstanding() > 0(:1177), so the error branch is unreachable from production. Prefer the renameassert_idle(&self)with a one-line comment over outright deletion: the ten test call sites (policy_tests.rs:2466, 2483, 2497, 2552, 2562, 2593, 2614, 5909, 5952, 6041) include real assertions of retention across idle (:2497-2499,:2563,:2595,:2615) and of debt preservation (:2466-2467), which deletion would make vacuous; only:2483tests the precondition. Either way the retention argument belongs indocs/scheduling-runtime-design.md:443-444, where it already is. - ~10 lines — inline
cost::timing_refresh_duration_ns.cost.rs:47-57is six lines of doc plus a three-line body overobserved_compute_duration_ns, and after removing thecost.rstest it has exactly one call site,refresh.rs:87:self.credit_ns -= cost::observed_compute_duration_ns(timing) .or_else(|| cost::observed_duration_ns(timing)) .unwrap_or(timing.wall_ns) as f64;observed_compute_duration_nskeeps its doc; the wrapper's doc repeats the same two facts. Keep the three-term chain — all three arms are reachable:validate_completion(refresh.rs:63-69) accepts a probe with no GPU timing andwall_ns > 0, which is the third arm (cost.rs:464-466asserts it), and the first arm is absent exactly whengpu_ns <= wait_ns, which is the second. - ~15 lines — say each new fact once per document. Idle retention appears twice in each file (
docs/scheduling-runtime-design.md:443-444and:492-493;docs/scheduling-theory.md:577-583and:730-737), and the readiness-wait exclusion is restated four times inside one section (docs/scheduling-runtime-design.md:436-444,:449-452,:456-461,:492-499). The "Funded timing refresh" paragraph plus the closing summary sentence at:496-499carry every rule, constant and cross-reference.
Deliberately kept (so a later round does not re-add or remove them): observed_compute_duration_ns's gpu_ns <= wait_ns guard and its max(wall_ns) term — required by the zero-charge hazard and by the isolated-execution rule; the --retain-idle-credit / PolicyConfig.retain_idle_credit pair — dual-valued and the evidence layer docs/design-review.md:190-203 requires for this class of change; policy_tests.rs:5881-5962 (idle-separated recovery) and :5964-6057 (starvation with D = 145 ms > ttl_ns / 499) — different end states, the second carrying the regression; RefreshState::abort (refresh.rs:95-99) — a helper would cost more than its two lines; and tests/test_scheduling_learning_policy.py:1531-1571 — the simulator-layer counterpart, not a duplicate.
Nits
helios/src/scheduler/cost.rs:31-36— "compute duration" and "MirrorsActionCosts::observe" overstate the parity. The helper returnsmax(gpu_ns, wall_ns) - wait_nsfor isolated executions (:43-44) whileobserve(cost.rs:330-337) records the device interval less wait and never useswall_ns. The wall term is inherited fromobserved_duration_ns(:21-29) and is not new, but the parity claim is: narrow the docstring to "device interval (or isolated wall time) less readiness wait", and note on both functions that only the device-interval-minus-wait step is shared in intent.cost.rs:303-305—refresh_order's0sentinel is indistinguishable from an observation atnow_ns == 0.map_or(0, …)means both "never observed" and "observed when the clock was zero", and refresh selection sorts ascending, so such a key would sort first. Harmless today —stale_keys(:298-301) already excludesnanos == 0entries that are not fresh, and behaviour matchesmain— noted only because the PR body argues this ordering is the starvation guard. If touched, use the(nanos != 0).then_some(observed_at_ns)shapeobservation()already uses (:314-318).- The same theorem is re-derived with two different overrun terms.
policy_tests.rs:5961and:6056addlast_refresh_ns(the most recent episode) whiletests/test_scheduling_learning_policy.py:1561-1562addsmax(145.0, 30.0)(the largest episode);docs/scheduling-theory.md:569-574says "most recent probe" anddocs/scheduling-runtime-design.md:463-464says "current or last refresh episode". Independent re-derivation is a virtue for an oracle, so no shared helper — but one comment naming which term the theorem allows would remove the ambiguity. scripts/scheduling_sim/learning.pykeeps four hand-writtenPolicyConfigfield lists for one dataclass — the CLI→parameterstuple (:105-109), the categorical/boolean sweep-rejection set (:132), the numeric sweep allow-list (:134-137) and the validate-preset override guard (:477-483).retain_idle_creditneeded three of them edited.configuration_id(:48-56) already derives fromfields(config), andPolicyConfig.__post_init__(learning_policy.py:49-88) already validates every field, so (1), (2) and (4) can derive fromdataclasses.fields(PolicyConfig)plus one numeric/categorical table next to the dataclass. Only (3) is a real decision. If the lists are deliberately explicit so a new parameter must be considered for validation policy, say so and drop this.- PR description overstates two things. "…so every refresh completion incurs a strictly positive charge" is a caller-guaranteed property:
timing_refresh_duration_nscan return0when there is no usable GPU sample andwall_ns == 0, and what makes the claim true isRefreshState::validate_completion(refresh.rs:63-69), so name that precondition. Second, the pre-existingmainfailuremodel::tests::packed_combined_budget_keeps_width_one_batches_without_a_useful_packed_shapeis cited without its assertion, symptom or themaincommit at which it reproduces;AGENTS.md:103-112asks each material claim to be checkable against a baseline. - New assertions re-type the income rates at
policy_tests.rs:5961,:6056,:6075,:6076,:6086instead of usingrefresh::INCOME_RATE/refresh::ACCEPTANCE_INCOME_RATE. This follows local precedent (:2493-2494,:2592,:2611,:2613), and note the constants are private (refresh.rs:10-11; onlyCREDIT_CAP_NSat:9ispub(super)), so the fix is to widen them topub(super)and use them — worth doing because the rate also appears three times in the docs (docs/scheduling-runtime-design.md:436,:467,:478).
Verified correct (no action)
- Ledger split.
RefreshState::complete(refresh.rs:71-93) credits timing refresh fromobserved_compute_duration_ns(:74-76) but keeps acceptance learning on raw physicalobserved_duration_ns(:77-79), and a probe charges acceptance raw (:83-85) and timing through the compute-with-fallback duration (:87), matchingdocs/scheduling-runtime-design.md:496-499. - One discard path.
RefreshState::idleis gone;abort(refresh.rs:95-99) keeps only non-positive balances, and no other code clamps credit. The only productionidleentry point isscheduler.rs:1163. - No zero-charge refresh loop.
validate_completion(refresh.rs:63-69) rejects a probe that is queued or has neither a measured interval nor wall time, so the charge is positive on every accepted probe; covered forwait < gpu,wait == gpu,wall == 0andwall > 0atcost.rs:443-502andpolicy_tests.rs:6140-6182. - Starve-free ordering.
refresh_orderisobserved_at_ns.max(last_attempt_ns)(cost.rs:303-305), matchingdocs/scheduling-runtime-design.md:446-449, with theD = 145 ms > ttl_ns / 499regression atpolicy_tests.rs:5964-6057and its simulator mirror attests/test_scheduling_learning_policy.py:1531-1571. - Bound preserved. Since idle adds neither credit nor ordinary duration,
P <= (0.002/0.998) * O + DandP <= (0.01/0.99) * O + Dstill hold (docs/scheduling-runtime-design.md:463-474,:492-495); the retention statement is asserted atpolicy_tests.rs:2497-2499,:2563,:2595,:2615and the abort distinction at:2500-2507. - Docs that were updated match the code:
docs/scheduling-runtime-design.md:434-474,:488-499;docs/scheduling-theory.md:576-583,:727-738.docs/scheduling-theory.md:682("Idle clears positive balances and retains debt") is the simulator-onlyharm_alphaledger (:669-686), not a conflict. - No new production flag, environment switch,
#[allow(dead_code)]or manifest/Protobuf change, so the core-compatibility obligation inAGENTS.md:431-444does not apply.
Not verified here
No CI check is reported on 982a9ce3 and I ran no cargo, pytest, simulator sweep, TLA+ model or GPU path. The description's counts (804 pytest passes; 1,705 helios tests with one pre-existing main failure; 503/208/236/221/414 crate results; 9 TLA+ models / 590,327 transitions; the 64-seed --preset validate run at 62 scenarios, 35/35 vs ttl, exact 1.000000 parity, 64/64 recovery, 0/2,240 idle spurious probes) were judged for structure and internal consistency against the emitting code paths, not re-measured. tests/server/test_scheduler.py was not opened or run, and live disk-readiness stalls and power-cap recovery were not exercised, so the readiness-wait exclusion rests on the synthetic ExecutionTiming cases above. Nothing in the diff changes exported cores or persisted formats, so no re-export check is implied.
COMPACT SUMMARY (GitHub post):
Recommendation: Merge After Should-Fix
The runtime change is minimal and checks out; one operator doc still states the retired idle rule, and the rest is duplicated tests and repeated prose to delete.
Blockers:
None.
Should fix: 4
Subtract / Simplify: 4
Nits: 6
#24 [high] Research summary
Both outputs are prepared for PR #540 at head 982a9ce3 (base main 353551e9, 10 files, +647/−47). The full report is scratchpad entry #22 ("FINAL round 7 report text for PR #540 at 982a9ce3"), with the supporting verification notes in #19–#21 and #23; final counts are Blockers 0 / Should fix 4 / Subtract–Simplify 4 / Nits 6, reconciled in favour of subtraction wherever lenses conflicted.
Key verified positions: the rewrite of this PR is now minimal and correct where checked (income moved to compute duration excluding readiness wait at refresh.rs:71-79 + cost.rs:31-45, acceptance ledgers kept on raw physical time at refresh.rs:77-79/:83-85, RefreshState::idle deleted so abort at refresh.rs:95-99 is the sole discard path, refresh_order restored to observed_at_ns.max(last_attempt_ns) at cost.rs:303-305, zero-charge refresh loops still impossible via validate_completion at refresh.rs:63-69). The one behaviourally wrong artifact is helios/README.md:432-437, which still states "Idle discards positive credit" and omits the readiness-wait exclusion while linking to the design section this PR rewrote — should fix, not a blocker. The rest is duplication to delete: the third copy of the terminal-prefill fixture (policy_tests.rs:5812-5878 vs :4364-4406/:5443-5508), a Python CLI test repeating test_partial_block_uncertainty_… clause for clause (tests/test_scheduling_learning_experiments.py:746-790 vs :492-509), the duplicate helper-level readiness matrix (cost.rs:443-502), the now assertion-only RequestScheduler::idle (scheduler.rs:1158-1168, single caller server/runtime.rs:1184), the one-call-site timing_refresh_duration_ns, and four-times-restated prose — ~160 of 647 added lines (~25%). I rejected two lens claims: Architecture's "unreachable third fallback" (it is reachable and asserted, cost.rs:464-466) and the income-rate-constant nit's premise (the constants are private, refresh.rs:10-11). I also flagged that the branch-tip diff contains unrelated merged work (#556 DispatchRing, #555, #539–#559, the new testing hierarchy) that must not be attributed to this PR, and that no CI, simulator, TLA+, or GPU run was performed here.
Compact summary for the GitHub post:
Recommendation: Merge After Should-Fix
The runtime change is minimal and verified; one operator doc still states the retired idle rule, and the rest is duplicated tests and repeated prose to delete.
Blockers:
None.
Should fix: 4
Subtractive suggestions: 4
Nits: 6
#25 [high] AUTHORITATIVE final summary block + section label mapping (round 7, 982a9ce3)
PUBLISH THIS EXACTLY (recommendation + 1–2 sentence takeaway + counts only; no per-item bullets, no code blocks; 296 characters):
Recommendation: Merge After Should-Fix
The runtime change is minimal and verified; one operator doc still states the retired idle rule, and the rest is duplicated tests and repeated prose to delete.
Blockers:
None.
Should fix: 4
Subtractive suggestions: 4
Nits: 6
LABEL MAPPING (full report → summary):
- Full-report section heading is "Subtract / Simplify" (per the required structure); the summary line must read "Subtractive suggestions: 4" because that is the posted template label. Do not renumber.
- "Nits" counts all six nit items in entry #22 (cost.rs docstring parity; refresh_order 0-sentinel; two different overrun terms; four hand-maintained learning.py field lists; PR-body "strictly positive charge" + unnamed main failure; income-rate literals).
COUNT CHECK AGAINST ENTRY #22 (must match exactly):
- Blockers: 0 (explicit "None.").
- Should Fix: S1 helios/README.md:432-437; S2 policy_tests.rs:5812-5878 fixture; S3 tests/test_scheduling_learning_experiments.py:746-790; S4 learning_policy.py:47 + scheduling-theory.md:730-737 = 4.
- Subtract / Simplify: cost.rs:443-502 test (~58); RequestScheduler::idle (~12); timing_refresh_duration_ns inline (~10); doc restatement dedupe (~15) = 4 items, ~95 lines.
- Nits: 6 as listed above.
CAVEAT FOR THE REPORT WRITER: if any item is added or dropped during final editing, both the full report section and this counts block must change together — the summary's only function is to point at the Full Review with matching numbers.
#11 [medium] Spot-checks confirmed: idle call sites, no binding round-trip test, selection duplicate tuple
Final spot-checks at head 14019718 (all confirmed):
- refresh.rs:95-99
pub fn idle(&mut self) {}; callers scheduler.rs:1277-1283, server/runtime.rs:1184; test call sites policy_tests.rs:2610,2626(is_err),2638,2689,2699,2730,2751,3685,6102,6108,6153 (11 sites). - binding.rs has only the hard-coded "MTP" at :201 (no derive, no round-trip test: nearest tests at :1348 export_rejects_runtime_history_preferences, :1431 execution_buffers_resolve_allocation_relative_offsets, neither touches draft_source).
- selection.rs:244-246 rejects draft_source not in [1,2] and non-zero on non-speculative (good), :250-251 includes draft_source in the duplicate-variant tuple (the precedent for adding it to cost::Key / catalog filter).
- policy.rs:119 dominates_padding_with, :199 prune_padding, :221-254 second pass.
- model/tests.rs:847 and :1862 the two overlapping end-to-end tests; scheduler/tests.rs:1995 the SAM scheduler test. Everything in the delivered final report holds; base-branch commits (ba35da3f prefill natural fit, f377dc85 joint-tuning) are not attributable to this PR.
#23 [medium] Addendum: S4 default-flip caveats + third fixture copy confirmed
Addendum to entry #22, S4 wording (include in the full report):
Flipping retain_idle_credit to default True for retained-refresh also touches two sites that must be updated with it:
tests/test_scheduling_learning_experiments.py:755assertsdefaults[-1].config.retain_idle_credit is False; that assertion becomes True.- The PR's own simulator parity claim ("exact 1.000000 parity vs main") was produced with the default (discarding) configuration, so the parity baseline for
retained-refreshmust be re-stated as the explicitly-discarding--configsvariant, whileknown/ttlbaselines are unaffected (learning.py:98-99, 142-143).
Verified supporting facts:
learning.py:147-157already special-casesretained-refreshfor funding/estimator restrictions, so a policy-scoped default is expressible in the same place.learning_policy.py:85-88shows the__post_init__mechanism that could make the value mandatory instead.docs/scheduling-theory.md:775-778is the exact--preset validate --configs nominated.jsoninvocation;learning.py:477-484rejects any CLI policy flag there, so the flag can only arrive inside--configs.- Third fixture copy confirmed at policy_tests.rs:5443-5508 (
cold_deepseek_16k_engine): same descriptor literal and100 + capacity/1000 + capacityhandle convention, differing inprefill_chunk_size: 16_384,snapshots: 32, name spacing andestimated_duration_ns: 0+graph_durationsinstead ofmeasured_graph_durations.