Correctness, Contracts & System-Level review — PR #621 (head 55bab978)
Key findings
- F1 (Minor, the one issue I would require a reply on): the PR makes the core parameter declarations have two independent owners —
SchedulerCapabilities.core_parametersfor admission/prefix identity andconfig.contract.core_parametersfor resolution/validation of the values actually packed — and nothing checks that they agree. Pre-PR the declarations travelled with the call site, so drift was impossible; this is introduced by the change. It fails closed (no cache mix-up is reachable), but on a declaring core an empty/stale capabilities list turns into a per-requestAdmissionError::Invalid— a total outage with a prompt-shaped error message — instead of a startup error.helios/src/scheduler.rs:109-110, :696, :1462, :1473-1483;helios/src/model.rs:336;helios/src/server/request.rs:333-335. - F2 (Minor): the description under-reports the public API break. Besides scheduler capabilities and declaration slices, a
pubre-export was renamed with no alias:helios_core::runtime_core::validate_core_parameters→validate_core_parameter_declarations(helios/src/runtime_core/mod.rs:48-50), whose only in-tree consumer isheliopause/src/export/binding.rs:1051. - F3 (Minor): the description's compatibility guarantee — "declaration-free cores keep their existing prefix keys", the property that keeps persisted Selene/host records and in-flight checkpoints matching across the upgrade — is true by construction but pinned by no test; every parameterless call now flows through the new salted path (
scheduler.rs:1450-1452→:1485-1491). - F4 (Minor): the new parameterless rejection folds four unrelated preconditions into one
AdmissionError::Invalidwith one message, so a caller that used the now-rejectedadmit()on a declaring core cannot tell that the real problem is "this core declares parameters, pass values" (scheduler.rs:1463-1483). - F5 (Minor): the rename creates a same-name, two-meaning pair across modules:
validate_core_parameter_declarations(&[CoreParameter])(model/contract.rs:460) vsvalidate_core_parameter_declarations(&wire::ModelContract)(runtime_core/mod.rs:48), while the values check keeps the old verb (contract.rs:521). - Sound (stated plainly, not invented defects): no admission-metric, span or threshold change; no new lock, allocation, queue or memory pressure on any hot path; no new panic surface (the
Indexat:1488is provably total); theGraphKindrelocation is behaviour-identical; the Python refactor is logic-identical; nothing OS-specific is touched.
1. Correctness, Safety & Platform Parity
F1 — Declarations now have two owners and no startup invariant ties them together — Minor
(SchedulerCapabilities.core_parameters = admission identity; config.contract.core_parameters = resolved values. Fail-closed, so not a blocker; raise to Major if the in-process Rust SDK path is exercised by out-of-tree callers.)
Admission/prefix identity owner — helios/src/scheduler.rs:109-110:
/// Core-declared FP32 forward parameters validated and hashed into every admission plan.
pub core_parameters: Vec<crate::model::contract::CoreParameter>,
Validated once, at construction, and then used as the sole source of prefix identity — helios/src/scheduler.rs:696 and :1462:
crate::model::contract::validate_core_parameter_declarations(&capabilities.core_parameters)?,
...
let parameters = &self.capabilities.core_parameters;
Resolution/validation owner of the values that are actually uploaded — helios/src/server/request.rs:333-335, re-validated at helios/src/model/admission.rs:74-76:
let core_parameters = config
.contract
.resolve_core_parameters(&opts.core_parameters)?;
...
config
.contract
.validate_core_parameters(&self.core_parameters)?;
The only bridge between the two copies is one clone in helios/src/model.rs:336:
core_parameters: config.contract.core_parameters.clone(),
SchedulerCapabilities is a fully pub, hand-constructible struct, so a caller can build a declaring core's scheduler with core_parameters: vec![]. Admission then compares the empty declaration list against the non-empty resolved values and rejects every request, at helios/src/scheduler.rs:1473-1482:
|| crate::model::contract::validate_resolved_core_parameters(
parameters,
core_parameters,
)
.is_err()
{
return Err(crate::Error::admission(
crate::AdmissionError::Invalid,
"request requires a nonempty prompt, positive output limit, bounded total tokens, and resolved core parameters",
because the checker demands exact cardinality and name-set equality (helios/src/model/contract.rs:475-483):
if values.len() != parameters.len()
|| parameters.iter().any(|parameter| {
values
.get(¶meter.name)
.is_none_or(|&value| !parameter.validate_value(value))
A same-shaped but stale declaration list passes admission and hashes values resolved from the other list; the only consistency check is between the admission record and the plan derived from it, in helios/src/model/packing.rs:556-571:
if binding.source == ValueSource::CoreParameter {
let value = admission
.core_parameters
.get(&binding.parameter)
.copied()
.ok_or("core-parameter admission is incomplete")?;
let planned = live
.core_parameters()
.get(&binding.parameter)
.copied()
.ok_or("core-parameter admission plan is incomplete")?;
if value.to_bits() != planned.to_bits() {
which cannot see drift between the two lists, because both sides come from the plan.
Impact. On a declaring core, a mis-wired capabilities list is not a startup failure: it is either a 100% request-rejection outage carrying a message that blames the prompt, or a late packing failure after pages and snapshot were reserved (scheduler.rs:1484 precedes packing). No cache corruption is reachable — the identity hashes values under the declared names, and a value/name mismatch is refused — so this is an availability/observability defect, not a correctness one.
Fix (concrete). Either (a) compare scheduler.capabilities.core_parameters against config.contract.core_parameters once in ModelRuntime::start (helios/src/server/runtime.rs:637-641) and fail startup, or (b) do not store a second Vec at all — take the declarations from PreparedContract at scheduler construction so a single owner remains. Add a unit test that a declaring contract plus empty capabilities fails at RequestScheduler::new, not at admission.
No other correctness or platform-parity issue found
- Panic surface closed.
helios/src/scheduler.rs:1485-1490indexescore_parameters[parameter.name.as_str()], but thevalidate_resolved_core_parameterscall immediately above guarantees presence of every declared name and equal length, and duplicate names are refused at construction (scheduler.rs:696→model/contract.rs:460-468,names.insertreturning false ⇒"duplicate core-parameter declaration"). - Reset/edge-case flags: the salted history is rebuilt per request (
scheduler.rs:1491), so no state is carried across resets;plan_admissionnow routes parameterless callers through&Default::default()(:1450-1452), which cannot under- or over-populate the map. - Platform parity: the changed Python is pure float canonicalization (
ignition/preparation/contract.py:15-28,ignition/direct/scheduler.py) and touches no path, permission or process API; no Unix/Windows-divergent code is mirrored by this PR.
2. Unintended system-level consequences
No effect on locks, contention, memory or failure blast radius — verified, not assumed.
- Hot path cost goes down, not up. The change removes a borrowed caller slice (
&defs) fromplan_admission_with_core_parametersand substitutes a borrowed self field (scheduler.rs:1462): one fewer argument, no allocation, no clone added at admission. The only new clone (core_parameters: core_parameters.clone()at:1503) replaces an equivalent clone that already existed in the plan. - No new serialization. The scheduler remains single-worker-owned (
&mut selfonadmit/plan_admission), so the removed parameter was never a shared handle; no mutex, queue or coalescing structure is touched. - No admission-pricing / span change. The host-restore path in
helios/src/server/runtime.rs:2721-2782only lost the declaration argument;record_host_lookup,host_lookup_cost,worth_fetchingand the plan→lookup→restore span inadmit_with_host_store(server/runtime.rs:2779-2863) are byte-for-byte untouched. Nothing here shrinks the sampled time span (no disk-thread-only or rank-0-only narrowing). - Failure blast radius unchanged and single-request scoped. The new rejection is returned before
free_slot()(scheduler.rs:1479-1484), so it cannot leak a reserved slot or page; the added test asserts exactly that (helios/src/model/tests.rs,assert_eq!(scheduler.free_slot_count(), 4);after bothplan_admissionandadmitfail). - No cache/disk retentin effect. Prefix keys are unchanged for the pre-existing (declaration-free) population, so persisted Selene/host records continue to match; the change adds a salt only where declarations already existed.
3. Architecture, contracts & charter compliance
- Wire/proto surface: unchanged and correctly so. Only identifiers moved;
helios/src/runtime_core/protobuf.rs:54, :85, :952, :966, :1012andheliopause/src/export/binding.rs:1051are rename-only (pr_diffonruntime_core/andheliopause/). HTTP/protobuf formats are untouched, matching the description. - Captured-graph contracts untouched. The
GraphKindmove is a pure relocation:helios/src/execution/manifest.rs:93-104registers exactly the seven kinds thatmain's list enumerated,samples()(:89-91) now delegates, andis_text_forward()ispub(crate)— no new op contract, so no owner sign-off requirement is triggered. - Charter: no per-model branch. Declarations are generic
CoreParameterrecords (model/contract.rs:460), resolved generically (:501-519); no model name or flag appears in the diff. - F2 — under-reported public API break — Minor. Description text: "Rust callers constructing scheduler capabilities or passing declaration slices must update." Missing the third break, a renamed
pubre-export with no alias (helios/src/runtime_core/mod.rs:48-50):
pub fn validate_core_parameter_declarations(value: &wire::ModelContract) -> crate::Result<()> {
protobuf::validate_core_parameter_declarations(value)
}
The recipes/heliopause crates link helios_core, so an out-of-tree caller of the old name breaks at compile time with no deprecation window. Fix: add this to the description's compatibility sentence, or keep #[deprecated] pub fn validate_core_parameters forwarding for one release.
- F5 — same identifier, two meanings — Minor.
validate_core_parameter_declarationsinhelios/src/model/contract.rs:460takes&[CoreParameter]; the same name inhelios/src/runtime_core/mod.rs:48takes&wire::ModelContract. Meanwhile the values check keeps the old verb (model/contract.rs:521):
pub fn validate_core_parameters(&self, values: &crate::model::CoreParameters) -> Result<()> {
validate_resolved_core_parameters(&self.core_parameters, values)
A caller reading validate_core_parameters now has no way to tell "declarations" from "values" from the name alone. Fix: name the values method validate_resolved_core_parameters (the free function already exists at :471), or scope the wire wrapper.
4. Tests & claim accuracy
- F3 — the compatibility guarantee is untested — Minor. Description: "declaration-free cores keep their existing prefix keys." True by construction only:
plan_admission(helios/src/scheduler.rs:1450-1452) forwards&Default::default():
pub fn plan_admission(&mut self, spec: &RequestSpec) -> Result<AdmissionPlan> {
self.plan_admission_with_core_parameters(spec, &Default::default())
}
and :1485-1491 then builds PrefixHistory::with_core_parameters(self.identity, parameter_values) over an empty iterator. No test asserts that this equals the pre-PR declaration-free key sequence — which matters because mismatch would silently invalidate every persisted checkpoint on upgrade. Fix: assert key_at(n) equality for several n between the parameterless construction and an explicit empty-parameter-list construction, cross-checked against a fixed historical key.
- F4 — one overloaded error for four independent preconditions — Minor. Verbatim from
helios/src/scheduler.rs:1463-1483: the guard chain ORsprompt.is_empty(),message_boundariesordering/bounds,max_new_tokens == 0, themax_sequence_tokensoverflow, andvalidate_resolved_core_parameters(...).is_err()into one message that ends"...and resolved core parameters". A caller migrating offadmit()on a declaring core sees a message blaming its prompt. Fix: return a distinct, explicitAdmissionErrorvariant/message for a declaration/value mismatch, checked first. - What the tests do cover (verified in the diff).
helios/src/model/tests.rsnow asserts both rejection paths and that no slot leaks:assert!(scheduler.plan_admission(&spec).is_err());,assert!(scheduler.admit(spec.clone()).is_err());,assert_eq!(scheduler.free_slot_count(), 4);, and the out-of-range /-0.0/ valid-value cases at the original and a different scale.helios/src/scheduler/tests.rsadds the duplicate-name capability case (core_parameterswith two"gain"entries rejected at construction) and threadscore_parameters: vec![]through every fixture. There is no test that a declaring contract's capabilities are non-empty, i.e. no test for F1. - Claim accuracy. The description's evidence is self-reported; no CI run is visible on
55bab978, and per the case file the triggering workflows are not path-filtered away (python-cpu.yml(not opened),native-serving.yml(not opened) trigger on everypull_request;helios-lifecycle.yml(not opened) fires becausehelios/**changes). The stated Helios/Heliopause/Flare/CLI counts and 593,697 transitions are a re-run of #505's suite, not new coverage, and no Kani harness was added by this PR (the two named harnesses exist in the pre-existing set). The description is nonetheless honest about the qualification gap:docs/TODO.txt:10-16defers GPU export/serving, and no in-repo recipe declares core parameters.
Verified sound (explicitly, so these are not re-litigated)
- Python refactor is behaviour-preserving.
ignition/preparation/contract.py:15-28wire_fp32reproduces the removed_wire_fp32exactly (sameisinstancegate, same3.4028234663852886e38bound, same nonzero-underflow rejection and-0.0canonicalization →0.0); sharing it withignition/direct/scheduler.pycloses a real divergence rather than opening one, andtests/direct/test_scheduler.py:997-1025asserts 86 direct-execution/preparation tests pass. - Docs are scoped honestly.
docs/api.md:766-770,docs/direct-execution.md:86-89,docs/prefix-cache-offload.md:773-781,helios/model-contract.md:128-134state the declaration requirement, distinguish exported-core serving from checkpoint direct execution, and list the rejection causes that match the wire decoders — no over-claim of GPU coverage. - No metric/rate/admission-pricing span change anywhere in the diff (see §2).
Open questions / could not be found
- Untested drift between the two declaration owners (F1). No test, startup assertion or doc note pins
SchedulerCapabilities.core_parameterstoconfig.contract.core_parameters;helios/src/server/request.rs:333-335(resolution) andhelios/src/scheduler.rs:1462(admission) consult different copies. - No observable CI run on
55bab978; every suite result remains self-reported. - Previously flagged bot review blocker is stale at head. It alleged a
mainconflict inhelios/src/scheduler/policy_tests.rs(prefill_catalog_enginelackingcore_parameters); at head all fiveSchedulerCapabilitiesliterals in that file set or inherit the field (:117, :1167, :3125, :4489, :5990) and the helper only delegates (:5652). It has not been retracted, so a human reader may take it at face value. - Out-of-repo "Full Review" link in that bot comment was not fetched (off-repository, and its one substantive claim is the stale item above); all Autobot case-file/Full-Review/Value-Proposition artifacts are generated material, not human review.