Architecture & scope review — PR #540, head e5a69669 (base main f377dc85)
33 files, +4306/−310. Judged against the project charter (Autobot charter lines 12, 21, 35, 42), AGENTS.md (not opened) (contribution scope L155-213, compatibility L431-444, required PR descriptions L72-140, validation/perf L484+) and docs/design-review.md (not opened) principles 1, 3, 8, 12, 13, 15.
Key findings
No blocking issues remain at this head. The one blocker from my previous review is fixed: heliopause/src/export/binding.rs:201-216 now derives the wire draft_source (None|0|1|"MTP" → "MTP", 2|"COPY_DRAFT" → "COPY_DRAFT", unknown → error, COPY_DRAFT on non-speculative → error, round-trip test at binding.rs:1467-1511) instead of overwriting it with "MTP" on the only export route, so wide copy-verify graphs (draft_source = 2, produced by ignition/preparation/execution.py:32,102-108,319) survive to a loadable core. The documentation contradictions are also gone: docs/cli-design.md:200-208 and docs/mtp-design.md:22-66 now describe SAM-first proposals, the 131,072 / 131,072 / 512 caps, min_match_len = 6 and the pruning of copy-only graphs and speculative_widths.
Four should-fix items remain, all architecture/scope rather than correctness: (1) the combined packed-round lookup in cost.rs reintroduces a non-local dependency on unrelated MTP shapes; (2) the PR still bundles four unrelated outcomes with combined-stack-only evidence; (3) a second proposal-source authority with a default re-derived in four places and one layer that silently coerces a declaration instead of rejecting it; (4) the encoder and the exporter disagree about what wire draft_source = 0 means. Nothing here touches the funded-refresh commit 1b0db227, which my lens finds clean and mergeable on its own today.
Resolved since the previous head — verified in code
- Export blocker fixed.
heliopause/src/export/binding.rs:201-216derives instead of clobbering; unit round-tripexecution_preserves_mtp_and_copy_draft_source_and_rejects_unknownatbinding.rs:1467-1511assertsMtp/Mtp/CopyDraft. - Docs match the code.
docs/cli-design.md:200-208states that--history-drafts"retains captured copy-only speculative graphs (draft_source = COPY_DRAFT) wider than the selected MTP draft depth and keeps their widths inspeculative_widths; otherwise, load-time selection prunes copy-only graphs, drops kernels referenced only by pruned graphs, and removes copy-only widths" — matchinghelios/src/runtime_core/selection.rs:277-298and the width rewrite at:382-396.docs/mtp-design.md:22-66describes the per-request suffix automaton first and the shared ring as the fallback, including the preempt→readmit re-index. - Cost keyed by source.
cost::Keycarriesdraft_source: Option<ProposalSource>(cost.rs:61-70,Key::from_stepat:73-83),Estimate.draft_sourceand thehas_mtpexistence scan are gone,packed_round_durationsis[[Vec<Option<u64>>; 7]; 2]refreshed per source (cost.rs:204-221), andprepared()keys on the canonical source (:163-171), so an MTP graph and a copy graph at identical B/D/W/P now coexist instead of failing "prepared graphs require unique shapes". - Cleanups.
RefreshState::idleno longer exists (refresh.rs:95is the newabort), the SAM API is test-only,ProposalSource::{from_wire,to_wire}is unified (speculation.rs:55-69), and thezero_duration[slot]forecast reuse from@shieldstaris folded intopolicy.rs.
Should fix
S1. cost.rs:237-252 — the combined lookup makes a copy shape's cost depend on unrelated MTP shapes
packed_round_duration_for(source, …) is clean, but the combined accessor (cost.rs:237-252) decides a copy width's answer by scanning the MTP table in full:
(None, Some(0)) if !self.packed_round_durations[ProposalSource::Mtp as usize]
.iter().any(|row| row.iter().any(Option::is_some)) => Some(0),
So a copy-only shape measured at (batch, width) returns None (unknown cost) when any unrelated MTP packed shape anywhere in the catalog is measured, and Some(0) (indeterminate-but-known) when none is. That is the same class of non-local dependency as the removed has_mtp scan, one level up: the cost of a graph depends on what other graphs the core happens to contain.
Callers that inherit it: helios/src/scheduler/rounds.rs:585-589 (speculative_duration, in the fixed-width-free path) and helios/src/scheduler/policy.rs:782-788 (continuation_candidate). docs/scheduling-runtime-design.md:425-433 documents the combined rule, including "unmeasured COPY_DRAFT shapes do not mark MTP catalogs unmeasured" — so the code and doc agree, but the documented rule is exactly the coupling the commit was meant to remove.
Fix: delete the combined accessor, have speculative_duration and continuation_candidate take the source they are pricing (both already know whether they are pricing an MTP or copy cohort), and state the two tables separately in the doc sentence.
S2. Scope — four independent outcomes in one PR, with only combined-stack evidence
AGENTS.md:196-199 (not opened) "Keep each PR focused on one coherent outcome"; docs/design-review.md (not opened) principle 15 (reject scope expansion); charter "smallest footprint in shared code". This PR carries four: (1) funded-refresh recovery (cost.rs:31-38, refresh.rs:71-99, cost.rs:324); (2) a ~1,307-line helios/src/scheduler/sam.rs (not opened) wired at admission (scheduler.rs:1843-1850, model/packing.rs (not opened), server/runtime.rs (not opened)); (3) wide copy-verify graphs across manifest (execution/manifest.rs:190-192), Python producer (ignition/preparation/execution.py:32,102-108,319), selection/catalog/cost/rounds/serving; (4) padding dominance in shared policy.rs plus DEFAULT_MIN_MATCH_LEN 3→6 (sam.rs:22 (not opened)).
Why it matters here specifically: commit 4 changes behaviour for every speculation user while 2–3 only affect cores carrying copy inputs, and every headline number in the description ("+12.9% tok/s", "3.078 → 3.650 emitted tokens/round", max_b == C) is measured on the combined stack against prior head 14019718, so neither change can be attributed or bisected. @voipmonitor's live run used default --no-history-drafts, i.e. the wide copy-verify graphs never ran.
Fix: split into (a) refresh recovery — self-contained, CPU-evidenced, mergeable today; (b) padding dominance + min-match length, with live numbers; (c) SAM + wide copy-verify, with a load-and-serve of an exported draft_source = 2 core. If kept together, report per-commit live numbers.
S3. Second proposal-source authority, with one layer that coerces instead of rejecting
GraphDescriptor::draft_source (helios/src/execution/manifest.rs:190-192) now sits beside the pre-existing ModelConfig::speculative_proposal_source (helios/src/model.rs:113 (not opened)) and RequestScheduler::proposal_source (helios/src/scheduler.rs:683). The same integer is decoded independently in heliopause/src/python.rs:225-231, heliopause/src/export/binding.rs:201-216, helios/src/runtime_core/serving.rs:58-62 (not opened), helios/src/runtime_core/selection.rs:144-148,244-246,280,291 and helios/src/runtime_core/describe.rs:534,778 (the last two bypass the new from_wire/to_wire). The "absent means MTP" default is re-derived four times: cost.rs:50-59 (canonical_draft_source), model/catalog.rs:293-299, model/packing.rs:41-53 (not opened), and implicitly in runtime_core/selection.rs:144-148.
The concrete behavioural consequence: canonical_draft_source (cost.rs:50-59) returns None for any non-Speculative kind, so a Mixed graph that declares COPY_DRAFT is silently coerced to "no source" when it enters the cost catalog, while every other layer rejects that declaration — ignition/preparation/execution.py:104 (draft_source == 2 on non-speculative is a ValueError), binding.rs:213-215 ("copy draft source requires a speculative graph"), execution/manifest.rs:845-850 (graph.kind != GraphKind::Mixed && draft_source.is_some() is invalid, i.e. Mixed + Some is allowed there but rejected in the producer). Two layers accept it, one rejects it, one silently drops it.
Rules: docs/design-review.md (not opened) principles 1 ("keep Helios as simple as possible") and 3 ("admission, page reservation …, preemption, readmission, and offload must not branch on model or recipe identity or capability flags"); AGENTS.md:188-193 (not opened) ("Reject unsupported abstractions and churn … no speculative compatibility, fallback layers, or configuration switches without a concrete requirement") and AGENTS.md:176-181 (not opened) (flags/optional paths cannot bypass validation).
Fix: one accessor on GraphDescriptor (and one on ScheduledStep) that owns normalize-and-validate, used by cost, catalog, packing, selection, serving and describe; have describe.rs use ProposalSource::from_wire/to_wire instead of wire::DraftSource::try_from(...).map_or("UNKNOWN", …); and make the Mixed decision once — either reject COPY_DRAFT on mixed everywhere (matching execution.py:104) or support it everywhere.
S4. draft_source = 0 means None in one direction and "MTP" in the other
heliopause/src/python.rs:225-231 maps an explicit wire 0 through ProposalSource::from_wire (speculation.rs:55-62), which returns Ok(None); heliopause/src/export/binding.rs:204 maps 0 to "MTP". helios/src/runtime_core/selection.rs:240-246 requires [1, 2] for a speculative graph's draft_source, so a speculative graph admitted in-process with 0/omitted-None is rejected as "invalid or duplicate serving graph variant", while the same graph re-exported from that core arrives as MTP and validates. helios/manifest.md:38 (not opened) documents 0 and omission as equivalent, which is true on only one of the two paths, and the test at binding.rs:1487-1496 locks the export direction in.
Fix: pick one normalisation — reject 0 on speculative graphs in the manifest decoder, or map 0 → Some(Mtp) in python.rs as binding.rs does — and make selection.rs:244 the single statement of the rule.
Nits
heliopause/src/export/binding.rs:216writesdraft_sourceunconditionally, including when the derived value is the default. Harmless on the wire (proto3 default) but it is the same "always write" shape that produced the original blocker; write it only when it differs from the default.docs/scheduling-runtime-design.mddocuments the two packed-duration tables (:425-433) but not thatselect_host_allocated_candidate/build_host_prefix_ranking(helios/src/scheduler/rounds.rs:505-540,764-862) now serve both the ordinary and the copy candidate loops — one sentence where the doc describes candidate construction.- Derivation quality:
0.88,4.0,2.0and+3now carry stated derivations (helios/src/scheduler/speculation.rs:14-37,rounds.rs:22-27) — the earlier finding is answered — but0.88's argument is analytic ("expected output over 23 copy drafts is1 + Σ 0.88^d ≈ 7.95") andmin_match_len = 6(sam.rs:22-30(not opened)) still rests on one 512-token repetitive code-edit prompt.AGENTS.md:187(not opened) wants measured repeatability; a second, non-code prompt would settle it. - Evidence gap, disclosed honestly by the author: no live run examined an exported core carrying a
draft_source = 2graph, and the wide copy-verify maths is exercised only by hand-built CPU fixtures (helios/src/model/tests.rs:1861-2075,helios/src/scheduler/tests.rs:4120-4300(not opened)). Under charter "Supported matrix & compatibility" (AGENTS.md:431-444(not opened), charter line 42: "verify that existing data, artifacts, and exported cores still load") one load-and-serve of an exportedW = 16/W = 24core would convert the compatibility claim from a unit round-trip into a demonstration.
Positive — no action
The funded-refresh commit 1b0db227 is clean from this lens and could merge alone. cost::observed_compute_duration_ns / timing_refresh_duration_ns (cost.rs:31-38) subtract measured ReadinessIntervals::wait_ns for timing-refresh credit and refresh debt while observed_duration_ns keeps raw physical time for acceptance learning (refresh.rs:71-93), so external readiness stalls no longer inflate refresh debt and earnings; retaining bounded credit and negative debt across idle adds neither term, preserving P ≤ 0.002/0.998 · O + D; abort still discards positive credit (refresh.rs:95-99); and refresh_order (cost.rs:324) replaces the nanosecond timestamp with a two-tier (bool, u64) key, so the first funded refresh probes the highest-expected-value unattempted stale shape instead of the oldest.
Open questions / could not verify
- No CI on head
e5a69669. The reported 1,712 / 620 / 207 / 71 test counts and the SAM microbenchmark were not re-run here. - No live GPU run of wide copy-verify graphs, so whether the copy-only cohorts in
rounds.rsactually beatW = 8MTP on hardware is unmeasured; the description's+12.9%and3.078 → 3.650numbers are combined-stack. - Export of a core carrying
draft_source = 2was not exercised end-to-end;binding.rs:1467-1511is a unit round-trip only. - Whether
Mixed+COPY_DRAFTis meant to be legal (S3) cannot be settled from the code:execution/manifest.rs:850andbinding.rs:213-215treat the two layers differently, andignition/preparation/execution.py:104rejects it outright. A maintainer decision on that one case would settle it and let S3 shrink to a single accessor.