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