#1 [high] Candidate: exported cores overwrite draft_source with MTP
heliopause/src/export/binding.rs:196-202 (pre-existing, not in the PR diff):
if kind == "speculative" || kind == "mixed" && speculative {
if !graph.contains_key("draft_tokens") { return Err(...) }
graph.insert("verify_tokens".into(), width.into());
graph.insert("draft_source".into(), "MTP".into());
}
This is the only JSON->wire conversion used by export (called from heliopause/src/export/capture.rs:3158 super::binding::execution(execution, &allocations)).
The PR now has ignition/preparation/execution.py:316-319 emit draft_source=signature.draft_source (1 or 2) into the manifest JSON (GraphSignature.draft_source added at execution.py:32, validated 98-108), and heliopause/src/python.rs:225-233 reads it for the in-process GraphExecutor path. But the core-export path unconditionally rewrites it to "MTP", so exported cores can never carry DraftSource::CopyDraft.
Consequence: on load, helios/src/runtime_core/selection.rs:277-298 copy_wide requires graph.draft_source == 2; the wide copy graphs become draft_source=1 with draft_tokens (e.g. 15/23) > drafts (7), so they are pruned by graph.draft_tokens.is_some_and(|depth| depth <= drafts as u32). Also helios/src/model/catalog.rs:93-96 copy_only_graph is false, so the copy-only input-buffer contract is not checked. Net effect: the whole wide copy-verify feature silently disappears for cores produced through export_capture (the flare run path), and any core that did declare copy graphs is mislabeled as MTP. Needs verification with a test that round-trips an export manifest containing draft_source=2 through binding::execution.
#2 [high] Research summary
I reviewed PR #540 through the correctness lens: charter and design rules first, then the changed files in context (helios/src/scheduler.rs, scheduler/{cost,refresh,policy,rounds,speculation,sam,decoded_history}.rs, execution/manifest.rs, model/{catalog,packing}.rs, runtime_core/{selection,serving}.rs, server/runtime.rs, heliopause/src/python.rs, ignition/preparation/execution.py, docs/scheduling-runtime-design.md), following callers of the changed APIs (refresh_order/idle/abort, record_attempt, request_history_proposal and its two call sites in packing.rs and server/runtime.rs, is_copy_only_step in runtime metrics, CopyCalibration.observe_prefix feeding wide_copy_curve/expected_copy_tokens, draft_source through wire→GraphDescriptor→cost/rounds/catalog/selection).
One confirmed finding is recorded on the scratchpad (entry 1, high): the export path silently drops the new draft_source, so exported cores can never carry COPY_DRAFT graphs. ignition/preparation/execution.py:316-319 now emits draft_source (1 or 2) per speculative graph and heliopause/src/python.rs:225-233 honors it for the in-process GraphExecutor, but the core-export conversion heliopause/src/export/binding.rs:196-202 (called from heliopause/src/export/capture.rs:3158) unconditionally does graph.insert("draft_source", "MTP"), rewriting any copy graph to MTP. On load, helios/src/runtime_core/selection.rs:277-298 only retains wide copy shapes when graph.draft_source == 2, so copy graphs come back as draft_source=1 with draft depth > drafts and are pruned; helios/src/model/catalog.rs:93-96's copy-only contract check (no GPU confidence, no speculative_prefix_limits) is also bypassed. Result: the advertised wide copy-verify feature disappears on the flare run/export path, and any core that did declare copy graphs is mislabeled MTP (potentially skipping the copy-only packing requirements). A round-trip test of an export manifest containing draft_source=2 through binding::execution would settle it; I could not run Rust tests here to confirm empirically.
Items I was still verifying when the time limit hit, and which I deliberately did not record as findings: (a) the sam/PromptOutputSAM lifetime across preemption re-admission (scheduler.rs:1846-1860 builds it from spec.prompt at admission while record_decoded_token/complete_inner push tokens separately — whether the readmitted spec.prompt already contains the generated tokens determines whether the output automaton is double-fed after a preempt/re-admit cycle); (b) whether ActionCosts::refresh_order's new (bool, u64) tiering can starve a never-attempted stale key when stale_keys() excludes the ordinary winner (policy.rs:1296-1329), and whether refresh_packed_durations' has_mtp guard silently hides measured copy-shape durations used by speculative_duration when speculative_fixed_width is set; (c) CopyCalibration::observe_prefix indexing survival[depth] for depth < copy_prefix where copy_prefix is the trailing-ones of copy_offered_mask while survival rows follow offered_drafts length (scheduler.rs:2877-2890) — a possible out-of-range/index-mismatch if the copy mask exceeds the offered prefix.
#6 [high] Research summary
Verdict: blocking issues. Full report is scratchpad entry #5; this session re-verified the blocker against the tree and closed one of the two open questions.
Blocking — wide copy-verify graphs are relabelled as MTP on the only core-export path. heliopause/src/export/binding.rs:196-202 unconditionally does graph.insert("draft_source".into(), "MTP".into()) while converting the preparation manifest to the wire Execution (the sole export route, called at heliopause/src/export/capture.rs:3158). The PR now emits draft_source = 1|2 from ignition/preparation/execution.py:32,102-108,316-319 and honours it in the in-process reader (heliopause/src/python.rs:225-233), but the export writer overwrites it, so a manifested copy graph arrives at load as DraftSource::MTP (wire enum helios/proto/runtime_core.proto:842,854, decoded at helios/src/runtime_core/serving.rs:58-63 (not opened)). At load helios/src/runtime_core/selection.rs:277-298 only keeps such graphs via copy_wide, which requires draft_source == 2; the MTP branch then rejects them because draft_tokens > drafts. Wide copy-verify silently never runs on any exported core, and because draft_source is also the trigger for the copy-only contract checks (helios/src/execution/manifest.rs:845-846, helios/src/model/catalog.rs:93-131) a mislabelled graph skips validation instead of failing. Fix: pass the incoming value through / derive the enum name (2 => "COPY_DRAFT", unknown => error) and add one binding::execution round-trip test asserting DraftSource::CopyDraft as i32.
Should fix — same line coerces instead of validating, unlike heliopause/src/python.rs:230; Nit — the two JSON→wire encodings of one field disagree (enum-name string vs integer) and no test covers the export round trip.
Open question from the earlier report now answered from code: Worker::park (helios/src/server/runtime.rs:2068-2088) extends incoming.prompt.tokens with the tokens generated so far and marks the request readmitted, and server/runtime.rs:1550-1553 only restores the decoded sequence. So on re-admission PromptOutputSAM::new(&spec.prompt) (helios/src/scheduler.rs:1849-1852) is rebuilt over prompt+generated text with an empty output vector — no double-feed and no duplicated proposals, only the loss of the per-request output history beyond the 131,072-token prompt cap. That is a behaviour note, not a defect; a preempt→readmit SAM test is still the right guard. The remaining candidates (refresh tiering, has_mtp masking, copy/MTP duration mixing) were re-checked and stay dropped: the round-robin scan covers all tier-0 targets and copy shapes are unreachable when a fixed width is set.
#7 [high] Resolved open question: SAM across preempt/re-admit has no double-feed
Settled from code this session; supersedes the open question in notes #3 and #5.
Path: Worker::park (helios/src/server/runtime.rs:2068-2088) copies live.tokens().to_vec(), extends it with the appended/held token, does incoming.prompt.tokens = tokens; incoming.prompt.max_new_tokens = remaining; incoming.readmitted = true; and saves live.decoded_sequence into Carried. On re-admission the only restore is self.scheduler.resume_decoded_sequence(handle, parked.carried.decoded_sequence) (helios/src/server/runtime.rs:1550-1553), which sets request.decoded_sequence and nothing else (helios/src/scheduler.rs:1211-1223).
PromptOutputSAM is built per admission from the (already extended) spec.prompt (helios/src/scheduler.rs:1849-1852), so after a preempt/re-admit the previously generated tokens live inside PromptSAM and output starts empty. push_token is only fed from record_decoded_token (scheduler.rs:1227-1238) and the post-completion loop (scheduler.rs:3010-3021), both of which run for the new admission only. Therefore: no token is indexed twice, and propose() cannot emit a self-duplicating continuation.
Consequence worth one line in the report, not a defect: features that depended on the dynamic output side (recency tie-break MatchSource::Output, default_min_match_len freshness, boundary_overlap straddling) degrade to prompt-only behaviour for the remainder of a re-admitted request, and any earlier output beyond max_prompt_tokens = 131_072 (sam.rs:22) is dropped. A preempt→readmit test comparing propose() against the in-module brute-force oracle (sam.rs tests module) would still be the right guard, since nothing in the suite exercises this path.
#9 [high] Research summary
Verdict: no blocking issues remain; two non-blocking correctness findings.
I re-verified the head commit e5a69669 against the tree.
Previous blocker is genuinely fixed. heliopause/src/export/binding.rs:201-216 now derives the wire enum from the manifest draft_source (None | 0 | 1 | "MTP" → MTP, 2 | "COPY_DRAFT" → COPY_DRAFT, anything else → invalid("unsupported graph draft_source")), and rejects COPY_DRAFT on any graph whose kind != "speculative" — matching the new producer check in ignition/preparation/execution.py:104-108 (which now rejects mixed too) and the load-time reader helios/src/runtime_core/selection.rs:244-247 (![1,2].contains(&graph.draft_source)). The added round-trip test (binding.rs:1467-1510) covers 0, 1, 2, unknown ints, unknown strings and mixed+copy, so an exported core can now actually carry COPY_DRAFT and survive the copy_wide retention at selection.rs:277-298. The second, harder assertion — that a copy graph at identical B/D/W/P as an MTP graph coexists — is now also satisfiable because cost::Key carries draft_source (helios/src/scheduler/cost.rs:61-84,159-173) and ScheduledStep/Candidate carry it (scheduler.rs:406-407, policy.rs:77-107), with packed_round_durations split per source (cost.rs:139,204-252). The has_mtp existence-scan defect and the is_copy_only_step-infers-from-the-table wart are gone.
Should fix — the capability tables still key speculative graphs without draft_source, so identical-shape MTP/copy graphs are conflated. helios/src/model.rs:358-360 and :369-370 push (kind, batch, draft_tokens, token_capacity, packed_token_capacity, prefill_capacity) and (batch, drafts, width, packed, allocation) — no source — while the same PR explicitly permits an MTP and a copy graph at identical B/D/W/P (cost.rs:172-174 only rejects duplicates including draft_source, and the new test asserts coexistence). SchedulerCapabilities::speculative_allocations is then consulted through gpu_prefix_allocation(batch, drafts, width, packed) (rounds.rs:443-446), and copy-only graphs are required to have no speculative_prefix_limits (model/catalog.rs:123-131, execution/manifest.rs:845-846), i.e. PrefixAllocation::Host. So once one MTP graph at that exact geometry uses GPU prefix limits, an identically shaped copy graph is reported as GPU-allocated: prefix_lengths_with_values (rounds.rs:479-481) returns the raw ceilings instead of host-priced lengths, and Scheduler::commit (scheduler.rs:2496-2500) fills expected_tokens from estimated_round_lengths — which is priced by speculative_curve (rounds.rs:415-436, MTP acceptance), not the copy curve — for a copy-only step. The fix is to add draft_source to both capability tuples (model.rs:358-370) and to the gpu_prefix_allocation lookup key.
Nit — ActionCosts::packed_round_duration returns None where the docs promise Some(0). cost.rs:244-249: when the copy table has an unmeasured covering shape (Some(0)), no MTP covering shape, and the MTP table is non-empty at any other batch, the match falls through to None. docs/scheduling-runtime-design.md states the combined lookup "return zero only when covering shapes exist without a positive measurement". Returning None rather than Some(0) only drops normalization evidence (service.rs:158 filters > 0), so it is harmless in practice, but the predicate should be "MTP covering shapes exist" rather than "any MTP entry exists".
Coverage. I read the changed paths in context — scheduler/{cost,refresh,policy,rounds,speculation,packing,service}.rs, scheduler.rs (admission/SAM/is_copy_only_step/commit), execution/manifest.rs:820-870, model/{catalog,packing}.rs, runtime_core/{selection,serving}.rs call sites, server/runtime.rs, heliopause/src/{export/binding,python}.rs, ignition/preparation/execution.py, plus the touched docs and tests. The preempt→re-admit SAM path remains sound (PromptOutputSAM is rebuilt from the already-extended prompt at scheduler.rs:1843-1846; only the ring handle is carried), and RefreshState::idle removal (refresh.rs:95-99) leaves abort as the only credit-discarding transition, matching docs/scheduling-theory.md. I did not run the Rust/Python suites or any GPU path, so the two findings above are from code reading; the capability-key one would be settled by a test that loads an MTP + copy graph at identical B/D/W/P with PrefixAllocation::Gpu on the MTP graph and asserts the copy step is not reported GPU-allocated.
#10 [high] Report of 2026-11-26, run 1330 — blocker fixed at e5a69669; two non-blocking findings
Review of PR #540 — helios: cost-refresh recovery, prompt+output SAM copy-drafts, and calibrated wide copy-verify
Head e5a69669. Lens: Correctness.
Verdict: no blocking issues; one should-fix and one nit.
Prior blocker verified fixed
heliopause/src/export/binding.rs:201-216 now derives the wire enum from the manifest field: None | 0 | 1 | "MTP" → MTP, 2 | "COPY_DRAFT" → COPY_DRAFT, else Err(invalid("unsupported graph draft_source")), and rejects COPY_DRAFT when kind != "speculative" (:213-215). Matches producer ignition/preparation/execution.py:102-108 (now rejects mixed too) and the load-time reader helios/src/runtime_core/selection.rs:244-247 (![1,2].contains(&graph.draft_source)). Round-trip test execution_preserves_mtp_and_copy_draft_source_and_rejects_unknown (binding.rs:1467-1510) covers 0/1/2, unknown ints, unknown strings, mixed+copy. So an exported core can carry COPY_DRAFT and survive copy_wide retention at selection.rs:277-298.
Also fixed since the last review: cost::Key carries draft_source (helios/src/scheduler/cost.rs:61-84, prepared at :159-173), ScheduledStep.draft_source (scheduler.rs:406-407), Candidate.draft_source (policy.rs:77-107), packed_round_durations split per source (cost.rs:139,204-252); has_mtp existence scan removed; is_copy_only_step now derives from the step (scheduler.rs:1196-1199); Selection dedupe key includes draft_source (selection.rs:299-312).
Should fix — capability tables omit draft_source, conflating identical-shape MTP and copy graphs
helios/src/model.rs:358-360pushes(graph.kind, batch_capacity, draft_tokens, token_capacity, packed_token_capacity, prefill_capacity)intocapabilities.completion_inputs;:369-370pushes(batch_capacity, draft_tokens, token_capacity, packed_token_capacity, allocation)intocapabilities.speculative_allocations. Neither carriesdraft_source.- Yet this PR deliberately allows an MTP and a copy graph at identical B/D/W/P:
cost.rs:172-174only rejects duplicate keys includingdraft_source, and the new testunmeasured_mtp_and_measured_copy_coexist_at_identical_shape_and_preserve_packed_duration(cost.rs:531-586) asserts coexistence atB1/D7/W8/P8. rounds.rs:443-446gpu_prefix_allocation(batch, drafts, width, packed)scansspeculative_allocationswithout a source, so an MTP GPU-allocated graph at(1,7,8,8)makes a copy graph at the same geometry appear GPU-allocated (copy-only graphs are required to have nospeculative_prefix_limits, henceHost, permodel/catalog.rs:123-131andexecution/manifest.rs:845-846).- Consequence:
prefix_lengths_with_values(rounds.rs:479-481) returns raw ceilings instead of host-priced lengths for the copy step, andRequestScheduler::commit(scheduler.rs:2496-2500) fillsexpected_tokensfromestimated_round_lengths— priced withspeculative_curve(MTP acceptance,rounds.rs:415-436) rather thanwide_copy_curve. Copy-survival estimates for those steps are therefore computed from the MTP profile. - Fix: add
draft_sourceto both tuples inmodel.rs:358-370and to thegpu_prefix_allocationkey. Settling test: load an MTP + copy graph at identical B/D/W/P with GPU allocation on the MTP one; assert the copy step is not reported GPU-allocated.
Nit — packed_round_duration returns None where docs promise Some(0)
helios/src/scheduler/cost.rs:237-252: if copy has an unmeasured covering shape (Some(0)), MTP has no covering shape, and the MTP table is non-empty at any other batch, the match falls through to None (arm at :244-249 requires the whole MTP table to be empty). docs/scheduling-runtime-design.md says the combined lookup "return zero only when covering shapes exist without a positive measurement". Effect is limited to missing normalization evidence (service.rs:158 filters > 0). The guard should test "MTP covering shapes exist", not "any MTP entry exists".
Confirmed non-defects (checked in context)
- Preempt/re-admit SAM:
PromptOutputSAMrebuilt from the already-extended prompt atscheduler.rs:1843-1846; only the ring handle is carried (server/runtime.rs:1550-1553,scheduler.rs:1201-1213);push_tokenfed only fromrecord_decoded_token(scheduler.rs:1217-1228) and the post-completion loop. No double index. New testpreempted_request_reindexes_generated_history_into_sam_on_readmissioncovers it. RefreshState::idleremoval (refresh.rsnow hasabortonly): matchesdocs/scheduling-theory.md's "Helios retains bounded earned credit ... discarding positive credit only on abort".refresh_ordertwo-tier ordering still picks the highest zero-duration expected value within tier 0 (policy.rs:1359-1393), matching the PR body.packing.rsBoundGraph::matches_step(:40-53) adds the source tie-break consistently for bothsemantics(:302) andpack_step(:389).heliopause/src/python.rs:225-233andruntime_core/serving.rs:55-58shareProposalSource::from_wire(speculation.rs:55-62).
Coverage / not run
Read in context: scheduler.rs, scheduler/{cost,refresh,policy,rounds,speculation,packing,service}.rs, execution/manifest.rs:820-870, model/{catalog,packing}.rs, model.rs:340-374, runtime_core/{selection,serving}.rs, server/runtime.rs (plan/metrics/park paths), heliopause/src/{export/binding,python}.rs, ignition/preparation/execution.py, docs. Not run: Rust/Python suites, SAM microbenchmark, any GPU path — findings are code-reading only. Charter line ~42 ("verify that existing data, artifacts, and exported cores still load") is the standard applied to the export path.
#3 [medium] Unverified candidate: SAM state on preemption/re-admission double-feed
Not verified — needs a test to settle.
helios/src/scheduler.rs admission builds the per-request automaton from the admission prompt only:
let sam = self.decoded_history.is_some().then(|| sam::PromptOutputSAM::new(&spec.prompt));
(around scheduler.rs:1846-1860, new in this PR).
Tokens are fed to it in three separate places, each guarded only by if let Some(sam) = &mut request.sam:
- record_decoded_token (scheduler.rs:1227-1238)
- complete_inner after generated tokens (scheduler.rs:3010-3021)
- scheduler.rs push/append path at ~1230-1236 (decoded sequence append)
Questions to settle:
resume_decoded_sequence(scheduler.rs:1211-1223) restoresdecoded_sequencebut does not rebuildsam; if a request is resumed from a parked/readmitted state (server runtimeparked/readmittedpath, server/runtime.rs ~2080-2110), doesspec.promptalready include the tokens that were previously generated? If yes,PromptSAMwill contain output text (harmless) but theoutputvector starts empty whileprompt_cursoris positioned at the true sequence end — probably fine; if no, the SAM misses the previously generated prefix (loss of proposals only, not incorrectness).- Whether the preempted →
idle/readmit path re-createsLiveRequestwith the original prompt whilepush_tokenwas already applied, causing each previously generated token to be indexed twice (once inside the prompt text, once inoutput), which would makebuild_proposalemit a continuation that duplicates text.PromptSAMis immutable andArc-shared, so the double-index would only affect proposals, not correctness of committed tokens.
Settling test: admit a request, generate > min_match_len tokens, preempt, readmit, and compare propose() against the brute-force oracle already present in helios/src/scheduler/sam.rs (tests module, brute_force_oracle).
#4 [medium] Unverified candidate: refresh tiering starvation and copy-shape duration masking
Not verified — needs reading/experiment.
(1) Tier-0 keys never attempted while stale. ActionCosts::refresh_order returns (false, 0) for every entry whose last_attempt_ns < observed_at_ns + ttl, so all unattempted stale keys share the same sort key (0). Selection in helios/src/scheduler/policy.rs:1296-1329 then sort_by_key(|(order, _)| *order) and breaks out of the loop once best_order < order. Because tier-0 keys tie at (false, 0), the loop scans every tier-0 target before any tier-1 target — that is intended — but the ordering within tier 0 is now the Vec order from stale_keys() (insertion order of the prepared graph catalog) rather than "highest expected useful value first" as the PR description and docs/scheduling-runtime-design.md claim ("Within the active tier, candidates rank by indeterminate-duration expected useful value"). The compare_refresh tie-break only picks the best candidate for a given target; it does not order the targets. Worth confirming with the docs claim in the PR body ("the first funded refresh probes the highest-expected-value unattempted stale shape") and with policy_tests.rs:2536-2545 / 5888.
(2) refresh_packed_durations skips copy shapes whenever any MTP packed shape exists:
helios/src/scheduler/cost.rs:190-208 — has_mtp is computed over all entries and copy-source entries are continued, so copy sources contribute neither a row duration nor are they measurable through packed_round_duration. packed_round_shapes() (cost.rs:215-221) still yields them and rounds.rs:752-... handles them specially, so this looks deliberate; but speculative_duration (rounds.rs:559-568) folds packed_round_shapes() with min_measured_duration when speculative_fixed_width.is_some(), and now mixes MTP and copy shapes of the same (batch,width) — a copy shape's duration could select the duration used for an MTP round. Note the fixed-width path is guarded to not use wide copy shapes (rounds.rs:759-764 skips copy shapes when speculative_fixed_width.is_some()), so this is likely unreachable in practice; verify before reporting.