Review of PR #505 — Bind core-declared FP32 parameters into text forward graphs (correctness lens)
Key findings
The wire format, contract validation, prefix hashing, and packing work are internally consistent: I could not find a path that produces a wrong value, a wrong prefix-cache identity, or a bad row layout for cores that declare core parameters. Two gaps remain where validation is claimed "shared" but is not actually reached on every path:
- Should fix —
RequestScheduler::plan_admissionpasses empty declarations, so admission of a declaring core throughadmit/admit_plannedsucceeds with no parameters and fails only at packing on every forward launch. - Should fix — Heliopause export validates only the declarations, not the bindings, so a recipe can export successfully with an invalid core-parameter binding and fail only when the core is loaded.
Three nits follow (misleading errors, a null in /v1/models). Nothing here blocks the design; the two "should fix" items are about failing early and where the description says validation happens.
Should fix
1. Declaration-free admission silently bypasses core-parameter validation
helios/src/scheduler.rs:1526-1528:
pub fn plan_admission(&mut self, spec: &RequestSpec) -> Result<AdmissionPlan> {
self.plan_admission_with_core_parameters(spec, &[], &Default::default())
}
validate_resolved_core_parameters (helios/src/model/contract.rs:484-497) rejects only when values.len() != parameters.len() or a value fails validate_value; with both collections empty it returns Ok(()). Consequently, on a core whose contract does declare parameters:
RequestScheduler::admit(scheduler.rs:1519-1522) andadmit_planned(scheduler.rs:1616-1622) accept the request;- the plan is stored with an empty map (
AdmissionPlan.core_parameters, set atscheduler.rs:1575-1579) and copied to the live request (LiveRequest.core_parameters,scheduler.rs:1827); - admission-time validation in
Admission::validate/validate_prompt(helios/src/model/admission.rs:71-76,134-139) is never reached on that path.
The failure surfaces only during execution, on every forward launch, at helios/src/model/packing.rs:588-592:
let planned = live.core_parameters().get(&binding.parameter).copied()
.ok_or("core-parameter admission plan is incomplete")?;
Why it matters: docs/design-review.md principle 2 requires admission to reserve resources and reject unsupported configurations explicitly, and AGENTS.md forbids silently substituting execution paths / weakening guarantees. The PR description presents validation as shared and load-time-consistent; the declaration-free admission entry point is the one callers use by default (all scheduler tests and the boundary/policy tests go through it, e.g. helios/src/scheduler/tests.rs:2711 (not opened), helios/src/scheduler/policy_tests.rs:3056 (not opened)), so an embedder that keeps using admit gets a request that is accepted, occupies a slot, and then dies in the step loop instead of getting one clear 4xx/AdmissionError::Invalid.
Fix: carry the model's declarations into the scheduler (e.g. on SchedulerLimits/ModelConfig alongside scored_prefill_catalog) and always validate them, or make plan_admission return AdmissionError::Invalid when declarations exist and none were supplied.
Would be settled by: a test fixture with a declaring core that admits via scheduler.admit(...) and asserts Err (currently Ok, error later at pack_step).
2. Export-time validation covers declarations but not bindings
heliopause/src/export/binding.rs:1044-1047:
let contract: super::wire::ServingContract = message("ServingContract", &server.into())?;
if let Some(model_contract) = contract.model_contract.as_ref() {
helios_core::runtime_core::validate_core_parameters(model_contract)?;
}
runtime_core::validate_core_parameters (helios/src/runtime_core/protobuf.rs:54-73) only parses name/default_value/range and calls validate_core_parameter_declarations (contract.rs:473-482) — names, finiteness, and min <= default <= max. The binding invariants this PR introduces — text-forward-only sources (packing.rs:139-145), required width-one FP32 buffer covering request capacity, SubmissionRow|RequestRow|ActiveRow indexing (packing.rs:153-161), zero value_offset (packing.rs:162-168), zero padding, empty tensor, and "every declared parameter bound in every selected text forward graph + at least one text forward graph selected" — live in PreparedContract::validate (helios/src/model/contract.rs:693-728) and in the packing-side validation reached at helios/src/model/packing.rs:67 via catalog::validate (helios/src/model/catalog.rs:31).
Because ExportRequest.input_bindings carry only buffer_name/host_offset/nbytes (heliopause/src/python.rs:206-240), the export path structurally cannot run those checks; the only contract validator exposed to the export side is validate_prepared_contract (heliopause/src/python.rs:161-169), which is behind the qualification feature and, from what I could search, has no Python caller (only export_serving is called, ignition/preparation/core_proto.py:12 (not opened)).
Result: a recipe can produce a core archive whose PreparedContract violates the new rules (e.g. a CORE_PARAMETER binding in a VISION graph, or a declared parameter bound in only one of two selected prefill graphs) and the export succeeds. It fails only at load (Bootstrap::load → catalog::validate) or at Inputs::new, contradicting the description's "Validate core-parameter declarations both on core load … and during Heliopause export". A rejected-at-export error is far cheaper than a rejected multi-GB artifact.
Fix: run PreparedContract::validate (or a shared binding-only validator extracted from it) from serving_metadata, or make export_serving require the prepared contract JSON and validate it.
Would be settled by: an export test with a CORE_PARAMETER binding placed on a non-text-forward graph — expected Err from export today; Ok until load.
Nits
3. Mismatched-length error message reads as a contract mismatch
Admission::validate/validate_prompt route through validate_core_parameters (contract.rs:534 → validate_resolved_core_parameters), whose single error string is "core_parameters does not match the model core's resolved parameters" (contract.rs:495). An embedder that builds Admission { core_parameters: Default::default(), .. } for a declaring core gets that message, which suggests a model/runtime version skew rather than "this request did not supply required parameters". helios/src/model/admission.rs:74-76, 137-139. Fix: name the missing parameters in the error.
4. Offset guard reports the wrong reason for float sources
helios/src/model/packing.rs:162-168 now includes CoreParameter in the guard but keeps the message "value offset requires an integer value source" — wrong for CoreParameter, SamplingParameters, and ImageTensor, all of which are float sources. Anyone debugging a rejected recipe will be sent down the wrong path. Fix: generalize the message ("this value source does not support a nonzero value offset").
5. /v1/models emits "range": null for unbounded parameters
helios/src/server/models.rs:76-88 builds "range": range where range is Option<CoreParameterRange>, so an omitted range serializes as JSON null, while the serving metadata path deliberately strips nulls (runtime_core/protobuf.rs:87: retain(|_, v| !v.is_null())). Clients must handle both "absent" and "null"; docs/api.md (not opened) should state which is normative, or the field should be omitted.
Checked and found correct
- Prefix identity:
PrefixHistory::newstill produces exactlyflare-prefix-root-v1\0 || identitybecause the parameter iterator is empty (helios/src/cache/hash.rs:37-65); declaration-order hashing includes zero-valued parameters and canonicalizes-0.0, so two cores differing only in declared order cannot collide with a parameter-free root. - Retry/preemption/readmission:
refresh_admission_plan(scheduler.rs:1584-1590) clones the resolved map rather than re-resolving, andbegin_pool_lookup(server/runtime.rs:2738-2772),admit_with_checkpoint_accounting(2774-2787) andadmit_with_host_store(2791-2811) all take the definitions plusincoming.prompt.core_parameters, so a pool-lookup retry or preemption cannot desynchronize the salted history from the packed value. This is the concurrency-sensitive path and it looks right. - Packing:
SubmissionRowstaging is sized once (packing.rs:286-293), resized per binding before use (533-549), and cleared per binding, so multiple parameters per graph are safe; thecore_parametersstaging vector is indexed with the samedestinationthat was bounds-checked againstinput.elements(598-608);checked_mul/checked_addcover offset and extent overflow (562-576); the bit-equality check (593-597) correctly catches a value that changed between admission and packing. - HTTP: the four protocols decode
core_parametersthrough one path (server/protocol/decode.rs:49-75, cached map at614-616) and resolve atserver/request.rs:333-335beforeAdmissionconstruction, so a bad value is a 400 rather than a request-time error. - Python direct path:
ignition/direct/packing.py,scheduler.py,server.pymirror the same binding set, top-level-only parsing, and 0.0 padding of inactive rows. serving_contractrestructure (runtime_core/protobuf.rs:75-89) is behaviourally identical to the previousis_none_orcheck, including the version range1..=3, and keepsModelContract.version == 3, so existing cores load unchanged.- Compat: no core-parameter declarations means no new fields on the wire (
core_parametersempty,parameterempty), the six-columnSAMPLING_PARAMETERSlayout is untouched, and old cores produce unchanged prefix roots.
Open questions / limits
- I read code paths only; I did not execute the Rust/Python suites,
verification/helios-lifecycle/check.py(not opened), or Kani. Findings 1 and 2 are the two that a test would confirm in minutes (declaring-core admission throughadmit; export with a mis-placed binding). - Whether the export gap in finding 2 is intentional (recipes are expected to be validated by the load path anyway) is not stated anywhere in the repo I could find; the PR description claims export-time validation of the declarations specifically, and I could not find a qualification-gated call site for
validate_prepared_contractin the ignition pipeline. - No model recipe in this repo declares a core parameter, so none of these paths are exercised in-repo by real recipes — every finding above is about the validation surface a recipe would hit.