PR #621 — Correctness, Contracts & System-Level Consequences review
Reviewed at head cbb7a4f against base 2147cd4c: the admission path in helios/src/scheduler.rs, every production caller and the preemption/re-admission path in helios/src/server/runtime.rs, the request-time resolution in helios/src/server/request.rs, the contract validators and Kani harnesses, the Python narrowing code, the touched docs, and the new tests. No blocker found: the fix does what it claims. The findings are about a silent-failure seam between two declaration lists, diagnosability, under-described public API breakage, test coverage of the Python change, and claim accuracy.
Key findings
- Major — the two core-parameter declaration lists can diverge, and the divergence is swallowed by
begin_pool_lookupbefore it can become a loud rejection. Values are resolved againstconfig.contract(helios/src/server/request.rs:333-335) but admission validates them againstself.capabilities.core_parameters(helios/src/scheduler.rs:1565,1576); nothing pins the lists equal, andhelios/src/server/runtime.rs:2753-2755discards the error (let Ok(plan) = plan else { return; };). On divergence the core silently loses host/pool lookups and then rejects 100% of requests. - Minor — the parameterless-on-a-declaring-core rejection is not diagnosable. All seven admission predicates share one message (
helios/src/scheduler.rs:1582-1585) that never mentions core parameters or the correct entry point. - Minor — two breaking public API changes are under-described in the PR text. A new required field with no
Default/#[non_exhaustive](helios/src/scheduler.rs:110-111) and a renamed public validator (helios/src/runtime_core/mod.rs:48-50, fromvalidate_core_parameters). - Minor — the new Python test does not cover direct execution's use of the shared helper (
tests/direct/test_scheduler.py:998-1001tests onlyignition.preparation.contract), and the undeclared_cache_keysignature change rides along with it (ignition/direct/scheduler.py:878-882). - Minor — pre-existing Kani harnesses are cited as verification of this change; both named harnesses prove
CoreParameter::validate/resolve_valueonly (helios/src/model/contract/kani_proofs.rs:85-142), and the diff adds none. - Minor — the PR's own doc rewrite leaves
docs/prefix-cache-offload.mdinternally inconsistent::773-779now restrictsplan_admission/admitto declaration-free cores while:833still describes admission in terms ofplan_admissionunconditionally. - Minor — one "locked release test" count is not reproducible under the repo's CPU CI environment (CLI suite reportedly passes with
CUDA_VISIBLE_DEVICESunset;python-cpu.ymlsets it to""). No CI checks exist oncbb7a4f, so all suite counts are self-reported.
Verified sound (stated plainly, no issue invented)
- Rejection precedes all resource work. The validation
ifathelios/src/scheduler.rs:1566-1586runs beforeself.free_slot()?at:1587and beforeself.cache.lookup(&history)?at:1602. The parameterless path therefore reserves no slot, page, or snapshot, and touches no cache state. - Declaration-free cores keep byte-identical prefix roots.
PrefixHistory::with_core_parameterswith an empty iterator hashesflare-prefix-root-v1\0 || identity, the same asPrefixHistory::new(helios/src/cache/hash.rs:37-53), so legacy/declaration-free keys are unchanged. The description's claim holds by construction. - Preemption preserves parameter identity.
park()clears pool state but notincoming.prompt, andhelios/src/server/runtime/phase_tests.rs:6798asserts the parked request keeps its values, so declaring cores re-admit with the same salted history after preemption. No stale-identity bug. - The
GraphKindrelocation is behaviour-neutral.GraphKind::samples()and the newis_text_forward()cover the same seven kinds asmain's deleted free function (helios/src/execution/manifest.rs:89-104; callershelios/src/model/contract.rs:652,helios/src/model/packing.rs:140). Nothing is reversed and no captured-graph contract changes. - No hot-path cost added. Declarations were hashed into every plan before this PR too; the slice now comes from
&self.capabilities.core_parameters(helios/src/scheduler.rs:1565) instead of a caller argument. No new allocation per admission, no new lock, no new I/O, no change to any rate/latency/admission metric's sampling scope — this PR adds no metric and removes none, so the metric-span check is not applicable. - No protobuf/wire change. The only
runtime_core/protobuf.rsedits are the rename at:54,:85,:952,:966,:1012;heliopause/src/export/binding.rs:1046is the same rename. Exported cores and existing artifacts still load.
Findings
1. Major — divergent declaration lists fail silently in begin_pool_lookup
Resolution and validation consult different lists:
helios/src/server/request.rs:333-335
let core_parameters = config
.contract
.resolve_core_parameters(&opts.core_parameters)?;
helios/src/scheduler.rs:1565,1576-1580
let parameters = &self.capabilities.core_parameters;
...
|| crate::model::contract::validate_resolved_core_parameters(
parameters,
core_parameters,
)
.is_err()
Both lists currently originate from the same place — helios/src/model.rs:340: core_parameters: config.contract.core_parameters.clone(), — but nothing enforces it. scheduler_capabilities_with_manifest (helios/src/model.rs:344-377) builds on scheduler_capabilities without re-checking, and any hand-built SchedulerCapabilities (now possible because the field is public and required, see finding 3) can carry a different list.
The failure is then swallowed at the pool-lookup seam:
helios/src/server/runtime.rs:2746-2763
let plan = match incoming.pool_plan.as_ref() {
Some(plan) => scheduler.refresh_admission_plan(plan),
None => scheduler.plan_admission_with_core_parameters(
&incoming.spec(),
&incoming.prompt.core_parameters,
),
};
let Ok(plan) = plan else {
return;
};
let Ok(plan) = plan else { return; }; discards the error, so incoming.pool_lookup and incoming.pool_plan are never set (:2756-2763).
Impact: on divergence, a declaring core silently degrades — no host/Selene pool lookup, no inbound coalescing — and every request then fails admission with AdmissionError::Invalid carrying the generic message from finding 2. There is no counter, no log, and no distinguishable signal, so operators see "all requests rejected" with no root cause. This is exactly the class of silent failure the PR is meant to remove.
Fix: (a) assert the two lists agree where capabilities are constructed (scheduler_capabilities / scheduler_capabilities_with_manifest), or better, resolve values through the scheduler-owned list; (b) make begin_pool_lookup propagate the rejection — Err(error) => { incoming.reject_admission(error); return; } — instead of dropping it.
2. Minor — the core-parameter rejection is indistinguishable from an empty-prompt rejection
helios/src/scheduler.rs:1582-1585
return Err(crate::Error::admission(
crate::AdmissionError::Invalid,
"request requires a nonempty prompt, positive output limit, bounded total tokens, and resolved core parameters",
));
This single message covers all seven predicates OR'd together at :1566-1581: empty prompt, leading boundary at 0, out-of-range trailing boundary, non-monotonic boundaries, zero output limit, total-token bound, and the core-parameter length/value mismatch.
Impact: the exact trap this PR closes — a Rust SDK caller invoking admit(spec)/plan_admission(spec) on a declaring core — now fails with a message that lists four unrelated causes and never says the entry point is unusable for this core. admit's doc comment (helios/src/scheduler.rs:1544-1545) says "Rejects cores that declare core_parameters", but the runtime error does not. Users will debug prompts instead of arguments.
Fix: evaluate the core-parameter predicate separately and return e.g. "core declares N core parameters; pass the request's resolved values to plan_admission_with_core_parameters".
3. Minor — breaking public API surface under-described
New required field:
helios/src/scheduler.rs:110-111
/// Core-declared FP32 forward parameters validated and hashed into every admission plan.
pub core_parameters: Vec<crate::model::contract::CoreParameter>,
There is no impl Default for SchedulerCapabilities and no #[non_exhaustive], so every struct literal in and out of tree must be updated (the diff itself does this mechanically in helios/src/server/runtime.rs:3174,3428,3973 and the seven scheduler/*_tests.rs (not opened) files).
Renamed public symbol:
helios/src/runtime_core/mod.rs:48-50 — pub fn validate_core_parameter_declarations(value: &wire::ModelContract) -> crate::Result<()>, previously validate_core_parameters, with callers at helios/src/runtime_core/protobuf.rs:85,952,966,1012 and heliopause/src/export/binding.rs:1046.
Impact: the PR text says only "Rust callers constructing capabilities or passing declaration slices must update", which omits the rename entirely and understates the field change as optional-looking. Anyone with a saved integration breaks twice. Cheap to fix now (the crates are unpublished — charter roadmap item 6), expensive to discover later.
Fix: name both breaking changes explicitly in "What changed", and consider #[non_exhaustive] on SchedulerCapabilities to avoid a third break when the next field lands.
4. Minor — the new Python test does not exercise direct execution's use of the shared helper
tests/direct/test_scheduler.py:998-1001
def test_wire_fp32_binary32_boundaries_and_type_gate():
import math
from ignition.preparation.contract import wire_fp32
The test imports the helper from ignition.preparation.contract and asserts boundaries there only (:1003-1025). Direct execution consumes it as an import — ignition/direct/scheduler.py:44 from ignition.preparation.contract import wire_fp32, used at :122, :132, :225 — and nothing tests that path.
Impact: if a private copy is reintroduced in ignition/direct/scheduler.py, or the import is dropped in a rebase against #608 (which also edits that file), the new test stays green while direct execution silently diverges from preparation again — the exact failure mode this PR claims to close.
The same test block is also the only coverage anywhere for the undeclared change in ignition/direct/scheduler.py:878-882, where _cache_key(self, request, tokens=None) becomes _cache_key(self, request). main's only call sites pass a single argument (:620, :903), so the parameter was dead — but the removal is not in the description.
Fix: add a direct-scheduler assertion that a non-representable value is rejected through the same path preparation uses (e.g. via Layout.resolve_core_parameters / the direct admission error), and either drop the _cache_key change from this PR or state it in "What changed".
5. Minor — pre-existing Kani harnesses presented as verification of this change
helios/src/model/contract/kani_proofs.rs:86-105 proves CoreParameter::validate bounds and :108-142 proves resolve_value canonicalization (−0.0 → +0.0 at :132):
#[kani::proof]
fn core_parameter_validation_enforces_finite_ordered_bounds() {
assert_ne!(resolved.to_bits(), (-0.0f32).to_bits());
Neither harness mentions the scheduler, validate_resolved_core_parameters, or the length check this PR relies on, and the diff adds no harness (and no verification/ change).
Impact: "All 13 Kani harnesses passed, including core_parameter_validation_enforces_finite_ordered_bounds and core_parameter_resolution_produces_valid_canonical_value" reads as new proof of the new invariant. It is a re-run of #505's proofs. The actual new invariant — "admission rejects a declaring core when values are missing" — is covered by conventional tests (helios/src/model/tests.rs:138-142, helios/src/scheduler/tests.rs:2630-2646, helios/src/server/runtime/phase_tests.rs:6818-6835), which is fine; the description just needs to say so.
Fix: describe the Kani run as "re-ran the existing proofs; no new harness covers scheduler-owned declarations", and point at the negative tests instead.
6. Minor — the PR's own doc rewrite leaves the surrounding paragraph inconsistent
New text (docs/prefix-cache-offload.md:773-779):
- Admission in two steps. For a core with declared parameters, the caller
passes the request's resolved values to `plan_admission_with_core_parameters`.
For a core without declarations, it can call `plan_admission(&spec)`. Both
but :833 still reads, unchanged:
Admission consults the store after `plan_admission`: `lookup` runs above the
Impact: for declaring cores the worker never calls plan_admission; it calls plan_admission_with_core_parameters (helios/src/server/runtime.rs:2748, :2772, :2792). A reader following §2.7 to the worker description is told to look in the wrong place — and this PR is partly a documentation-accuracy change. Also, from the diff, :781 is one long line ("pages and snapshots as if its prefix depth were c, and the scheduler creates or joins") in an otherwise ~78-column paragraph.
Fix: reword :833 to "after the admission plan (either entry point)", and rewrap :781.
7. Minor — a "locked release test" count does not match how the repo's CI runs the suite
PR text: "The first CLI run set CUDA_VISIBLE_DEVICES to an empty string, which made the missing-core test reject the device list before reaching the file check. The complete CLI suite passed with that override unset and CUDA test opt-ins off."
The CPU workflow added the same day (#608) invokes the suite with that variable set to the empty string (.github/workflows/python-cpu.yml (not opened), env: CUDA_VISIBLE_DEVICES: "" + pytest tests/ -q). This file exists in the tree; I did not reopen its line numbers in this pass, so treat the exact line citation as from the discovery dossier.
Impact: with "no checks" reported on cbb7a4f, the CLI 226 figure is the one suite number that provably does not correspond to the environment CI uses. A reviewer will spend time reproducing a discrepancy the description already half-admits. It does not implicate the Rust change, which is what CI would actually gate.
Fix: state the exact invocation used for each suite, or re-run the CLI suite with CUDA_VISIBLE_DEVICES="" and report that result.
Contract / charter notes
- Layer placement is right. Declarations move into the scheduler, no per-model branch, no new flag, no new config default — consistent with the charter's "runtime small and model-agnostic" and "#417 no silent drop". The failure is now loud rather than silently unsalted, and the root cause (scheduler not owning the list) is fixed rather than guarded.
- Matrix evidence is the disclosed gap, not a hidden one. The change touches prefix identity — the thing Selene shares across instances — yet has no GPU, multi-host, or cache-scheme run. The PR discloses this and files the gate in
docs/TODO.txt:10-16, mirrored indocs/api.md:768-771anddocs/direct-execution.md:86-89. Under the charter's "Supported matrix & compatibility" line this remains unmeasured for declaration-free/legacy cores; compatibility there is argued fromhelios/src/cache/hash.rs:37-53, which is sound by construction but not evidence of a run. - Base is stale on the files it touches (
#608,#620landed after2147cd4c), and no CI has proven a clean merge.helios/src/execution/manifest.rsin particular is rewritten here. The seven-kind set is unchanged versusmain, so this is rebase risk, not behavioural risk.
Open questions / could not verify
- Should
begin_pool_lookupever have been allowed to drop a plan error? Thelet Ok(plan) = plan else { return; }pattern predates this PR (it is unchanged inmainathelios/src/server/runtime.rs:2761-2763), so finding 1 is amplified, not introduced, by #621 — but #621 is the PR that makes divergence possible for the first time. A maintainer should decide whether the fix belongs here or in a follow-up. - Is
SchedulerCapabilitiesintended as a public extension point? Nothing in tree answers whether out-of-tree callers are expected to build it by hand; if yes,#[non_exhaustive]should land with this PR. - What exactly was the "86 passed" direct/preparation run? No command, directory list, or artifact is given, and #505 reported 218 across three Python directories, so the numbers are not comparable.
- Does the head merge cleanly onto current
main? Not answerable without CI;#608editsignition/direct/scheduler.py(where this PR changes the import and_cache_key) and#620editshelios/model-contract.mdandhelios/src. - How will #599's hidden
overlay_slotparameter interact with scheduler-owned declarations? After this PR the scheduler declares and hashes the full list while resolution still runs againstconfig.contract— #599 will have to reconcile "the scheduler declares everything the prefix hash covers" with "some parameters are not client-supplied". Unresolved by design here.