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

Raw Markdown for agents: https://autobot.eidonix.com/p/835abd27-f8e8-4181-9b07-bde22f65fa0a.md

Correctness, Contracts & System-Level Consequences review — PR #688

fix(helios): align proposal_confidence manifest messages with submission-row layout · jcartu · head 7503941 · base main · 5 files, +79/−8.

Key findings

  1. Major — the PR's "aligned all three specifications" is true only of helios/*. Three top-level docs/ specs still print the exact [2, request_slots, draft_capacity] spelling this PR removes, and none is in the file list: docs/runtime-core-design.md:715, docs/core-design.md:1227-1228, docs/scheduling-runtime-design.md:81-82. docs/runtime-core-design.md:697-699 is the paragraph helios/manifest.md:160-171 mirrors. Precedent: PR #542 was blocked for leaving ~11 comparable cross-file doc sites stale.
  2. Minor — the two new literals introduce three symbols (request_capacity, T, max_active) without defining any of them, and unqualified max_active is ambiguous in this codebase: Execution.max_active (helios/proto/runtime_core.proto:829) sizes the buffer, while admission max_active (runtime_core.proto:252) may be smaller (helios/src/model/catalog.rs:43-45, helios/src/server/config.rs:141-147).
  3. Minor — the new test's negative assertions are per-arm and spelling-specific: helios/src/execution/tests.rs:1370 rejects only "request slot", :1394 only "request_slots", so a regression reintroducing the other spelling in either arm passes.
  4. Minor — the PR renames the row extent to request_capacity in three sentences but leaves request_slots for the same quantity 80 lines away in the same documents (helios/README.md:386-388, helios/manifest.md:183), with the equality only stated at helios/manifest.md:211-213 / helios/src/scheduler.rs:60-63.
  5. Minor, claim accuracy — the test totals (1879/254/245, FLARE_TEST_TEMPLATE_DIR, 64 MiB locked memory) are unverifiable: no CI check and no log on 7503941. Every structural claim in the description checks out.
  6. No behavioural consequence exists. The only code change is two Err string literals; predicates, accepted shapes, wire, allocation, locks and hot paths are untouched. No issue in correctness/safety, platform parity, or system-level behaviour — stated plainly below.

1. Scope verification: the change really is two strings

helios/src/execution/manifest.rs changes in only two places, and both are the return Err(...) of an already-failing branch. At head the predicates are:

826  if let Some(buffer) = self.buffers.iter().find(|buffer| buffer.name == "proposal_confidence") {
827      if buffer.dtype != Dtype::Float32 || buffer.shape.len() != 3
828          || buffer.shape[0] != 2 || buffer.shape[1] != self.request_capacity()
829          || !(1..self.completion_token_capacity).contains(&buffer.shape[2]) {
830          return Err("proposal confidence requires [2, request_capacity, draft_capacity] float32 frames indexed by submission row (sized to max_active.next_power_of_two()) and draft depth 1..=T-1".into());
861  if graph.confidence_width > 0 {
862      let confidence = self.buffer("proposal_confidence")?;
863      if graph.kind != GraphKind::Speculative
864          || graph.confidence_width != graph.draft_tokens
865          || confidence.dtype != Dtype::Float32
...
870          || confidence.shape[2] > self.completion_token_capacity - 1 {
871          return Err("confidence output requires a speculative graph whose confidence_width equals draft_tokens and [2, request_capacity, draft_capacity] float32 submission-row frames covering confidence_width within draft depth 1..=T-1".into());

+2/−2 in that file is exactly the two literals; the shape/dtype/predicate lines above are unchanged. Consequently: no accepted shape, ABI number, protobuf field, wire layout or prepared core changes; existing cores remain valid (no re-export needed).

The new wording describes the runtime's real contract, not merely a producer convention: request_capacity() = self.max_active.next_power_of_two() (helios/src/execution/manifest.rs:583-585), SchedulerLimits::request_capacity() is literally request_slots (helios/src/scheduler.rs:60-63), helios/src/model/catalog.rs:45 forces limits.request_slots == manifest.request_capacity(), helios/src/server/config.rs:142 derives request_slots from manifest.max_active.next_power_of_two(), and readback fills rows in submission order and truncates to batch_capacity (helios/src/execution/transport.rs:1331-1347, helios/src/server/runtime.rs:1813-1818, helios/src/scheduler.rs:2517-2521). So this is a genuine correction of a misstatement, and the fix direction is right.


2. Major — cross-file documentation contract left stale (docs/)

The description claims: "helios/manifest.md, helios/model-contract.md, and helios/README.md: aligned all three specifications on [2, request_capacity, draft_capacity]…". That is accurate for helios/* and false for the repository's own top-level design docs, which still carry the rejected term verbatim:

docs/runtime-core-design.md:714-715

allocation requires adaptive selection. A confidence output declares
`confidence_width` and uses FP32 `[2, request_slots, draft_capacity]` frames.

docs/core-design.md:1227-1228

submitted lane limits. Confidence producers declare `confidence_width` and write
FP32 `[2, request_slots, draft_capacity]` completion frames.

docs/scheduling-runtime-design.md:81-83

A confidence-producing program declares `confidence_width`, equal to its actual
D. Its FP32 sidecar has shape `[2, request_slots, draft_capacity]`, covering every
produced prefix.

None of these three files appears in the PR's file list. Additionally docs/runtime-core-design.md:697-699 — the passage helios/manifest.md:164-171 now mirrors — omits the row extent entirely:

697  uses one fewer position. Proposal-confidence buffers may have one through T−1
698  positions and must cover every graph’s confidence width, where T is the completion
699  token capacity. Capacity one omits these zero-depth outputs.

Impact: the defect #440 reports ("no written rule for the row count") is only half closed. A core author reading the top-level design docs — the entry point for newcomers, and the docs helios/README.md:385 cross-links to — still sees request_slots named as the row extent, which is precisely the wording this PR identifies as wrong. It also weakens the PR's own claim of completeness. Repository precedent is hostile to this: PR #542 (closed, FujitsuPolycom) was blocked in review with "the batch-capacity specification is false in eleven places" and required the author to fix docs/ as well.

Fix: apply the same one-sentence correction to the three docs/ sites ([2, request_capacity, draft_capacity], request_capacity = max_active.next_power_of_two(), submission row), and add the row extent to docs/runtime-core-design.md:697-699 so the mirrored paragraph matches helios/manifest.md:164-171. Three edits, no code.


3. Minor — the new diagnostics use three undefined symbols, one of them ambiguous

helios/src/execution/manifest.rs:830 (and :871) now say:

"proposal confidence requires [2, request_capacity, draft_capacity] float32 frames indexed by submission row (sized to max_active.next_power_of_two()) and draft depth 1..=T-1"

and helios/model-contract.md:229-231:

`[2, request_capacity, draft_capacity]`, where
`request_capacity = max_active.next_power_of_two()` and `draft_capacity` is in
draft depth `1..=T−1` covering every declared output width.

Two precision problems, both only in prose:

Impact: diagnostics and one doc sentence remain ambiguous about which max_active sizes the buffer — the same class of defect the PR fixes, one level down. It cannot cause a wrong acceptance, since the check itself uses self.request_capacity().

Fix: in manifest.rs:830/:871 and model-contract.md:230, qualify the field (Execution.max_active) and spell out T (draft depth 1..=T-1, where T is completion_token_capacity).


4. Minor — the new test's negative assertions are per-arm and spelling-specific

helios/src/execution/tests.rs:1366-1370 (buffer arm) versus :1389-1394 (graph arm):

1366          let error = invalid.validate().unwrap_err().to_string();
1367          assert!(error.contains("submission row"), "{error}");
1368          assert!(error.contains("request_capacity"), "{error}");
1369          assert!(error.contains("draft depth 1..=T-1"), "{error}");
1370          assert!(!error.contains("request slot"), "{error}");
1390          assert!(error.contains("speculative graph whose confidence_width equals draft_tokens"), "{error}");
1391          assert!(error.contains("request_capacity"), "{error}");
1392          assert!(error.contains("submission-row"), "{error}");
1393          assert!(error.contains("draft depth 1..=T-1"), "{error}");
1394          assert!(!error.contains("request_slots"), "{error}");

Each arm only rejects the spelling its own message used before the fix ("request slot" in the buffer message, "request_slots" in the graph message). A regression that reintroduces request_slots into the buffer message, or "request slot" into the graph message, passes both loops. The positive assertions likewise pin the label request_capacity, not the arithmetic — a message that kept the label but described the wrong extent would still pass, because the extent is never computed into the assertion (the test does assert value.request_capacity() == 4 at :1338, but never compares it against the text).

Impact: the test's stated purpose is to protect the wording contract; its guard has a hole exactly in the place a careless revert would land. Not a defect in product code.

Fix: assert absence of both spellings in both loops (!error.contains("request slot") && !error.contains("request_slots")), and optionally build the expected extent from value.request_capacity().to_string() so the message is checked against the real number.

I verified the rest of the test's logic is sound and will pass at head: max_active = 3 → capacity 4; [2,4,5] accepted; [2,3,5] fails shape[1] != 4; [1,4,5] fails shape[0] != 2; [2,4,16] fails 1..T with T = 16; Int32 fails dtype; width_exceeds (width 6, shape[2] = 5) passes the B/D/W/P block at :851-857 then fails shape[2] < confidence_width; width_mismatch fails confidence_width == draft_tokens; non_speculative passes the else arm at :858 then fails the kind check. Descriptors are contiguous and self-consistent (nbytes/strides), and the span 0x20000 does not collide.


5. Minor — the PR renames one extent but leaves its other name in the same documents

helios/README.md:301-303 now says [2, request_capacity, draft_capacity] (sized to max_active.next_power_of_two()), while helios/README.md:386-388 in the same file still says:

context capacity. Batched graphs declare batch capacities in `1..=request_slots`
(at most 64); Helios enumerates and schedules whatever valid batch capacities

Same in helios/manifest.md:183 ("batch capacities … through request_slots") versus the new :166-167. These are the same extent — helios/src/scheduler.rs:60-63 returns self.request_slots from request_capacity() — and helios/manifest.md:211-213 already states the relationship ("SchedulerLimits.request_slots remains the captured transport capacity"). Nothing here is wrong, but a PR whose entire purpose is terminology alignment leaves the reader to prove two names are equal.

Fix: mirror the manifest.md:213 clause beside README.md:302 and manifest.md:166 (e.g. "request_capacity, the same extent request_slots names").

Related and correct as-is: completion_speculative_survival keeps "per request slot" at helios/src/execution/manifest.rs:823, even though its shape check at :822 uses the same self.request_capacity() extent. That buffer really is physical-slot indexed (decoded across all request_capacity() rows without truncation, helios/src/execution/transport.rs:1279-1290 and :381), so leaving it untouched is right; a reader diffing the two adjacent messages (:823 vs :830) will need the one-clause pointer to see why.


6. Minor — claim accuracy: test totals are self-reported

- **`helios`** (`--features runtime-core,server`): 1879 passed (1817 unit tests + 62
  integration tests), 0 failed, 84 ignored. ... **`flare`**: 254 passed ... **`flare-cli`**: 245 passed

There is no CI check on 7503941 and no log attached to the PR, so these numbers cannot be corroborated from the repository. Everything structural in the description does verify (the two literals, the three helios/* docs, the new test, the two named pre-existing tests — helios/src/execution/tests.rs:1310-1332 and helios/src/model/packed_round_tests.rs:200-215 — neither of which matches on message text, so the new strings cannot break them). The stated limitation (no GPU run, CUDA/checkpoint/exported-core tests ignored) is honest and consistent with no execution geometry changing. The description has the four parts the charter's Code Review Standards require. I would not treat this as needing a fix beyond attaching a log.


Areas that are sound — no findings


Open questions / not found