#1 [high] Project rules (charter, AGENTS.md, design-review) key clauses
Sources: read_charter, AGENTS.md (main), docs/design-review.md (main).
Charter: "Solve the right problem in the right place... smallest footprint in shared code"; "Stay focused... not interested in piling on extra model aliases, random switches"; "Bring real evidence. Performance PRs need benchmarks showing an actual speedup over main on a served workload"; "Keep the runtime small and model-agnostic. Helios handles scheduling, caches, requests, and shouldn't accumulate per-model branches"; "Be explicit and pin everything. No magic defaults... Benchmarks, tests, or feature flags don't override architectural rules." Charter code review: "Supported matrix & compatibility: ... Check state and CUDA-graph transitions, and verify that existing data, artifacts, and exported cores still load." "No per-model special cases or flags."
AGENTS.md:
- L155-213 "Contribution scope and rejection criteria": every contribution must address maintainer request, demonstrated defect, measured perf/memory problem, or inaccurate docs. "Reject unsupported abstractions and churn. Do not add frameworks, extension points, speculative compatibility, fallback layers, or configuration switches without a concrete requirement." "Reject weakened guarantees. Preserve complete cache and speculative state ... Do not remove validation..." "Require focused, meaningful validation."
- L431-444 "Model core compatibility": every engine version must load models from previous versions without re-export; Protobuf additions must use defaults that preserve existing core behavior.
- L446-465 Configuration: never read env var for behavior; setting lives in recipe declaration, config file, or CLI flag.
- L484+ Validation and performance: "Compare other runtimes against an exported core running through flare run"; "performance claims require equivalent baselines".
- AGENTS.md L72-140 Required PR descriptions: why / what changed / claimed benefit / evidence, in order.
design-review.md principles: 1 "Keep Helios as simple as possible ... Introducing a captured-graph operation family requires prior explicit approval"; 3 "Preserve canonical model semantics and shared mechanisms ... Admission, page reservation and growth, eviction, preemption, readmission, and offload must not branch on model or recipe identity or capability flags"; 7 "Preserve complete committed state"; 8 "Budget physical memory across the lifecycle. Bound loading, tuning, compilation, capture, and serving storage"; 12 "Validate the real path and report evidence honestly ... keep raw measurements and disclose unrun checks"; 13 "Preserve model core compatibility"; 15 "Reject scope expansion and weakened constraints"; 16 "Write without hidden context".
#2 [high] Should fix: PR bundles four unrelated outcomes (~4k lines, 25 files)
Severity: should fix (scope).
Files: whole PR (25 files, +3965/−119) — helios/src/scheduler/{cost,refresh,policy,rounds,sam}.rs, runtime_core/selection.rs, model/catalog.rs, heliopause/src/python.rs, ignition/preparation/execution.py, docs/scheduling-runtime-design.md.
The description itself lists four independent commits (a85be397 cost-refresh recovery; 83ff9ed6 SAM copy drafts; 35ab143a wide copy-verify graph scheduling; 7ca5430c padding dominance + DEFAULT_MIN_MATCH_LEN 3→6). Each has its own motivation, risk surface and evidence, and each touches a different subsystem (refresh ledger; new 1600-line SAM module; graph catalog/selection/manifest metadata; batch padding policy).
Rule: AGENTS.md L196-199 "Keep each PR focused on one coherent outcome and describe its problem, resulting behavior, validation, and material limitations." design-review.md principle 15 (reject scope expansion / weakened constraints) and charter "Solve the right problem in the right place ... smallest footprint in shared code".
Why it matters: (a) the padding-dominance change and the match-length change alter behaviour for all existing speculation users (policy.rs dominates_padding_with / prune_padding, sam DEFAULT_MIN_MATCH_LEN), while the SAM and wide-copy work only affects cores that carry copy inputs; mixing them makes it impossible to attribute the measured improvement or to bisect a regression. The headline figure ("3.078 -> 3.650 emitted tokens/round") is a combined-stack number for three of the four commits. (b) Nothing in the description isolates the padding-dominance change's live effect from the wide-copy graph change, so the "max_b == C" table cannot be attributed.
Fix: split into (1) the funded-refresh recovery fix (a self-contained defect fix with CPU tests), (2) the padding-dominance + min-match-len change (shared policy, live evidence), (3) the SAM/wide copy-verify feature stack (new capability, new metadata).
#3 [high] Should fix: second proposal-source dimension in manifest + load-time special cases
Severity: should fix (architecture).
Where the duplication appears:
helios/src/runtime_core/selection.rs:182-183—retain_wide_copy = source == 1 && history_enabled && fixed.is_none().selection.rs:277-299(diff hunk at 275) —copy_wideinsideexecution.graphs.retain, bypassing thedraft_source == source,draft_tokens <= draftsandmtp_verification_token_budgetfilters for copy graphs.selection.rs:382-396—retained_widths, rewriting the config'sspeculative_widthsto include widths that no MTP graph implements.helios/src/scheduler/cost.rs:192-201—has_mtpspecial case: copy shapes are excluded frompacked_round_durationswhenever any MTP packed shape exists, so the same (batch,width) cost table means different things depending on what else is in the core.helios/src/scheduler/rounds.rs:745-760+— the whole copy-shape branch inpacked_round_candidates, guarded byproposal_source == Mtp && shape.draft_source == Copy && width > 1.helios/src/scheduler.rs:2792andcost.rs:223—is_copy_only_stepkeyed offActionCostsentries rather than the step, so the sameScheduledStepshape is "copy" or "MTP" depending on which graph the manifest happened to bind.
Why it matters: a graph's proposal source is already an expression of the core's speculative_proposal_source config (selection.rs:161-165, model.rs), and the scheduler already has proposal_source. This change adds a second source of truth (GraphDescriptor::draft_source, defaulted from kind == Speculative in heliopause/src/python.rs:231-232) and then needs a dozen conditionals to keep the two consistent. Rules: design-review.md principle 1 ("Keep Helios as simple as possible ... Express differences through cache schemes and prepared layout metadata reusable across models") and principle 3 ("Do not add ... capability flags"); AGENTS.md L188-193 "Reject unsupported abstractions and churn. Do not add frameworks, extension points, speculative compatibility, fallback layers, or configuration switches without a concrete requirement"; L176-181 "Flags, enums, callbacks, optional paths, and temporary implementations cannot be used to bypass them."
Also note has_mtp/copy_wide make behaviour depend on which other graphs a core contains — a non-local dependency that is hard to test and easy to break.
Fix: derive per-shape source from the key alone (e.g. keep one CostKey-level notion driven by a single declared catalog field), and keep one place that answers "may a copy-only shape be scheduled" instead of four. If wide copy-only graphs are wanted, the smallest footprint is a scheduler-level check on the captured shape list, not new manifest metadata threaded through selection, catalog, cost, rounds and runtime.
#4 [high] Nit/medium: docs stale after SAM change; unpinned constants; evidence gaps; no-op idle()
Severity: nit / should-fix (documentation accuracy).
-
docs/mtp-design.md(unchanged by this PR) still states that history drafting works from a "host-memory ring" of "exact eight-token and four-token indexes" and "return[s] up to seven observed continuation tokens" (lines 31-34), and that it "requires speculative graphs that declare copy-token inputs, which only the qwen3.8-flash MTP graphs do" (lines 25-27). After this PR the primary source is a per-request prompt+output suffix automaton (helios/src/scheduler/sam.rs,RequestScheduler::request_history_proposalat helios/src/scheduler.rs:1102), with the shared ring only as fallback when it has a strictly longer match (scheduler.rs:1128-1147). The PR only updatesdocs/scheduling-runtime-design.md. AGENTS.md requires design docs to describe implemented mechanism and present qualification. Fix: update mtp-design.md's history-drafting section (mechanism, min match length 6, 131,072-token caps, 512-token boundary overlap). -
helios/src/scheduler/sam.rs:22DEFAULT_MIN_MATCH_LEN: usize = 6and the wide-copy constantsWIDE_COPY_PRIOR_RATE = 0.88/WIDE_COPY_MIN_MATCH_LEN = 6(helios/src/scheduler/speculation.rs:15,18) plusbase_mtp_drafts + 3(rounds.rs copy branch) are unpinned magic numbers in shared policy. Charter: "Be explicit and pin everything. No magic defaults". The PR calls them calibrated but the evidence offered is one repetitive 512-token prompt; no derivation of 0.88 or of "+3" is given. Fix: state the derivation in the design doc or make them explicit policy fields. -
Evidence gap: live results are DeepSeek-V4.1 Flash TP4 on SM120 only with
--history-drafts; copy-only wide graphs (W=16/24) were never exported or replayed on a GPU (the PR's own Limitations say so). So the wide-copy scheduling path (rounds.rscopy branch at ~745,catalog.rs:93-131,selection.rs:275-299,382-396) has CPU-test-only coverage — AGENTS.md L194-199 "Do not present scaffolding or partially wired features as supported". The compatibility claim ("existing W=8-only cores load") rests on the unit testhelios/src/model/tests.rs::wide_copy_verify_catalog_packs_23_sam_tokens_and_preserves_legacy_w8_cores, not a load-and-serve of a previously exported core (design-review.md principle 13). -
helios/src/scheduler/refresh.rs:99pub fn idle(&mut self) {}— an empty method that silently no longer does anything; call sitehelios/src/scheduler.rs:1281. Suggest deleting the method and the call so "idle does nothing" is visible. Nit. -
Positive note to record (no finding): the refresh change itself (
refresh.rs:71-105,cost.rs:31-38) is a clean, well-scoped defect fix — compute duration excludes measured readiness wait, idle preserves earned credit and debt,abortstill discards positive credit, and the aggregate bound indocs/scheduling-runtime-design.md(P <= 0.002/0.998 * O + D) still holds because idle adds neither credit nor ordinary duration.refresh_order(cost.rs:284-293) now returns a tiered key instead of a timestamp, which fixes the "probe older/smaller shapes first" defect.
#6 [high] Blocking: export path overwrites draft_source with "MTP", so copy-only wide graphs never survive export
Severity: blocking (the PR's headline feature cannot run on an exported core; contradicts the PR's "no core re-export required / wired" claim).
Chain, verified in code:
- Producer emits the new field:
ignition/preparation/execution.py:316-319writesdraft_source=signature.draft_source(default 1, 2 = COPY_DRAFT, validated atexecution.py:102-108, stored onGraphSignature.draft_sourceat:32). - The sole route that turns that JSON into a wire
Executionfor a core isheliopause/src/export/capture.rs:3157-3160(request.execution->super::binding::execution(...)->output.index.ranks[0].execution = Some(execution)).binding::executionis defined atbinding.rs:136. - In
binding::execution,binding.rs:196-202unconditionally runsgraph.insert("draft_source".into(), "MTP".into())for every speculative/mixed-speculative graph, after the caller's value is in the map.verify_tokensis derived the same way (that part is legitimate), butdraft_sourceis overwritten rather than derived. Confirmed on main too (binding.rs:201identical atmain), so the PR adds a producer of value 2 without teaching the exporter about it. - Consequences at load:
helios/src/runtime_core/serving.rs:58-63maps 1 ->ProposalSource::Mtp.helios/src/runtime_core/selection.rs:277-298:copy_widerequiresgraph.draft_source == 2, so it is never true; the MTP branch then requiresgraph.draft_tokens <= drafts(:292), and copy-only wide graphs declare depth 23 (> drafts 7), so they are pruned. Net: an exported core loses every wide copy graph, silently, andretained_widths(:382-391) reports widths no remaining graph implements unlessretain_wide_copyis set — which it isn't, becausesource == 1and history enabled.- The copy-only contract checks can never run either:
helios/src/execution/manifest.rs:845-846andhelios/src/model/catalog.rs:123-131both testdraft_source == Some(Copy), which the export path has already rewritten to Mtp.
- The in-process path is unaffected:
heliopause/src/python.rs:225-233readsdraft_sourcefrom the Python dict withNone => Speculative => Some(Mtp), soroller/ignition debug-serveand the CPU tests exercise the new value while the exported path does not — which is exactly why the CPU test suite passes (e.g.helios/src/model/tests.rs:1944,helios/src/scheduler/tests.rs:4183constructGraphDescriptordirectly).
Fix: derive the enum name instead of overwriting it — read the incoming value (1 -> "MTP", 2 -> "COPY_DRAFT", absent -> "MTP" for backwards compatibility with cores produced before this field existed, anything else -> invalid(...)) and add one binding::execution round-trip test asserting 2 survives. Note this is also the compatibility-relevant direction: AGENTS.md:431-444 requires older cores to keep loading, which the "absent -> MTP" default preserves.
How to confirm: a load-and-serve of an exported core containing a graph with draft_source = 2, checking describe/selection keeps it; impossible from the current test suite, which never round-trips through binding::execution with the field set (the existing test at binding.rs:1431-1449 does not set draft_source).
#7 [high] Should fix: docs/cli-design.md and mtp-design.md contradict the new load-time behaviour
Severity: should fix (documentation accuracy — AGENTS.md:165-166 makes inaccurate documentation a rejection item; docs/design-review.md:12 "report evidence honestly").
-
docs/cli-design.md:200-202(not touched by this PR): "--history-draftsenables host history tracking and feeds continuations into the captured graphs' history inputs; it does not change the graphs." After this PR--history-draftschanges the loaded graph set and the configured widths:helios/src/runtime_core/selection.rs:182-184computesretain_wide_copyfrom history + no fixed width;:277-298retains or prunesdraft_source == 2graphs accordingly;:375-380drops kernels for pruned graphs;:382-396rewritesspeculative_widths(the new unit testwide_copy_graphs_retain_only_when_history_drafts_enabled,selection.rs:1876-1940, asserts[1,6,16,24]vs[1,6]). Alsodocs/cli-design.md:741's table row ("Augment learned drafts with shared decoded-history continuations; requires enabled speculation and captured history inputs") no longer describes the primary mechanism (per-request SAM) or the graph-set effect.
-
docs/mtp-design.md:22-40(not touched): says the mechanism is a shared 65,536-token ring with eight/four-token indexes returning "up to seven" continuations, and that it "requires speculative graphs that declare copy-token inputs, which only theqwen3.8-flashMTP graphs do". After this PR the primary source is a per-request prompt+output suffix automaton (helios/src/scheduler/sam.rs:1-37), wired at admission (helios/src/scheduler.rs:1849-1852) and queried byRequestScheduler::request_history_proposal(scheduler.rs:1099-1159), with the ring used only when it has a strictly longer match (:1143-1148). New caps and defaults are undocumented:min_match_len = 6(sam.rs:22, raised 3->6 by this PR), 131,072-token prompt cap (sam.rs:24-25), 131,072-token output cap (sam.rs:27-28), 512-token boundary overlap (sam.rs:30-32).docs/mtp-design.md:359does mentiondraft_sourcein the field list, but nothing explainsCOPY_DRAFTor the wide copy-verify path. -
docs/scheduling-runtime-design.mdwas updated only for funded refresh (the diff touches:407-500); it never documentsdraft_source, wide copy-verify shapes, the copy/MTP packed-duration split (cost.rs:190-208), or the new strictly-tighter-batch pruning rule (policy.rs:221-254), and its module index (:6-12) omits the newhelios/src/scheduler/sam.rs.
Fix: update these three places; nothing else needs new documentation.
#8 [high] Should fix: second proposal-source dimension with non-local cost semantics
Severity: should fix (architecture). Rule: docs/design-review.md principle 1 ("Keep Helios as simple as possible … introduce differences through prepared layout metadata reusable across models") and principle 3 ("do not add capability flags"); AGENTS.md:188-193 (reject unsupported abstractions / configuration switches without a concrete requirement) and AGENTS.md:176-181 (flags, enums and optional paths cannot bypass boundaries).
This extends my earlier note #3 with the newly confirmed code facts.
New: GraphDescriptor::draft_source (helios/src/execution/manifest.rs:190-192) is a second proposal-source dimension that duplicates the pre-existing ModelConfig::speculative_proposal_source (helios/src/model.rs:113) and RequestScheduler::proposal_source (scheduler.rs:1044-1050). Three separate ladder decoders exist: heliopause/src/python.rs:225-233, helios/src/runtime_core/serving.rs:58-63, helios/src/runtime_core/selection.rs:144-148, plus a fourth encoding in describe.rs:534,778.
Cost/selection semantics now depend on which other graphs the core contains:
helios/src/scheduler/cost.rs:190-208:has_mtpis an existence scan; if any MTP packed shape exists (measured or not), every copy packed shape is dropped frompacked_round_durations. Sopacked_round_duration(batch, width)(cost.rs:210-213) returnsNonefor a measured copy shape, andspeculative_duration(rounds.rs:559-568,policy.rs:775) silently loses the copy cost in a mixed catalog.cost.rs:223-232is_copy_only_stephas to infer the source by looking the step's key back up in the table, becauseKey(cost.rs:50-58) has no source field.prepared()rejects duplicate shapes (cost.rs:151-161), so an MTP graph and a copy graph with identical B/D/W/P cannot coexist at all.helios/src/scheduler/rounds.rs:755-902is a second, near-duplicate candidate loop guarded byproposal_source == Mtp && shape.draft_source == Copy && width > 1, withbase_mtp_drafts + 3(:766) as the gate andcurve[position]indexing.helios/src/model/catalog.rs:93-131adds copy-only contract checks keyed off the same field, in a file whose stated role is shape validation.helios/src/runtime_core/selection.rs:184,277-298,382-396bypasses the draft_tokens / fixed-width / verification-budget filters for copy graphs, so oneretainpredicate answers two different questions.
Fix: one authority. Keep the source in a single place (derive the per-shape source from the captured shape or from a named enum on the cost row, not from a global "does an MTP shape exist" scan), split the packed-duration table explicitly into MTP-verify and copy-verify tables, and have is_copy_only_step read a source carried on the step instead of re-querying the table. Then selection.rs needs no copy_wide bypass.
Evidence gap: due to the export defect (note 6) the wide-copy path only ever runs in-process; the CPU fixtures (helios/src/model/tests.rs:1861-2075, helios/src/scheduler/tests.rs:4120-4300) construct manifests by hand.
#9 [high] Should fix: four unrelated outcomes in one PR (re-confirmed at head)
Severity: should fix (scope) — unchanged from note #2, but re-confirmed against the current head 14019718.
25 files, +3968/−119, four independent outcomes, per the PR description's own commit list:
1b0db227funded-refresh recovery (helios/src/scheduler/{cost,refresh,policy}.rs,docs/scheduling-runtime-design.md).450012d1per-request prompt+output SAM, a new 1,606-line module (helios/src/scheduler/sam.rs), wired throughscheduler.rs,model/packing.rs,server/runtime.rs.9caba2c7wide copy-verify graphs: new manifest field (execution/manifest.rs:190-192), new proto enum already on main (helios/proto/runtime_core.proto:842,854), Python producer (ignition/preparation/execution.py:32,102-108,316-319), selection/catalog/cost/rounds/serving changes.14019718padding dominance in shared policy (policy.rs:119-197,221-254) plusDEFAULT_MIN_MATCH_LEN3->6 (sam.rs:22).
Rule: AGENTS.md:196-199 "Keep each PR focused on one coherent outcome". design-review.md principle 15 (reject scope expansion). Charter: "solve the right problem in the right place … smallest footprint in shared code"; "bring real evidence".
Why it matters: (a) commit 4 changes behaviour for every speculation user, while commits 2–3 affect only cores with copy inputs; (b) the headline live numbers are combined-stack ("+12.9% tok/s", "3.078 -> 3.650 emitted tokens/round") and the max_b == C padding table cannot be attributed to commit 4 alone; (c) commit 1 is a self-contained defect fix that could merge today and is the only part my lens found clean and fully evidenced by CPU tests.
Fix: split into (a) refresh recovery, (b) padding dominance + min-match-len, (c) SAM + wide copy-verify. If kept together, report per-commit live measurements.
#10 [high] Nits: no-op idle(), unpinned constants, unused SAM API, evidence gaps; refresh commit is clean
Severity: nit (some items lean should-fix; noted).
-
helios/src/scheduler/refresh.rs:95-99—pub fn idle(&mut self) {}is now an empty method with a doc comment explaining that it does nothing, still called fromhelios/src/scheduler.rs(s.idle()) and from tests (policy_tests.rs:2637,2696,2701). Delete the method and the call sites so "idle changes nothing" is a property of the code, not a no-op function. (Contrast:abort()atrefresh.rs:101-105now carries the discard logic.) -
Unpinned calibrated constants in shared policy — charter "Be explicit and pin everything. No magic defaults"; AGENTS.md:187 "Numerical bounds must follow the required arithmetic and measured repeatability":
helios/src/scheduler/speculation.rs:14-15WIDE_COPY_PRIOR_RATE = 0.88;speculation.rs:21COPY_STEP_PRIOR_WEIGHT = 4.0;:24COPY_DEPTH_SHRINK_WEIGHT = 2.0(private);helios/src/scheduler/rounds.rs:766base_mtp_drafts.saturating_add(3);helios/src/scheduler/sam.rs:22DEFAULT_MIN_MATCH_LEN = 6(raised from 3 here). Only the6is argued in the description, and with a single 512-token repetitive prompt.0.88,4.0,2.0and the+3have no stated derivation anywhere in the tree. Fix: state the derivation indocs/scheduling-runtime-design.mdnext to the new copy section, or promote the policy-relevant ones into namedPolicyConfigfields.
-
helios/src/scheduler/sam.rsAPI surface with no production caller:propose_conditional_continuations(:1118-1189, doc references a "2-deep pipelined execution" that does not exist in the tree),propose_for_context(:1070-1110),MatchSource+MatchProposal::source(:66-83),PromptSAM::build(:283, only tests andwith_configusebuild_capped),push_slice(:1023),from_shared_prompt(:935),memory_bytes/state_count/transition_count/prompt_len/output_len/total_len/output_lenaccessors used only by tests. AGENTS.md:188-193 rejects speculative extension points; ~150 lines. Trim to whatproposeneeds or state the caller. -
Evidence coverage (the PR is honest about it — nit, not a finding): copy-only wide graphs (
W=16/W=24) were never exported or replayed on a GPU, and cost-refresh under live power-limit transitions was not measured; every wide-copy test is a CPU fixture. Combined with note 6 this means the feature has never run on the path it claims. A single load-and-serve of an already-exported W=8 core, plus one exported core with adraft_source=2graph, would settle both AGENTS.md:431-444 compatibility and the wiring claim. -
Preempt->readmit gap:
helios/src/server/runtime.rs:2068-2110(park) re-admits with the generated text appended to the prompt (:2071-2086), and admission rebuildssamfromspec.prompt(scheduler.rs:1849-1852);resume_decoded_sequence(scheduler.rs:1212-1235) restoresdecoded_sequenceand pushes only viahistory.append, notsam.push_token. Worth one test that a re-admitted request still proposes its earlier output continuation. Not verified as a defect — the prompt now contains that text, so SAM re-indexes it — but the behaviour is untested.
Positive (no action): commit 1 is clean. cost::observed_compute_duration_ns/timing_refresh_duration_ns (cost.rs:31-38) subtract measured readiness wait for timing credit and refresh debt while observed_duration_ns keeps raw physical time for acceptance learning (refresh.rs:71-93); idle retaining credit and debt preserves P <= 0.002/0.998 * O + D because idle adds neither; abort still discards positive credit; refresh_order (cost.rs:284-293) replacing the nanosecond timestamp with a two-tier (bool, u64) key fixes the real "probe the older/smaller shape first" defect, and select_plan's compare_refresh (policy.rs:1333-1338,1369-1372) now ranks by zero-duration expected value.
#11 [high] Research summary
Verdict: one blocking architecture/wiring defect, then should-fix scope and design issues; the funded-refresh commit is clean and could merge alone.
Blocking — the wide copy-verify feature is dead on every exported core. heliopause/src/export/binding.rs:201 unconditionally does graph.insert("draft_source", "MTP") after the producer's value is already in the map, and binding::execution is the only route from the Python manifest to a wire Execution (heliopause/src/export/capture.rs:3157-3160). So the draft_source = 2 that ignition/preparation/execution.py:32,102-108,316-319 now emits arrives at load as MTP (helios/src/runtime_core/serving.rs:58-63), copy_wide in helios/src/runtime_core/selection.rs:277-298 is never true, and since copy graphs declare depth 23 > drafts, they are pruned silently. The copy-only contract checks (helios/src/execution/manifest.rs:845-846, helios/src/model/catalog.rs:123-131) can never fire either. In-process paths (heliopause/src/python.rs:225-233) and every CPU test construct descriptors directly, which is why the suite passes and the description's "no re-export required" claim looks satisfied. Fix: derive the enum name (2 => "COPY_DRAFT", absent => MTP for backward compatibility per AGENTS.md:431-444, unknown => invalid) plus one round-trip test.
Should fix (my lens). (1) Scope: 25 files / +3968 for four independent outcomes against AGENTS.md:196-199; the "+12.9% tok/s" and max_b == C numbers are combined-stack and cannot be attributed or bisected. (2) GraphDescriptor::draft_source is a second proposal-source authority duplicating speculative_proposal_source, decoded by four separate ladders, and it forces non-local semantics: cost.rs:190-208 has_mtp is an existence scan that drops measured copy shapes from the packed table, Key (cost.rs:50-58) has no source field so is_copy_only_step (:223-232) infers it from the table, prepared() rejects identical B/D/W/P so MTP and copy graphs cannot coexist, and rounds.rs:755-902 duplicates the ordinary candidate loop. (3) Docs contradict the new behaviour: docs/cli-design.md:200-202 still says --history-drafts "does not change the graphs" while selection.rs:277-298,375-396 prunes graphs, drops kernels and rewrites speculative_widths; docs/mtp-design.md:22-40 still describes only the shared ring, while the SAM is primary; docs/scheduling-runtime-design.md never documents draft_source, the copy/MTP split or the new pruning rule. (4) Unpinned shared-policy constants: 0.88, 4.0, 2.0 (speculation.rs:14-24), +3 (rounds.rs:766), 6 (sam.rs:22 (not opened)) — only the last is argued, from one prompt.
Nits: empty RefreshState::idle(), ~150 lines of uncalled SAM API (propose_conditional_continuations, propose_for_context, MatchSource), and wide copy-verify has never been exported/replayed on a GPU, so the feature's evidence covers a path it cannot reach.
Full detail, citations and line numbers are in scratchpad notes 6–10.
#12 [high] Final verdict and report outline for PR #540 (architecture & scope lens)
Head reviewed: 14019718 on base main f377dc85; 25 files, +3968/−119. Lens: architecture and scope (does it belong, is the approach right).
VERDICT: one blocking defect (export path), four should-fix items, several nits. The funded-refresh commit (1b0db227) is clean and mergeable on its own today.
BLOCKING
heliopause/src/export/binding.rs:201overwritesdraft_sourcewith"MTP"on the sole export route (capture.rs:3157-3160), sodraft_source = 2produced byignition/preparation/execution.py:32,102-108,316-319never survives to a core:serving.rs:58-63reads MTP,selection.rs:277-298prunes the wide copy graphs (copy_wideneeds 2; the MTP branch needsdraft_tokens <= drafts), and the copy-only contract checks (execution/manifest.rs:845-846,model/catalog.rs:123-131) can never fire. Silent, and it contradicts the description's compatibility claim and "no core re-export" framing. Fix: derive the name (2 => "COPY_DRAFT", absent =>"MTP", elseinvalid) + onebinding::executionround-trip test (the existing test atbinding.rs:1431-1449never sets the field). Compatibility direction preserved by the absent=>MTP default, perAGENTS.md:431-444. Full detail: scratchpad note #6.
SHOULD FIX
2. Scope: four independent outcomes in one PR (AGENTS.md:196-199 "Keep each PR focused on one coherent outcome"; design-review.md principle 15; charter "smallest footprint in shared code"). Commit 4 (padding dominance + DEFAULT_MIN_MATCH_LEN 3->6) changes behaviour for every speculation user; the live numbers are combined-stack so neither the max_b == C table nor "+12.9% tok/s" is attributable. Note #9. Fix: split (a) refresh recovery, (b) padding dominance + min-match-len, (c) SAM + wide copy-verify; or at minimum report per-commit live numbers.
3. Second proposal-source authority: execution/manifest.rs:190-192 draft_source duplicates model.rs:113 speculative_proposal_source / scheduler.rs:1044-1050, with four decode ladders (python.rs:225-233, serving.rs:58-63, selection.rs:144-148, describe.rs:534,778). Non-local consequences: cost.rs:190-208 has_mtp existence scan drops measured copy shapes so packed_round_duration returns None for a measured shape; cost.rs:50-58 Key lacks a source so is_copy_only_step (:223-232) infers it from the table; cost.rs:151-161 rejects an MTP and a copy graph with identical B/D/W/P; rounds.rs:755-902 duplicates the ordinary candidate loop; selection.rs:184,277-298,382-396 bypasses the draft-depth / fixed-width / verification-budget filters for copy graphs. Rules: design-review.md principles 1 and 3; AGENTS.md:176-181,188-193. Note #8. Fix: one authority (source on the cost row or on the step), explicit MTP-verify vs copy-verify packed tables, no copy_wide bypass.
4. Documentation contradicts the code: docs/cli-design.md:200-202 ("does not change the graphs") vs selection.rs:277-298,375-396 (prunes graphs, drops kernels, rewrites speculative_widths; also docs/cli-design.md:741); docs/mtp-design.md:22-40 still describes a shared ring with eight/four-token indexes and "only qwen3.8-flash declares copy inputs", while the SAM is primary (sam.rs:1-37, scheduler.rs:1849-1852,1099-1159, ring only on a strictly longer match at :1143-1148) and the new caps (sam.rs:22-32) are unmentioned; docs/scheduling-runtime-design.md documents only the refresh change — no draft_source, no copy/MTP duration split (cost.rs:190-208), no new pruning rule (policy.rs:221-254), and its module index (:6-12) omits sam.rs. Rules: AGENTS.md:165-166, design-review.md:12. Note #7.
5. Unpinned shared-policy constants: speculation.rs:14-15 0.88, :21 4.0, :24 2.0; rounds.rs:766 base_mtp_drafts + 3; sam.rs:22 DEFAULT_MIN_MATCH_LEN = 6. Charter "be explicit and pin everything"; AGENTS.md:187. Only the 6 is argued (one 512-token repetitive prompt); 0.88/4.0/2.0/+3 have no derivation in the tree. Note #10 item 2.
NITS
refresh.rs:95-99emptyidle()plus its no-op call sites — delete.- ~150 lines of SAM API with no production caller (
propose_conditional_continuationssam.rs:1118-1189,propose_for_context:1070-1110,MatchSource/source,PromptSAM::build,push_slice,from_shared_prompt, test-only accessors). - Wide copy-verify (
W=16/W=24) never exported or replayed on GPU; cost-refresh never measured under live power-limit transitions (the PR says so itself). One load-and-serve of an exported W=8 core plus one with adraft_source=2graph would settle both the compatibility claim and the wiring defect above. - No test that a preempted-then-readmitted request still proposes continuations:
server/runtime.rs:2068-2110re-appends generated text to the prompt and admission rebuilds the SAM (scheduler.rs:1849-1852), butresume_decoded_sequence(scheduler.rs:1212-1235) only pushes intodecoded_history, notsam. Not proven a defect (the text is in the prompt again); untested either way.
POSITIVE (no action): the refresh commit is well scoped and correct. cost.rs:31-38 excludes measured readiness wait for timing credit and refresh debt while observed_duration_ns keeps physical time for acceptance learning (refresh.rs:71-93); idle retaining credit and debt preserves P <= 0.002/0.998 * O + D since idle adds neither; abort still discards positive credit; refresh_order (cost.rs:284-293) replacing the timestamp with a two-tier key fixes the real "probe the older/smaller shape first" defect, and select_plan's compare_refresh (policy.rs:1333-1338,1369-1372) now ranks by zero-duration expected value.
OPEN QUESTIONS for maintainers
- Q1: was the wide copy-verify path (new manifest field + new contract on speculative graphs) approved in advance, as
docs/design-review.mdrequires for new captured-graph operation families? Nothing in the description says so. - Q2: is
cost.rs:190-208has_mtpintended as "copy shapes only compete when no MTP packed shape exists"? No comment, no test asserts mixed-catalog cost semantics. - Q3: can commits 2–4's live numbers be reproduced without commit 1? Not determinable from the repository.
COULD NOT VERIFY: no CI on the head commit, so the reported test counts and the SAM microbenchmark were not independently executed; all live 4× RTX PRO 6000 numbers are unreproducible here — I verified only that they depend on several commits at once. The Python-side catalog generation was read only where draft_source plumbing crosses it.
RULES CITED (full text summarised in note #1): charter (right problem/right place, smallest shared-code footprint, keep the runtime small and model-agnostic, real evidence, pin everything, a benchmark does not waive an architectural rule); AGENTS.md:155-212 (scope and rejection criteria, focused validation, compatibility :431-444); docs/design-review.md principles 1, 3, 12, 13, 15.
#14 [high] Research summary
Verdict at head e5a69669: no blockers left; should-fix issues remain. The one blocking defect from my previous review is fixed, and most of the should-fix list is addressed.
Verified as resolved. heliopause/src/export/binding.rs:201-216 now derives the wire value (None|0|1|"MTP" → "MTP", 2|"COPY_DRAFT" → "COPY_DRAFT", unknown → error, COPY_DRAFT on non-speculative → error) instead of overwriting it, with a round-trip test at :1467-1511; the wide copy-verify feature is no longer dead on the export path. docs/cli-design.md:197-207 (not opened),744 and docs/mtp-design.md:19-71 (not opened) now describe the real behaviour (SAM-first, graph pruning, speculative_widths rewriting) instead of contradicting it. cost::Key carries draft_source (cost.rs:61-84), has_mtp is gone, packed_round_durations is per source (:138-139), and is_copy_only_step reads the step rather than re-inferring from the table (scheduler.rs:1196-1199). The unused SAM API is #[cfg(test)], RefreshState::idle is deleted, and select_shape_with_source was added so step selection can name a source.
Should fix, still open:
helios/src/scheduler/cost.rs:237-252— the combinedpacked_round_durationreintroduces exactly the non-local coupling the commit removed: the(None, Some(0)) if !self.packed_round_durations[Mtp].iter().any(|row| row.iter().any(Option::is_some))arm scans the MTP table in full to decide whether a copy width reports0orNone, so a measured copy-only shape's answer depends on unrelated MTP shapes elsewhere in the catalog. Keep the two_for(source, …)lookups and make callers state which source they accept (per-source also matches the docs' new description atdocs/scheduling-runtime-design.md:409-430(not opened)).- Scope — 33 files / +4306/−310 still bundles four independent outcomes (refresh recovery, SAM copy drafts, wide copy-verify graphs, padding dominance + min-match 3→6) against
AGENTS.md:198(not opened) "one coherent outcome"; the "+12.9% tok/s" andmax_b == Cnumbers remain combined-stack and cannot be attributed or bisected. Commit1b0db227is self-contained and could merge alone today. - Two authorities for one proposal source remain —
GraphDescriptor::draft_source(execution/manifest.rs:190-192) sits besideModelConfig::speculative_proposal_source(model.rs:113) andRequestScheduler::proposal_source(scheduler.rs:683);runtime_core/describe.rs:534,778still decode the integer independently of the newProposalSource::{from_wire,to_wire}, and the "absent means MTP" default is re-implemented four times (cost.rs:50-59canonical_draft_source,model/catalog.rs:296-299,model/packing.rs:41-53(not opened),runtime_core/selection.rs:290-293). - Encoder/decoder disagree about
draft_source = 0—heliopause/src/python.rs:225-233(not opened) maps0toNoneviafrom_wire, whilebinding.rs:204maps0to"MTP"; a speculative-mixed graph admitted withNonecomes back from export asSome(Mtp), andruntime_core/selection.rs:244requires[1,2]for speculative graphs, so the two paths validate differently even thoughhelios/manifest.md:38(not opened) documents0and omission as equivalent. - Calibrated constants —
speculation.rs:14-37,rounds.rs:22-30andsam.rs:22-30(not opened) now carry derivations, which answers the earlier finding, but0.88is justified analytically and the empirical basis formin_match_len = 6is still a single 512-token repetitive prompt.
Nits: binding.rs:216 writes draft_source even when the derived value is the default, and docs/scheduling-runtime-design.md (not opened) still does not mention the select_host_allocated_candidate/build_host_prefix_ranking refactor that now serves both the ordinary and copy loops. The funded-refresh commit remains architecturally clean and needs no change from this lens.
#15 [high] Report of 2026-11-27, run on head e5a69669 — verdict and findings (architecture & scope)
Head reviewed: e5a69669 (base main f377dc85), 33 files, +4306/−310. Lens: architecture and scope, judged against the charter, AGENTS.md, docs/design-review.md.
Verdict: no blockers at head; four should-fix items; nits.
Resolved since the previous head (14019718) — verified in code, not from the description
- B1 (previous blocker) fixed.
heliopause/src/export/binding.rs:201-216now derives the wire value instead of overwriting:None | 0 | 1 | "MTP" => "MTP",2 | "COPY_DRAFT" => "COPY_DRAFT", anything else =>super::invalid("unsupported graph draft_source"), plus aCOPY_DRAFTon non-speculativerejection. Round-trip testexecution_preserves_mtp_and_copy_draft_source_and_rejects_unknownatbinding.rs:1467-1511(Mtp/Mtp/CopyDrafton the wire). The wide copy-verify feature is no longer dead on the export path. - Docs corrected.
docs/cli-design.md:197-207now states that--history-drafts"retains captured copy-only speculative graphs … prunes copy-only graphs, drops kernels … removes copy-only widths fromspeculative_widths"; the option-table row at:744says the same.docs/mtp-design.md:19-71now describes SAM-first with the ring as fallback, with the 131,072 / 131,072 / 512 /min_match_len = 6caps and the preempt→readmit re-index.docs/scheduling-runtime-design.md:68-88,271-283,409-432gained thedraft_source/ wide-copy section, the strictly-tighter-batch pruning rule, and the per-source packed-duration split.docs/scheduling-theory.md:574-580,714-745distinguishes simulator vs Helios idle-credit behaviour.helios/manifest.md:38documentsdraft_source. - Cost keyed by source.
cost::Keycarriesdraft_source: Option<ProposalSource>(cost.rs:61-84),Estimate.draft_sourceand thehas_mtpexistence scan are gone,packed_round_durationsis[[Vec<Option<u64>>; 7]; 2](:138-139),prepared()accepts MTP and copy graphs at identical B/D/W/P (:159-193; testunmeasured_mtp_and_measured_copy_coexist_at_identical_shape_and_preserve_packed_durationat:532-586),is_copy_only_stepreadsstep.draft_source(scheduler.rs:1196-1199), andselect_shape_with_sourcewas added (model/catalog.rs:247-308) soserver/runtime.rs:2238can name a source. - Cleanups. SAM API is
#[cfg(test)]/private (sam.rs),RefreshState::idledeleted (refresh.rs),ProposalSource::{from_wire,to_wire}unified, host-allocated candidate loop factored (rounds.rs:764-862),@shieldstar'szero_duration[slot]reuse folded in (policy.rs:1052-1059,1100-1103,1258-1266,1289-1293) with both curve-evaluation tests,preempted_request_reindexes_generated_history_into_sam_on_readmissionadded (server/runtime/phase_tests.rs:4036-4093).
Should fix (open)
S1. Combined packed_round_duration reintroduces the non-local coupling the commit removed — helios/src/scheduler/cost.rs:237-252
The _for(source, …) lookups are clean, but the combined accessor 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 measured copy-only shape at (batch, width) returns None or Some(0) depending on whether some unrelated MTP shape anywhere in the catalog is measured — the same class of defect as the removed has_mtp scan, one level up. Callers: scheduler/rounds.rs:585-589 (speculative_duration), scheduler/policy.rs:785 (continuation_candidate), scheduler/service.rs:109,156. Fix: drop the combined accessor and make each caller say which source it prices (the docs now describe the two tables separately at docs/scheduling-runtime-design.md:423-432, so the code should match).
S2. Scope: four independent outcomes in one PR — AGENTS.md:198
33 files, +4306/−310, four commits for four unrelated outcomes: (1) funded-refresh recovery in the refresh ledger; (2) a ~1,307-line helios/src/scheduler/sam.rs plus admission wiring (scheduler.rs:1843-1850, model/packing.rs, server/runtime.rs); (3) wide copy-verify graphs across manifest/Python producer/selection/catalog/cost/rounds/serving; (4) padding dominance in shared policy.rs:119-276 plus DEFAULT_MIN_MATCH_LEN 3→6. Commit 4 changes behaviour for every speculation user while 2–3 only affect cores carrying copy inputs. The headline live numbers ("+12.9% tok/s", "3.078 → 3.650 emitted tokens/round", max_b == C) are combined-stack (stated against prior head 14019718), so no part can be attributed or bisected; @voipmonitor's live run was --no-history-drafts only, i.e. the wide copy-verify graphs never ran. Commit 1b0db227 is self-contained, has real CPU evidence, and could merge alone today; the rest should split into (b) padding dominance + min-match, (c) SAM + wide copy-verify, with per-commit live numbers.
S3. Two authorities for one proposal source, and the "absent means MTP" default re-implemented four times
GraphDescriptor::draft_source (helios/src/execution/manifest.rs:190-192) sits beside the pre-existing ModelConfig::speculative_proposal_source (helios/src/model.rs:113) and RequestScheduler::proposal_source (helios/src/scheduler.rs:683). Decoders of the same integer: heliopause/src/python.rs:225-233, heliopause/src/export/binding.rs:201-216, helios/src/runtime_core/serving.rs:58-62, helios/src/runtime_core/selection.rs:144-148, helios/src/runtime_core/describe.rs:534,778 (the last two decode independently of from_wire/to_wire). The default is re-derived in cost.rs:50-59 (canonical_draft_source), model/catalog.rs:296-299, model/packing.rs:41-53, runtime_core/selection.rs:290-293. Why it matters: canonical_draft_source also silently coerces a Copy source to Mtp on any non-Speculative kind, so a mixed graph's declared source is discarded rather than rejected. Fix: one accessor on GraphDescriptor (and one on ScheduledStep) that owns normalize/validate, and have describe use from_wire.
S4. Encoder and decoder disagree about draft_source = 0
heliopause/src/python.rs:225-233 maps wire 0 → None (via from_wire), while heliopause/src/export/binding.rs:204 maps 0 → "MTP". A speculative or speculative-mixed graph admitted with None therefore comes back from export as Some(Mtp); runtime_core/selection.rs:244 requires [1, 2] for speculative graphs, so the in-process and exported paths validate the same graph differently, even though helios/manifest.md:38 documents 0 and omission as equivalent. Test binding.rs:1487 asserts 0 → Mtp, which locks the divergence in. Fix: pick one direction (reject 0 on speculative graphs, or normalize to Mtp in python.rs) and make both paths agree.
Nits
heliopause/src/export/binding.rs:216writesdraft_sourceeven 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.docs/scheduling-runtime-design.mddocuments the copy/MTP tables but not thatselect_host_allocated_candidate/build_host_prefix_ranking(rounds.rs:505-540,764-862) now serve both the ordinary and copy loops — worth one sentence where the doc describes candidate construction.- Derivation quality:
0.88,4.0,2.0,+3now have stated derivations (speculation.rs:14-37,rounds.rs:22-30) — the earlier finding is answered — but0.88's argument is analytic andmin_match_len = 6is still supported by one 512-token repetitive code-edit prompt (sam.rs:22-30).
Positive (no action)
The funded-refresh commit 1b0db227 remains clean and correctly scoped from this lens: readiness wait excluded from timing-refresh credit but kept for acceptance learning, bounded earned credit retained across idle with abort still discarding it, two-tier refresh_order (cost.rs:324-333) plus zero-duration compare_refresh (policy.rs:1349-1354).
What could not be verified
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 examined wide copy-verify graphs (W=16/W=24), so S2's evidence gap stands. Export of a core carrying a draft_source = 2 graph was not exercised end-to-end; binding.rs:1487-1496 is a unit round-trip only.
#17 [high] Should fix: helios/README.md:437 still says idle discards positive credit
PR #540 head 982a9ce3 (10 files). helios/README.md is NOT in the changed-file list, and line 437 still reads:
"Refresh pays for one complete physical program, including its proposal and verification work. Another refresh waits for full credit. Idle discards positive credit and preserves debt."
That is exactly the behaviour the PR removes: RefreshState::idle is deleted (helios/src/scheduler/refresh.rs — only complete/abort remain, abort at :95-99 does the min(0.0)), and RequestScheduler::idle (helios/src/scheduler.rs:1158-1168) now only validates that no submission is in flight, so idle retains bounded positive credit (<= CREDIT_CAP_NS) and negative debt. The same file also does not mention the new readiness-wait exclusion in its timing-refresh paragraph (:432-439), although :423-424 already describes wait subtraction for graph estimates.
Why it matters: AGENTS.md:227 names helios/README.md as required reading for "Change Helios runtime, scheduling, caches, transport, or frontend"; the runtime's own description of the funded-refresh policy now states the opposite of the code, and AGENTS.md:165-166 lists inaccurate documentation as the only other admissible kind of contribution — inaccurate documentation of the changed behaviour is not acceptable. docs/scheduling-runtime-design.md:434-460 and docs/scheduling-theory.md:728-738 were updated; helios/README.md was missed.
Fix: rewrite helios/README.md:432-439 to state that ordinary valid execution earns 0.002/0.998 of measured compute duration excluding readiness wait (cap 5 ms), that idle retains bounded earned credit and debt while abort discards positive credit, and that a refresh episode pays its compute duration (excluding readiness wait) or its unexcluded physical/wall duration when the GPU sample does not exceed readiness wait.
#18 [high] Should fix: simulator default retain_idle_credit=False now diverges from Helios's unconditional policy
scripts/scheduling_sim/learning_policy.py:47 adds retain_idle_credit: bool = False, and LearningScheduler::idle (:671-677) only skips credit_ms = min(0.0, credit_ms) when the flag is set. Helios has no such flag: after this PR RequestScheduler::idle is unconditional retention (helios/src/scheduler.rs:1158-1168).
So after merge, the simulator's default retained-refresh policy models a rule the runtime does not implement, and every future screen/validate/regression run silently models the pre-PR policy unless the operator remembers --retain-idle-credit (it is only reachable as an explicit flag; build_configurations at scripts/scheduling_sim/learning.py:105-109 passes it through, and --configs JSON for --preset validate must carry it explicitly). The PR's own validation is called out this way in docs/scheduling-theory.md:730-733 ("Without --retain-idle-credit, idle discards positive credit … with --retain-idle-credit (as in Helios)").
Rule: docs/design-review.md "Testing hierarchy" layer 2 — "Do not diverge Helios from the simulator's qualified policy without updating and validating the rule across that catalog"; and AGENTS.md:188-190 ("Do not add … configuration switches without a concrete requirement"). The concrete requirement here is reproducing pre-PR baselines (the PR uses retain_idle_credit=False for the 35/35 main parity run), which argues for inverting the default: retained-refresh defaults to retention (matching Helios), with the old discard behaviour available opt-out/opt-in for reproducing main.
Fix (either): default retain_idle_credit=True for policy == "retained-refresh" (keeping a documented way to reproduce the discard behaviour), or make retained-refresh require the flag explicitly at PolicyConfig.__post_init__ as it already does for funded/estimator (learning_policy.py:85-88) so no run silently models the wrong policy.
#21 [high] Report of 2026-11-28, run on head 982a9ce3 — architecture & scope verdict
Architecture & scope review — PR #540, head 982a9ce3 (base main 353551e9)
10 files, +647/−47 (was 33 files, +4306/−310 at e5a69669). Judged against the charter (Autobot charter lines 12, 14, 35, 42), AGENTS.md (scope L155-213; task→doc map L227 naming helios/README.md; PR description L72-140; validation/perf L484+), docs/design-review.md (principles 1, 3, 8, 12, 13, 15; new "Testing hierarchy" section).
Verdict: no blockers. Two should-fix (both documentation/verification-hierarchy, not correctness), two nits.
Scope is now correct: the SAM/history copy-drafting, wide copy-verify (COPY_DRAFT, W=16/24), and batch-padding pruning changes are gone; one coherent outcome remains — retain bounded timing-refresh credit across idle and exclude embedding-readiness wait from refresh income/charges. No production flag, no manifest/ABI change, no new graph family (design-review principle 1 satisfied). This closes my earlier AGENTS.md:196-199 scope finding.
Should fix
S1. helios/README.md:437 (unchanged file) still states "Idle discards positive credit and preserves debt" — the exact rule the PR deletes (refresh.rs loses idle; scheduler.rs:1158-1168 now only asserts no submission is in flight). The same paragraph (:432-439) also omits the readiness-wait exclusion. AGENTS.md:227 lists helios/README.md as required reading for Helios scheduling changes. Fix: update :432-439 to the post-PR rule.
S2. Simulator default diverges from Helios: learning_policy.py:47 retain_idle_credit: bool = False, so the default retained-refresh run still models discard-positive-idle, which Helios no longer does. docs/design-review.md "Testing hierarchy" layer 2 says do not diverge Helios from the simulator's qualified policy. Fix: default True for retained-refresh (keep a documented opt-out to reproduce main) or make the flag mandatory at PolicyConfig.__post_init__ (learning_policy.py:85-88 precedent).
Nits
N1. cost.rs:37-45 "compute duration" is really max(gpu_ns, wall_ns) - wait_ns for isolated executions, whereas ActionCosts::observe (:330-337) drops wall_ns entirely; new doc prose (scheduling-runtime-design.md:437-441, scheduling-theory.md:734-737) and the docstring's "Mirrors ActionCosts::observe" overstate parity. Rename or narrow the docstring.
N2. cost.rs:53-57 unwrap_or(timing.wall_ns) is unreachable behind validate_completion (refresh.rs:63-68); idle() (scheduler.rs:1158-1168) is now assertion-only and called every 2 ms from server/runtime.rs:1184. Also: docs/scheduling-theory.md:730-733 should say the 64-seed --preset validate run encodes retain_idle_credit=True in --configs JSON, since learning.py:479-484 rejects the flag under validate.
Verified positive
refresh_order (cost.rs:303-305) restored to observed_at_ns.max(last_attempt_ns) (starvation fix, matches scheduling-runtime-design.md:446-449); abort (refresh.rs:95-99) discards positive credit and keeps debt; zero-charge refresh loops are impossible because validate_completion still requires an isolated measured interval and timing_refresh_duration_ns is strictly positive on every reachable completion (policy_tests.rs:6142-6175 covers wall 0 and >0); acceptance ledgers keep raw physical duration (refresh.rs:83-85).
Could not verify
No CI on head; the reported 804/1,705/590,327 counts, the 64-seed validation and the TLA+ run were not re-executed here. No GPU hardware run (readiness stalls, power-cap recovery) — but this head changes no GPU path, so the gap is smaller than at e5a69669.
#22 [high] Research summary
Reviewed PR #540 at head 982a9ce3 (10 files, +647/−47) through the architecture-and-scope lens, after the author narrowed it from the 33-file version I reviewed at e5a69669. All ten changed files read in context with their callers (policy.rs:1240-1281, scheduler.rs:2655-2658, server/runtime.rs:1176-1191, server/metrics/scheduler.rs:164-209, learning.py/learning_policy.py config plumbing).
Verdict: no blockers. Two should-fix, both documentation/verification-hierarchy rather than correctness, plus nits.
Scope is now right: the SAM copy-drafting, wide copy-verify graphs and batch-padding pruning are gone, leaving one coherent outcome (bounded idle credit retention + readiness-wait exclusion in the funded-refresh ledger), with no production flag, manifest/ABI change or graph-family change — closing my earlier AGENTS.md:196-199 scope finding.
The two should-fix items:
helios/README.md:437(not in the diff) still states "Idle discards positive credit and preserves debt" — the exact rule this PR deletes — and omits the new readiness-wait exclusion;AGENTS.md:227names that file as required reading for Helios scheduling changes.- The simulator's new
retain_idle_creditdefaults toFalse(learning_policy.py:47), so the defaultretained-refreshrun models the pre-PR rule Helios no longer has, againstdocs/design-review.md(not opened)'s "do not diverge Helios from the simulator's qualified policy"; the default should be inverted (or the flag made mandatory asfunded/estimatoralready are).
Nits: the "compute duration" naming overstates parity with ActionCosts::observe (max-with-wall vs GPU-only), an unreachable unwrap_or(wall_ns) fallback behind validate_completion, and the now assertion-only idle() plus a doc note that --preset validate must carry the flag via --configs. Verified positives: refresh_order restored to observed_at_ns.max(last_attempt_ns), abort semantics, and a strictly positive charge on every reachable refresh completion. Evidence: no CI on head; test counts, the 64-seed validation and the TLA+ run were not re-executed, and no GPU hardware run — though this head touches no GPU path. Findings are in scratchpad entries 17–21.
#23 [high] Exact citations for every changed hunk at head 982a9ce3
PR #540 head 982a9ce3, base main 353551e9. pr_files: 10 files, +647/−47.
Changed, with the lines that carry the behaviour:
helios/src/scheduler/cost.rs(+89): newobserved_compute_duration_nsat :31-45 (docstring :31-36;wait_nsfromtiming.readiness.map_or(0, |i| i.wait_ns()):38;gpu_nsmax-of-positive filter :39;gpu_ns <= wait_ns→ None :40-42;observed = queued ? gpu_ns : gpu_ns.max(wall_ns)then- wait_ns:43-44). Newtiming_refresh_duration_nsat :47-57 (fallbacksobserved_compute_duration_ns().or_else(observed_duration_ns).unwrap_or(timing.wall_ns):54-56). New testcompute_refresh_duration_excludes_readiness_wait_and_charges_positive_on_zero_computeat :443-501 (covers isolated 155 ms, queued 145 ms, missing GPU→wall 100 ms,wait>gpuwith wall 260 ms and wall 0→200 ms, andwait == gpu255 ms). Unchanged neighbours that matter:observed_duration_ns:21-29;ActionCosts::observe:330-353 (recordsgpu_ns - wait_ns, neverwall_ns, drops the 0-ns sample at :334-337);refresh_order:303-305 =observed_at_ns.max(last_attempt_ns);stale_keys:298-301.helios/src/scheduler/refresh.rs(+12/−10):complete:71-93 — Ordinary earns timing credit fromobserved_compute_duration_ns(:74-76) and acceptance credit fromobserved_duration_ns(:77-79); probe branch (:82-91) chargesobserved_duration_ns(..).unwrap_or(wall_ns)foris_acceptance()andtiming_refresh_duration_nsotherwise (:86-89).RefreshState::idledeleted;abort:95-99 now doescredit_ns.min(0.0)/acceptance_credit_ns.min(0.0)plusactive = false.validate_completion:63-68 unchanged (rejects queued probes and unmeasured/no-wall probes).CREDIT_CAP_NS:9, income rates :10-11.helios/src/scheduler.rs(+5/−1):RequestScheduler::idle:1158-1168 now only assertssubmissions.is_empty(); doc comment :1158-1162 is the only statement of the retention rule. Callerhelios/src/server/runtime.rs:1184(2 ms idle loop,idle_wait:1197-1211). Abort callerscheduler.rs:3062(release_after_shutdown). Completion pathscheduler.rs:2655-2658(validate_completionthenrefresh.complete).helios/src/scheduler/policy_tests.rs(+394/−7): renamed testordinary_income_excludes_queued_wall_wait_and_idle_retains_credit_while_abort_discards_positive:2471-2507; funding test :2548-2616 (loop 249→248,retainedretained across idle :2562);acceptance_probe_…:3545 usesabort()instead ofidle(); helpers/tests added :5811-6175 —large_prefill_engine,idle_separated_short_requests_accumulate_refresh_credit_and_recover_stale_shape:5881-5955,expensive_stale_shape_does_not_starve_smaller_stale_shapes_under_credit_refill:5958-6045,timing_refresh_excludes_readiness_wait_from_episode_debt:6048-6140,readiness_wait_exceeding_gpu_duration_does_not_cause_zero_charge_refresh_loop:6142-6175.docs/scheduling-runtime-design.md(+29/−17): funded-refresh section :434-474 (compute-duration income :437-441, ordering/full credit :444-455, idle retains :443-444, charged episode duration :456-464, boundP <= 0.002/0.998 * O + D:466-471, 2,495 ms cumulative :472-474); acceptance section :489-499 (Idle retains bounded earned credit … abort clears positive credit:492-493; readiness exclusion vs physical acceptance budgets :496-499).docs/scheduling-theory.md(+16/−7): :576-583 (simulator default discards,--retain-idle-creditmatches Helios) and :727-738 (2,495/995 ms, retained credit, readiness exclusion).scripts/scheduling_sim/learning_policy.py(+5/−1):retain_idle_credit: bool = False:47; bool validation :83-84;idle:671-677 (if not self.config.retain_idle_credit: self.credit_ms = min(0.0, …)).retained-refreshconstraints :85-88.scripts/scheduling_sim/learning.py(+7/−4): parameter pass-through :105-109; sweep rejection :132-133;--retain-idle-creditflag :439-440; validation forbidden-tuple :479-484;configuration_id:48-56 (yields…:retain_idle_credit=True).tests/test_scheduling_learning_policy.py(+43):test_retained_refresh_retain_idle_credit_recovers_across_short_bursts_without_starvation:1530-1571.tests/test_scheduling_learning_experiments.py(+47):test_retain_idle_credit_cli_option_is_boolean_and_excluded_from_validation_overrides:744-790.
Untouched files that the report cites: helios/README.md:432-439 (line 437 still says idle discards positive credit; :423-424 already describes wait subtraction for graph estimates); AGENTS.md:155-213 (scope/rejection, "Keep each PR focused on one coherent outcome" :196-199, "Do not add … configuration switches without a concrete requirement" :188-190), AGENTS.md:227 (task→doc map naming helios/README.md), AGENTS.md:431-444 (core compatibility); docs/design-review.md principles 1, 3, 12, 15 and the new "Testing hierarchy" section (layer 2: "Do not diverge Helios from the simulator's qualified policy without updating and validating the rule across that catalog"); docs/TODO.txt:110-114 (live Helios qualification of retained costs and funded remeasurement is still an open TODO — supports the "no live run at this head" limitation).
PR description claims not re-verified here: 804 pytest passes on 982a9ce3; helios 1,705 passed + 1 pre-existing upstream main failure in model::tests::packed_combined_budget_keeps_width_one_batches_without_a_useful_packed_shape; 16-seed screen + 64-seed/62-scenario validate accepting retain_idle_credit=True (35/35 vs ttl geomean 1.009886, exact 1.000000 parity vs main, 64/64 recovery, 0 idle spurious probes); all 9 TLA+ models / 590,327 Rust transitions; unrun: tests/server/test_scheduler.py, live power-cap and disk readiness stalls, pytest tests/cli, cargo kani, cargo-mutants. Author states the work is byte-identical on 3e2fcd27 (rebased onto 353551e9, which touches only docs).
#19 [medium] Nit: "compute duration" wording overstates the max-with-wall formula
helios/src/scheduler/cost.rs:37-45 computes observed = if queued { gpu_ns } else { gpu_ns.max(wall_ns) } then observed - wait_ns, while ActionCosts::observe (cost.rs:330-337) records gpu_ns.max() - wait_ns and never uses wall_ns. So for an isolated completion whose host wall time exceeds the device interval (common for TP/readiness or host scheduling jitter), timing-refresh income and refresh debt are computed on a wall-inclusive duration, while the cost estimate the refresh is supposed to fund uses the GPU interval alone (docs/scheduling-utility.md:301 says "the GPU interval alone, less measured embedding-readiness delay").
Why it matters (documentation, not new arithmetic): the diff labels this quantity "measured compute execution duration (excluding measured readiness wait)" in docs/scheduling-runtime-design.md:437-441 and echoes it in docs/scheduling-theory.md:734-737, and the docstring at cost.rs:33 says it "Mirrors ActionCosts::observe". Both overstate: the max-with-wall term is inherited from observed_duration_ns and pre-dates this PR, but calling it "compute duration" and claiming mirror parity is new prose. Either name it "device interval (or isolated wall time) less readiness wait" in the docs, or take gpu_ns - wait_ns for income and keep the wall-inclusive form only as the non-zero charge fallback the PR actually needs.
Checked: RefreshState::validate_completion (refresh.rs:63-68) rejects queued probe completions, so every charged refresh episode takes the isolated branch; ordinary income takes both branches.
#20 [medium] Nits and verified positives at head 982a9ce3
Verified in code, recorded as nits rather than defects.
-
helios/src/scheduler.rs:1158-1168—idle()is now a pure precondition check (submissions.is_empty()).helios/src/server/runtime.rs:1184calls it once per idle loop iteration (every 2 ms timeout,idle_wait:1197-1211); the call is harmless but the method is only meaningful as a doc anchor. Alternative: fold the assertion into the doc sentence and drop the API. Not blocking because the call is free and the check catches a real invariant violation. -
helios/src/scheduler/cost.rs:53-57—timing_refresh_duration_ns's third fallbackunwrap_or(timing.wall_ns)is effectively dead for reachable inputs:RefreshState::validate_completion(refresh.rs:63-68) rejects a probe completion whenobserved_duration_nsisNoneandwall_ns == 0, soobserved_duration_nsreturningNoneimplies eitherwall_ns > 0(second fallback fires, 0 for queued,wall_nsotherwise) or the completion already errored.timing_refresh_duration_nsonly need beobserved_compute_duration_ns(..).or_else(|| observed_duration_ns(..)).unwrap_or_default(); better, add a comment stating which callers can reach it, sincepolicy_tests.rs:6122-6140asserts debt on the reachable path only. -
scripts/scheduling_sim/learning.py:132-133— the newretain_idle_creditis appended to the pre-existing tuple of categorical parameters rejected from--sweep. The guard is only reachable for names in the followingparameters.keys() | {...}set? No —parametersis built from args at :105-109 and includesretain_idle_credit, so--sweep retain_idle_credit=0,1reaches the new message. Correct, and covered bytests/test_scheduling_learning_experiments.pytest_retain_idle_credit_cli_option_is_boolean_and_excluded_from_validation_overrides. No action. -
scripts/scheduling_sim/learning.py:479-484(main, validation branch) —--retain-idle-creditwith--preset validatenow exits with argparse code 2 via the widened forbidden-flag tuple; the doc atdocs/scheduling-theory.md:730-733tells readers to pass--retain-idle-creditwhile the validate preset is the mandated catalog (docs/design-review.mdtesting hierarchy layer 2). Add one sentence todocs/scheduling-theory.mdthat the 64-seed validation encodes it in the--configsJSON (configuration_idyields…:retain_idle_credit=True,learning.py:48-56), so operators do not try the flag against--preset validate. -
Score/evidence: this head is a strictly narrower PR than the one previously reviewed (
e5a69669), which resolves my earlier scope finding (AGENTS.md:196-199"Keep each PR focused on one coherent outcome"). One outcome remains — bounded idle credit retention + readiness-wait exclusion in the funded-refresh ledger. No new flags in production code (retain_idle_creditis simulator-only), no manifest/ABI change, no scheduling-design change beyond prose. Scope is now acceptable. -
Verified positives:
refresh_order(cost.rs:303-305) is back toobserved_at_ns.max(last_attempt_ns), matchingdocs/scheduling-runtime-design.md:446-449and removing the starvation hazard;abort(:95-99) preserves debt and drops positive credit exactly as documented atdocs/scheduling-runtime-design.md:492-493; the zero-charge loop is closed becausevalidate_completionstill requires an isolated measured interval andtiming_refresh_duration_nsis strictly positive on every reachable completion; acceptance ledgers keep raw physical duration (refresh.rs:83-85), soActionCosts::observeand the acceptance budget stay consistent withdocs/scheduling-runtime-design.md:494-499.