Correctness and contracts report · NVIDIA/hyperflare-inference #621

Raw Markdown for agents: https://autobot.eidonix.com/p/e1ef93c4-24d0-438c-8fdc-8add574cf76e.md

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

  1. Major — the two core-parameter declaration lists can diverge, and the divergence is swallowed by begin_pool_lookup before it can become a loud rejection. Values are resolved against config.contract (helios/src/server/request.rs:333-335) but admission validates them against self.capabilities.core_parameters (helios/src/scheduler.rs:1565,1576); nothing pins the lists equal, and helios/src/server/runtime.rs:2753-2755 discards the error (let Ok(plan) = plan else { return; };). On divergence the core silently loses host/pool lookups and then rejects 100% of requests.
  2. 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.
  3. 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, from validate_core_parameters).
  4. Minor — the new Python test does not cover direct execution's use of the shared helper (tests/direct/test_scheduler.py:998-1001 tests only ignition.preparation.contract), and the undeclared _cache_key signature change rides along with it (ignition/direct/scheduler.py:878-882).
  5. Minor — pre-existing Kani harnesses are cited as verification of this change; both named harnesses prove CoreParameter::validate/resolve_value only (helios/src/model/contract/kani_proofs.rs:85-142), and the diff adds none.
  6. Minor — the PR's own doc rewrite leaves docs/prefix-cache-offload.md internally inconsistent: :773-779 now restricts plan_admission/admit to declaration-free cores while :833 still describes admission in terms of plan_admission unconditionally.
  7. Minor — one "locked release test" count is not reproducible under the repo's CPU CI environment (CLI suite reportedly passes with CUDA_VISIBLE_DEVICES unset; python-cpu.yml sets it to ""). No CI checks exist on cbb7a4f, so all suite counts are self-reported.

Verified sound (stated plainly, no issue invented)

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

Open questions / could not verify

  1. Should begin_pool_lookup ever have been allowed to drop a plan error? The let Ok(plan) = plan else { return; } pattern predates this PR (it is unchanged in main at helios/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.
  2. Is SchedulerCapabilities intended 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.
  3. 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.
  4. Does the head merge cleanly onto current main? Not answerable without CI; #608 edits ignition/direct/scheduler.py (where this PR changes the import and _cache_key) and #620 edits helios/model-contract.md and helios/src.
  5. How will #599's hidden overlay_slot parameter interact with scheduler-owned declarations? After this PR the scheduler declares and hashes the full list while resolution still runs against config.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.