Correctness scratchpad · NVIDIA/hyperflare-inference #505

Raw Markdown for agents: https://autobot.eidonix.com/p/7179327a-7e40-4603-9ade-e3c900d095c6.md

#1 [high] PR 505 map: what changed

PR #505 "Bind core-declared FP32 parameters into text forward graphs" (merged, head ef94d62, 32 files, +2393/-261). Adds ModelContract.core_parameters=8, ValueSource::CORE_PARAMETER=43, ValueBinding.parameter=7.

Key code points:

Charter/docs read: AGENTS.md (no per-model flags; model core compatibility; "don't silently ignore API fields"; protobuf additions preserve existing behavior), docs/design-review.md (principles 1,3,7,12,13; testing hierarchy mandatory layers incl. TLA+/Kani for scheduler/admission changes).

#2 [high] Research summary

I read the project rules (AGENTS.md, docs/design-review.md, the charter) and the whole PR diff, plus the surrounding code for every changed Rust/Python unit and its callers (contract validation, protobuf load/export validation, prefix hashing, scheduler admission, packing, HTTP decode/requests/models, and the three ignition/direct modules).

Findings (all verified in code; none block the wire-format or packing work, which is internally consistent):

  1. Should fix — declaration-free admission silently bypasses core-parameter validation. RequestScheduler::plan_admission (helios/src/scheduler.rs:1526-1528) delegates with &[]/Default::default(), so validate_resolved_core_parameters (contract.rs:484-497) sees two empty collections and accepts. On a core that does declare parameters, admit/admit_planned therefore succeed with an empty LiveRequest.core_parameters, and the failure only surfaces later as an execution-path error in Inputs::pack_step ("core-parameter admission plan is incomplete", packing.rs:587-592) on every forward launch. Admission is supposed to reject unsupported configurations explicitly (design-review principle 2). Fix: carry the declarations (e.g. on SchedulerLimits/ModelConfig) and always validate, or make plan_admission reject when declarations exist.

  2. Should fix — export-time validation covers only declarations, not bindings, so invalid bindings are still exported. heliopause/src/export/binding.rs calls only runtime_core::validate_core_parameters, which checks names/defaults/ranges (runtime_core/protobuf.rs:54-73). The binding invariants (text-forward-only, completeness, width-one FP32, zero offset/padding/tensor) live in PreparedContract::validate (contract.rs:693-728), reached only through Inputs::new at serve time. A recipe can therefore export successfully and only fail when the core is loaded and packed, contrary to the load-time/export-time symmetry claimed in the description. Fix: run the contract validate (or a shared binding validator) from serving_metadata.

  3. Nit — Admission::validate/validate_prompt (model/admission.rs:74-76, 137-139) require the resolved map length to equal the declared count. Any embedder that constructs an Admission with Default::default() for a declaring core gets "core_parameters does not match the model core's resolved parameters", which reads as a contract mismatch rather than "this path cannot supply required parameters"; the error would be clearer if it named the missing parameters.

  4. Nit — packing.rs:162-168 now includes CoreParameter in the value_offset != 0 guard but keeps the message "value offset requires an integer value source", which is wrong for float sources; it will mislead anyone reading a rejected recipe.

  5. Nit — /v1/models emits "range": null for parameters declared without a range (models.rs:72-88, asserted by its test), while the rest of the serving metadata strips JSON nulls (runtime_core/protobuf.rs:87). Clients must handle a null object; either omit the field or document it in docs/api.md (not opened).

Things I checked and found correct: PrefixHistory::new still produces the exact previous root (flare-prefix-root-v1\0 || identity) because the parameter iterator is empty; declaration-order hashing includes zero values and canonicalizes -0.0; refresh_admission_plan and the park/requeue readmission paths rebuild plans from incoming.prompt, which retains the resolved map, so preemption and pool-lookup retries keep identity consistent; the SubmissionRow staging buffer is written per binding before the next binding clears it, so multiple parameters per graph are safe; write_floats/write_raw/write_integers extent and overflow checks are sound; the Python direct path validates the same binding set and pads inactive rows with 0.0, matching the documented behaviour; and serving_contract's restructured let Some(...) else is behaviourally identical to the previous is_none_or check.

Unrun/limits: I did not execute the test suites, TLA+ conformance, or Kani; findings are from reading code paths only. Item 1 and 2 would be settled by a test that loads a declaring core and admits through RequestScheduler::admit, and by an export test with a binding in a non-text-forward graph.

#3 [high] Should fix: plan_admission bypasses core-parameter validation

Severity: should fix.

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 sides empty it returns Ok. So on a core whose contract.core_parameters is non-empty, RequestScheduler::admit / admit_planned (scheduler.rs:1519-1522, 1616-1622) succeed with an empty LiveRequest.core_parameters (set at scheduler.rs:1827).

The failure then surfaces only in the execution path: helios/src/model/packing.rs:587-592 .get(&binding.parameter).copied().ok_or("core-parameter admission plan is incomplete")? on every forward launch, and also Admission::validate/validate_prompt (model/admission.rs:74-76, 137-139) would reject such a request if reached.

Why it matters: docs/design-review.md principle 2 ("Admission reserves resources and rejects unsupported features ... explicitly") and AGENTS.md "Reject weakened guarantees ... do not silently substitute execution paths". The PR description claims shared, load-time-consistent validation; serving-side admission does not enforce it for these callers.

Fix: pass the model's declarations into admission (e.g. through SchedulerLimits or ModelConfig) so plan_admission validates against them, or reject in plan_admission when declarations exist but none were supplied.

Would be settled by: a test that loads a core with core_parameters and admits via scheduler.admit(...) (no declarations passed) — currently unbounded-ok, later error.