#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.
#12 [high] Report of 2026-11-28 (head 982a9ce): one should-fix doc defect; code verified sound
Review of PR #540 at head 982a9ce (rewritten: SAM/history copy-drafting and wide copy-verify removed)
Lens: correctness (callers, edge paths, state transitions, persisted/compat surfaces).
Verdict: no blocking issues; one should-fix (documentation of present behaviour), one nit.
Should fix — helios/README.md:432-437 still documents the behaviour this PR removed
Lines 432-437 read: "Ordinary valid execution earns refresh credit at 0.002 / 0.998 times its measured duration, capped at 5 ms. ... Another refresh waits for full credit. Idle discards positive credit and preserves debt."
Both clauses are now false for the shipped runtime:
helios/src/scheduler/refresh.rs:71-93creditscost::observed_compute_duration_ns(readiness wait excluded) forPlanOrigin::Ordinary, and acceptance credit fromobserved_duration_ns.RefreshState::idlewas deleted (refresh.rsnow has onlyabort), andRequestScheduler::idleno longer touches credit (helios/src/scheduler.rs:1158-1170), so idle retains bounded positive credit.
docs/scheduling-runtime-design.md:436-444 and the rest of the changed docs were updated to the new rule, so the runtime README is the only surviving statement of the old behaviour. AGENTS.md:52-58 requires design/readme prose to state present behaviour ("State designed behavior that the code does not implement as a specification marked designed, not implemented"), and other docs it links to now contradict it (the README even links #funded-timing-refresh, which says idle retains credit). Fix: rewrite those two sentences to say credit is earned from compute duration excluding measured readiness wait, and that idle retains bounded earned credit (<= 5 ms) while debt is preserved (abort discards positive credit).
Nit — nothing guards refresh_order's "no observation" sentinel against a genuine 0
helios/src/scheduler/cost.rs:303-305 returns observed_at_ns.max(last_attempt_ns), which is 0 both for a never-observed shape and (theoretically) for one observed at now_ns == 0. policy.rs:1241-1247 sorts ascending, so such a key gets top priority. In practice ActionCosts::prepared starts observed_at_ns = 0 and advance_to only ever moves now_ns forward past the first completion, so a stale key can only carry 0 while it also has nanos != 0 — which stale_keys (cost.rs:298-301) already excludes when observed_at_ns == 0 and now_ns < ttl. Behaviour matches main; noting only because the PR's body argues about this ordering.
Verified non-defects (code reading)
idle()callers: the only production caller ishelios/src/server/runtime.rs:1184(no submissions outstanding, checked insideidleatscheduler.rs:1164). Tests that previously relied on idle clearing credit were updated (policy_tests.rs:2478-2507,:2551-2615,:3548).- No zero-charge refresh loop:
timing_refresh_duration_nscan return0only when there is no GPU sample andwall_ns == 0(cost.rs:53-57), andRefreshState::validate_completion(refresh.rs:63-69) rejects exactly that case for probes (observed_duration_ns(..).is_none() && wall_ns == 0), socompletenever applies a 0 charge to a probe.policy_tests.rs:6140-6181coverswait_ns > gpu_nswithwall_ns == 0and> 0, both landing on a positive charge. - Ledger split: ordinary completions credit timing refresh from compute duration but acceptance learning from raw physical duration (
refresh.rs:73-79), matchingdocs/scheduling-runtime-design.md:489-497.ActionCosts::observe(cost.rs:330-353) still usessaturating_sub(wait_ns)and discards 0 samples, so the guardgpu_ns <= wait_ns -> Noneinobserved_compute_duration_nsagrees with it. - Probe path unchanged where it matters:
refresh.commitstill setsactive,validate/readystill requireCREDIT_CAP_NS, andscheduler.rs:2430-2432still records the attempt on the refresh target. - Simulator:
retain_idle_creditdefaultsFalse, is validated as a real bool (learning_policy.py:83-84), only affectscredit_ms(notharm_credit_ms, whichdocs/scheduling-theory.md:682says idle clears), is rejected from--sweep(learning.py:132-133) and from--preset validateCLI overrides (learning.py:477-484), and is appended to the configuration id throughconfiguration_idonly when non-default. The added tests cover the CLI, sweep rejection,PolicyConfigtype check, and the validate-preset rejection exit code 2. - Docs consistency:
docs/scheduling-runtime-design.md:433-497,docs/scheduling-theory.md:574-582,727-738describe the new rule (Helios retains, simulator defaults to discarding unless--retain-idle-credit), and the starvation claim in the PR body matchescost.rs:303-305restored toobserved_at_ns.max(last_attempt_ns).
Coverage / limits
Read in context: helios/src/scheduler/{refresh,cost}.rs in full, scheduler.rs (idle, commit, complete_inner, release_after_shutdown), scheduler/policy.rs:1200-1300, scheduler/service.rs:351-390, execution/readiness.rs, server/runtime.rs:1176-1195, server/metrics/scheduler.rs:164-182, both Python simulator files, the two added test modules, and the two changed design docs. Not run: any Rust or Python suite, simulator sweep, TLA+ conformance, or GPU path. All statements above come from reading the code at 982a9ce.
#13 [high] Research summary
Reviewed PR #540 at head 982a9ce, which has been rewritten to just two things: retaining bounded timing-refresh/acceptance credit across idle (removing RefreshState::idle) and excluding measured readiness wait from refresh income and probe charges. All ten changed files were read in context through the correctness lens, following the callers of RequestScheduler::idle, RefreshState::complete/abort, ActionCosts::observe, refresh_order, and the new simulator flag.
Verdict: no blocking issues; one should-fix, one nit. The should-fix is documentation: helios/README.md:432-437 still states that ordinary income is 0.002/0.998 of measured duration and that idle discards positive credit, both of which this PR removes from the runtime — and it links to the design section that now says the opposite. The nit is that refresh_order's 0 sentinel coincides with "observed at t=0", harmless given stale_keys and monotonic now_ns.
Verified as sound: the idle() call path (single production caller, guarded by an empty submission map), the positive-charge guarantee for refresh probes (validate_completion rejects the only case where timing_refresh_duration_ns could be 0), the split between compute-duration timing credit and physical-duration acceptance credit, agreement between the new observed_compute_duration_ns guard and ActionCosts::observe, and the simulator flag's default, validation, sweep/preset exclusions and configuration-id handling. Findings are code-reading only; no Rust/Python suites, simulator runs, TLA+ checks or GPU paths were run.
#14 [high] Superseded: entries #1-#11 describe an earlier PR shape and must not be reused
PR #540 was rewritten by its author at head 982a9ce3 (PR comment 2026-11-28 04:36 UTC, "@lukealonso Reworked #540 to 982a9ce3 ... narrowed strictly to idle credit retention and readiness-wait exclusion on timing refresh"). Everything to do with prompt+output SAM copy-drafts, wide copy-verify (COPY_DRAFT, W=16/24), draft_source plumbing, batch-padding pruning, CopyCalibration, and the speculative-capability-table draft_source issue was removed from the diff.
Consequently the older notes on this scratchpad are historical only and must not appear in the final report:
- #1 (export binding overwrites
draft_source), #2, #3 (SAM preempt/re-admit), #4 (refresh tiering/copy masking), #5, #6, #7, #8, #9, #10, #11 — all reference code paths not in this PR any more. The earlier "should fix: capability tables omit draft_source" and "nit:packed_round_durationNone vs Some(0)" findings are obsolete:helios/src/scheduler/cost.rsat this head has nopacked_round_durationssplit by source and nocanonical_draft_source.
Current diff at 982a9ce is 10 files, +647/-47: docs/scheduling-runtime-design.md, docs/scheduling-theory.md, helios/src/scheduler.rs, helios/src/scheduler/cost.rs, helios/src/scheduler/policy_tests.rs, helios/src/scheduler/refresh.rs, scripts/scheduling_sim/learning.py, scripts/scheduling_sim/learning_policy.py, tests/test_scheduling_learning_experiments.py, tests/test_scheduling_learning_policy.py.
The one current, verified finding and the full evidence are in entry #12. Use only that entry plus this one for the report.
#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.