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

Raw Markdown for agents: https://autobot.eidonix.com/p/7d617af6-3647-48a8-9d47-04c558609367.md

#1 [high] Research summary

I reviewed the full diff against main, the scheduler admission path, every production caller in helios/src/server/runtime.rs and its re-admission/preemption path, the contract/validator helpers, the Python direct+preparation narrowing code, the docs touched, and the tests. Core mechanics check out; the findings are about diagnosability, an untested two-list invariant, doc/test/claim accuracy, and under-stated API breakage.

Verified sound (stated plainly, no issue invented): the rejection really precedes free_slot() (scheduler.rs:1587) and cache.lookup (:1602), so no slot or page is reserved on the parameterless path; declaration-free cores keep byte-identical prefix roots (PrefixHistory::with_core_parameters with an empty iterator equals PrefixHistory::new, cache/hash.rs:37-53); preemption keeps incoming.prompt.core_parameters through park() (runtime.rs:2086-2111, asserted at phase_tests.rs:6798), so declaring cores re-admit with the same identity; GraphKind::samples() and the new is_text_forward() cover the identical seven kinds as main, so that relocation is behaviour-neutral; and nothing is added to the per-admission hot path (the declarations were hashed before and after, and &self.capabilities.core_parameters replaces the caller-passed slice).

Findings

  1. Two declaration lists can silently diverge, and the split failure is swallowed before it becomes a rejection (Major). Values are resolved against config.contract (helios/src/server/request.rs:333-335: .resolve_core_parameters(&opts.core_parameters)?) while admission validates them against self.capabilities.core_parameters (helios/src/scheduler.rs:1565,1576). Both currently originate from config.contract.core_parameters.clone() (helios/src/model.rs:340), but nothing pins that, and begin_pool_lookup discards the plan error: helios/src/server/runtime.rs:2753-2755 — let Ok(plan) = plan else { return; };. Impact: on any divergence the core silently loses its host-pool lookup (incoming.pool_plan/pool_lookup never set, runtime.rs:2746-2763) and then rejects 100% of requests at admission — a capability regression plus total failure with no metric. Fix: assert the lists agree (ModelRuntime::start/scheduler_capabilities_with_manifest), and have begin_pool_lookup propagate AdmissionError::Invalid to incoming.reject_admission instead of returning.

  2. The parameterless-on-a-declaring-core failure is indistinguishable from an empty-prompt failure (Minor). helios/src/scheduler.rs:1582-1585 returns one compound message for all seven predicates: "request requires a nonempty prompt, positive output limit, bounded total tokens, and resolved core parameters". A Rust SDK caller who used admit(spec) on a declaring core (the exact trap this PR closes) gets AdmissionError::Invalid with no hint that the entry point was wrong. Fix: split the core-parameter predicate out and say e.g. "core declares N core parameters; pass resolved values to plan_admission_with_core_parameters".

  3. Breaking public API surface is under-described in the description (Minor). SchedulerCapabilities gains a required public field with no Default impl and no #[non_exhaustive] (helios/src/scheduler.rs:110-111; I searched and neither exists), breaking every struct literal; and the public symbol was renamed (helios/src/runtime_core/mod.rs:48-50: pub fn validate_core_parameter_declarations(value: &wire::ModelContract), previously validate_core_parameters, callers at heliopause/src/export/binding.rs:1046 and runtime_core/protobuf.rs:85). The description only says "Rust callers constructing capabilities or passing declaration slices must update", which omits the rename. Fix: name both breaking changes explicitly (cheap now, per roadmap item 6).

  4. The new Python test does not exercise direct execution's use of the shared helper (Minor). tests/direct/test_scheduler.py:998-1001 imports from ignition.preparation.contract import wire_fp32 and tests that module only; a regression that re-introduced a private copy in ignition/direct/scheduler.py (now imported at :44, used at :122/:132/:225) would leave it green. The same test block is also the only coverage for the undeclared _cache_key(self, request, tokens=None) → (self, request) change (ignition/direct/scheduler.py:878-882), whose tokens parameter had no in-repo caller on main (callers at :620 and :903 are single-argument). Fix: add a direct-scheduler assertion that resolves a bad value through Layout.resolve_core_parameters/AdmissionError, and either drop the _cache_key change from this PR or note it.

  5. Citation of pre-existing proof harnesses as verification of this change (Minor). Both named harnesses exist but prove CoreParameter::validate and resolve_value only (helios/src/model/contract/kani_proofs.rs:85-106 and :108-142); nothing in kani_proofs.rs mentions the scheduler, validate_resolved_core_parameters, or the length check this PR relies on, and the diff adds no harness. Fix: say "re-ran the existing proofs; no new proof covers scheduler-owned declarations", rather than presenting them as support for the change.

  6. Docs left internally inconsistent by the PR's own rewrite (Minor). The new text at docs/prefix-cache-offload.md:773-779 correctly restricts plan_admission/admit to declaration-free cores, but docs/prefix-cache-offload.md:833 still reads Admission consults the store after \plan_admission`: `lookup` runs above the GPU hit, which is wrong for declaring cores (the worker uses plan_admission_with_core_parameters, runtime.rs:2748/2772/2792`). The rewritten paragraph also has one line at ~96 characters while the rest wraps near 78. Fix: reword :833 and rewrap :781.

  7. One "locked release test" claim is not reproducible under the repo's own CI environment (Minor). The description says the CLI suite passed only with CUDA_VISIBLE_DEVICES unset, but .github/workflows/python-cpu.yml:30-33 (not opened) runs env: CUDA_VISIBLE_DEVICES: "" with run: .venv/bin/python -m pytest tests/ -q. With no checks on cbb7a4f, the CLI count is not backed by a run matching how CI invokes the suite. Fix: state the exact invocation used, or re-run the CLI suite with the CI environment.

#2 [high] PR #621 lens review: verified-sound areas and 7 findings with citations

PR #621 "Validate scheduler admission against the core parameter declarations" (jcartu, head cbb7a4f, base 2147cd4c). Lens: Correctness, Contracts & System-Level Consequences.

VERIFIED SOUND (report states these plainly):

FINDINGS

  1. MAJOR — two declaration lists can diverge, and the divergence is swallowed before it becomes a rejection.
  1. MINOR — parameterless-on-declaring-core error is not diagnosable.
  1. MINOR — breaking public API under-described.
  1. MINOR — new Python test does not exercise direct execution's use of the shared helper.
  1. MINOR — pre-existing Kani proofs cited as verification of this change.
  1. MINOR — docs inconsistent after the PR's own rewrite.
  1. MINOR — a "locked release test" claim is not reproducible under the repo's CI.

CONTEXT: AGENTS.md requires PR descriptions to separate claim from evidence and to keep unrun checks in docs/TODO.txt (which this PR does add: docs/TODO.txt:10-16 GPU qualification gate, honestly disclosed in docs/api.md:768-771 and docs/direct-execution.md:86-89). Charter "Supported matrix & compatibility" remains unmet for the cache-identity change (no GPU/multi-host run), which the PR discloses rather than claims.