#1 [high] Research summary
Correctness, Contracts & System-Level review of #621 (head 55bab97)
I opened every changed Rust/Python/doc file plus the direct callers (server/runtime.rs, server/request.rs, model/admission.rs, model/packing.rs, model/inputs.rs, heliopause/export/binding.rs (not opened), ignition/direct/scheduler.py, ignition/preparation/contract.py) and the touched tests. The mechanical parts of the change are sound; what I found is one contract-ownership hazard and three claim/test/naming inaccuracies.
F1 — Declarations now have two owners and nothing pins them together (Minor, but the PR's central design point)
SchedulerCapabilities.core_parameters (helios/src/scheduler.rs:109-110) is validated at RequestScheduler::new (scheduler.rs:696) and then becomes the sole source of prefix identity at scheduler.rs:1462 (let parameters = &self.capabilities.core_parameters;), while the values that are actually uploaded are resolved and validated against a different copy, config.contract.core_parameters (helios/src/server/request.rs:333-335, helios/src/model/admission.rs:76/:139). The two copies are only incidentally equal, via scheduler_capabilities (helios/src/model.rs:336, core_parameters: config.contract.core_parameters.clone()). Because SchedulerCapabilities is a fully pub struct built by hand in the Rust SDK path, a caller can construct a declaring core's scheduler with core_parameters: vec![]; plan_admission_with_core_parameters then succeeds (empty values match empty declarations) and reserves pages/snapshot, and the mismatch surfaces only at pack time:
// helios/src/model/packing.rs:556-566
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")?;
The reverse divergence rejects every request at scheduler.rs:1479-1482. Impact: on a declaring core a mis-wired capabilities list becomes a per-request AdmissionError::Invalid (a total outage with a prompt-shaped error) or a late packing failure after resources are reserved — not a startup error. Before this PR the declarations travelled with the call site, so this coupling could not drift. It is fail-closed (no cache mix-up is possible, since validate_resolved_core_parameters at contract.rs:471-485 requires exact name-set equality), but nothing tests it. Fix: assert the two lists agree where they are both available (e.g. compare scheduler.capabilities.core_parameters against config.contract.core_parameters in ModelRuntime::start, server/runtime.rs:637-641, and fail startup), or take declarations from PreparedContract at construction instead of storing a second Vec.
F2 — PR description under-reports the public API break (Minor)
The description says "Rust callers constructing scheduler capabilities or passing declaration slices must update." It omits the third break, a renamed pub re-export with no alias: helios/src/runtime_core/mod.rs:48-50 (pub fn validate_core_parameter_declarations), consumed by heliopause/src/export/binding.rs:1051. Any out-of-tree caller of helios_core::runtime_core::validate_core_parameters (the recipes repo links this crate) breaks without warning. Fix: add it to the description's compatibility sentence, or keep #[deprecated] pub fn validate_core_parameters forwarding for one release.
F3 — The stated compatibility guarantee has no regression test (Minor)
The description claims "declaration-free cores keep their existing prefix keys" — the property that keeps persisted Selene/host records and in-flight checkpoints matching across the upgrade. That is true by construction (hash.rs:36-53: PrefixHistory::new is with_core_parameters(identity, empty)), but plan_admission (scheduler.rs:1450-1452) now routes every parameterless call through that path and no test pins equality. cache/tests.rs:132 (not opened) covers only the non-empty case; model/tests.rs:137-139 covers only the new rejection. Fix: assert PrefixHistory::new(identity).key_at(n) == PrefixHistory::with_core_parameters(identity, std::iter::empty()).key_at(n) for a few n.
F4 — The new parameterless rejection reuses one overloaded error (Minor)
scheduler.rs:1463-1482 folds the core-parameter check into a single AdmissionError::Invalid whose message is "request requires a nonempty prompt, positive output limit, bounded total tokens, and resolved core parameters". A caller that used the now-rejected admit() on a declaring core cannot tell which of four conditions failed, and no error distinguishes "this core declares parameters, pass values". Fix: return a distinct message for the parameters mismatch before the prompt checks.
F5 — Same identifier, two meanings across modules (Minor)
helios::model::contract::validate_core_parameter_declarations(&[CoreParameter]) (contract.rs:460, pub) and helios::runtime_core::validate_core_parameter_declarations(&wire::ModelContract) (runtime_core/mod.rs:48) are both public, while the values check keeps the old verb: PreparedContract::validate_core_parameters(&CoreParameters) (contract.rs:521, called from model/admission.rs:76). Fix: name the values check validate_resolved_core_parameters (the free function already exists at contract.rs:471) or scope the wire one to runtime_core.
Verified sound
- No admission-metric or span change.
record_host_lookup,host_lookup_cost,worth_fetchingand the plan→lookup→restore span inadmit_with_host_store(server/runtime.rs:2779-2863) are untouched; only the declaration argument disappeared. - No concurrency/lock/memory consequence. The scheduler remains single-worker-owned; the change replaces a borrowed caller slice with a borrowed self field (
scheduler.rs:1462), so it removes an argument rather than adding allocation.RequestScheduler::newvalidation is once-per-scheduler. - Panic surface closed. The
Indexatscheduler.rs:1488(core_parameters[parameter.name.as_str()]) cannot panic:validate_resolved_core_parametersabove it guarantees equal length and presence of every declared name, and duplicate names are rejected at construction (scheduler.rs:696). GraphKindrelocation is behaviour-identical. Headis_text_forward()(execution/manifest.rs:93-104) lists exactly the seven kinds thatmain'ssamples()listed;samples()still returns the same set, andis_text_forwardispub(crate), so no public surface is lost.- Python refactor is behaviour-preserving.
wire_fp32(ignition/preparation/contract.py:15-28) is logic-identical to the removed_wire_fp32(sameisinstancegate, same3.4028234663852886e38bound, same underflow/-0.0handling);npandmathremain used elsewhere indirect/scheduler.py(:161,:238,:327), and the droppedtokens=parameter of_cache_key(:878-882) had no callers. Nothing OS-specific is touched, so no Unix/Windows parity concern. - Docs are honest.
docs/api.md:767-770,docs/direct-execution.md:86-89anddocs/TODO.txt:10-16correctly scope the qualification gap rather than claiming GPU coverage;helios/model-contract.md:131-134's new rejection list matches what the wire decoders enforce (server/protocol/decode.rs:61-68).
Nothing here is a blocker; F1 is the one I would require a reply on.
#2 [high] #621 F1: declarations have two owners, nothing pins them
Lens: Correctness/Contracts. Severity: Minor (raise to Major if SDK callers are real; fail-closed, no cache mix-up).
Two copies of the declaration list now exist and only incidentally agree:
- Admission/prefix identity:
helios/src/scheduler.rs:109-110fieldpub core_parameters: Vec<crate::model::contract::CoreParameter>onSchedulerCapabilities; validated once inRequestScheduler::newatscheduler.rs:696(crate::model::contract::validate_core_parameter_declarations(&capabilities.core_parameters)?); used as sole source atscheduler.rs:1462let parameters = &self.capabilities.core_parameters;. - Resolution/validation of the values actually uploaded:
helios/src/server/request.rs:333-335config.contract.resolve_core_parameters(&opts.core_parameters); alsohelios/src/model/admission.rs:76and:139validate_core_parameters(...). - The bridge is only
helios/src/model.rs:336core_parameters: config.contract.core_parameters.clone(),insidescheduler_capabilities.
SchedulerCapabilities is fully pub and built by hand, so a Rust SDK caller can pass core_parameters: vec![] for a declaring core. Then:
- Forward direction (declarations empty, values non-empty):
validate_resolved_core_parameters(contract.rs:475-483, requiresvalues.len() == parameters.len()) fails ⇒ every request rejected atscheduler.rs:1479-1482with the generic message. - Reverse direction (values empty, declarations non-empty): plan succeeds for empty prompt-parameter set? No — same length check rejects. So the reachable bad case is values resolved from one list, declarations empty ⇒ all rejected; or declarations match but the uploaded values come from a differently-declared list ⇒ late failure at
helios/src/model/packing.rs:556-566:let value = admission.core_parameters.get(&binding.parameter).copied().ok_or("core-parameter admission is incomplete")?; let planned = live.core_parameters()...i.e. failure after pages/snapshot reserved.
No test pins the two lists together (grep of plan_admission_with_core_parameters/SchedulerCapabilities shows only empty vec![] fixtures plus the duplicate-name case at scheduler/tests.rs:2432-2446).
Fix: compare scheduler.capabilities.core_parameters to config.contract.core_parameters at startup in ModelRuntime::start (server/runtime.rs:637-641) and fail; or derive declarations from PreparedContract at construction instead of storing a second Vec.
Pre-PR the declarations travelled with each call site (plan_admission_with_core_parameters(&spec, &defs, &values)), so drift was impossible — this is introduced by the PR's design.