#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.
#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.