Re review report · NVIDIA/hyperflare-inference #229

Raw Markdown for agents: https://autobot.eidonix.com/p/d8b3ead5-f0e6-428b-8787-19cfd53c4158.md

Recommendation: Changes Requested

The Round 1 blockers around repository-split hygiene, FLAREIMG\x01 backward compatibility, value-checked window-plan cache validation, and removing image_preparation dispatch from packing.rs are cleanly resolved, and the shared resize::Filter and patch_merge::bracketed_prompt refactors preserve existing profiles. However, the new Windowed packing path introduced a concrete contract mismatch between tensor_layout (per-graph graph.token_capacity / 64 + 2) and packing::windowed (hardcoded global patch_capacities.last() / 64 + 2) that breaks non-maximal Vision graphs bound to their declared capacity, and the new Vision graph inputs (vision_cu_window_seqlens, vision_reverse_index) plus ImageLayoutKind::Windowed = 11 require explicit project-owner confirmation under AGENTS.md:376-381. In addition, the diff carries 160 unrelated lines in docs/TODO.txt, a dead template patch fixture that triggers an unused Hugging Face download, and an active wire tag-11 collision with open PR #483.

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

  1. packing::windowed pads vision_cu_window_seqlens to global max capacity while tensor_layout binds per-graph capacity (helios/src/frontend/images/packing.rs:70,563,581-583, helios/src/model/packing.rs:82-91,339-347,374-380).

    • Verified behavior & impact: At core load, Inputs::new (helios/src/model/packing.rs:82-91) validates every ValueSource::ImageTensor buffer against tensor_layout(layout, &binding.tensor, graph.token_capacity). For ImageLayoutKind::Windowed, tensor_layout (helios/src/frontend/images/packing.rs:70) declares (Int32, patches / 64 + 2) — so a Vision graph captured at token_capacity = 1024 validly binds an 18-element (72 B) vision_cu_window_seqlens buffer. At submission, scheduler/policy.rs:974,1086-1088 legitimately picks the smallest fitting capacity (1024), Inputs::pack_vision (model/packing.rs:339-347) resolves that 1024 graph and calls packing::prepare(...) without passing step.token_capacity, and packing::windowed (packing.rs:563,581-583) unconditionally pads cu_window to patch_capacities.last() / 64 + 2 (e.g. 16384 / 64 + 2 = 258 i32s = 1,032 B). Inputs::pack_vision (model/packing.rs:374-380) then deterministically rejects every non-maximal Vision graph with Err("image tensor exceeds prepared graph capacity"). Even if a recipe avoids this by sharing one max-capacity buffer across all Vision graphs, tensor_layout and windowed still contradict each other on the contract extent. The unit test at packing.rs:681 missed this because it passed 16384 (patch_capacities.last()) to tensor_layout instead of a non-maximal capacity (1024 or 4096) from vec![1024, 4096, 16384].
    • Fix: Thread the selected graph's capacity (graph.tokens / step.token_capacity at model/packing.rs:339) into packing::prepare and windowed, check geometry.patches <= graph_capacity, and pad cu_window to graph_capacity / 64 + 2 (since for any even grid with h * w = patches <= graph_capacity, ceil(h/32) * ceil(w/32) + 1 <= patches / 64 + 2 <= graph_capacity / 64 + 2, this never truncates). Alternatively, if smaller-capacity captured Vision graphs actually read the entire max-capacity buffer, update tensor_layout / Inputs::new to validate against patch_capacities.last() rather than graph.token_capacity. Add a test covering prepare (and Inputs::pack_vision or tensor_layout) at a non-maximal capacity (e.g., 1024 and 4096 in vec![1024, 4096, 16384]), and re-verify a multimodal PNG request on a multi-capacity core after the fix.
  2. Unapproved captured-graph operation contract change on GraphKind::Vision (helios/src/frontend/images/packing.rs:70-71,597-598, helios/proto/runtime_core.proto:501, AGENTS.md:376-381).

    • Verified behavior & impact: Directly answering the author's question: while vision_cu_window_seqlens and vision_reverse_index reuse ValueSource::ImageTensor on the existing GraphKind::Vision (ignition/preparation/contract.py:180-184), AGENTS.md:376-381 and docs/design-review.md:22-26 state that "A new operation contract requires approval even if it reuses an existing graph kind or enum value" from project owner Luke Alonso (@lukealonso), and #566 followed this process by requesting explicit sign-off (#535). Adding ImageLayoutKind::Windowed = 11 and two new Vision graph inputs changes what GraphKind::Vision consumes.
    • Fix: Obtain explicit sign-off from @lukealonso (either approving ImageLayoutKind::Windowed = 11 + vision_cu_window_seqlens / vision_reverse_index, or confirming that ImageLayoutKind extensions over ValueSource::ImageTensor are exempt from the clause) before merge.

Should Fix

  1. Remove unrelated repo-wide test inventory from docs/TODO.txt:357-515 (+160 lines) and dead fixture helios/tests/fixtures/templates/muse_glimmer_nvfp4/chat_template.patch.json (+13 lines).

    • docs/TODO.txt:357-515 adds ~80 mechanical entries listing every skipped Python test and #[ignore] Rust test across unrelated subsystems (CUDA scratch, Engram, GLM, DeepSeek, Qwen, Nemotron, Gemma 4), duplicating source #[ignore] strings and violating AGENTS.md:512-520 ("Do not create development audit reports, receipts, provenance bundles, or hash inventories"; keep docs/TODO.txt brief and durable).
    • helios/tests/fixtures/templates/muse_glimmer_nvfp4/chat_template.patch.json has zero readers anywhere in helios/tests/ (helios/tests/support/templates.rs:8), yet tests/frontend/prepare_templates.py:43 globs */*.patch.json (not opened) and will fetch original-el8/Muse-Glimmer-30B-NVFP4:chat_template.jinja from Hugging Face on every template-preparation run.
    • Fix: Revert the docs/TODO.txt hunk and delete helios/tests/fixtures/templates/muse_glimmer_nvfp4/chat_template.patch.json until a test consumes it.
  2. Resolve the wire tag-11 collision with open PR #483 (helios/proto/runtime_core.proto:487,624, helios/src/model/contract.rs:69).

    • Open PR #483 (Gemma 4 image preparation, no blockers at last review) claims ImagePreparationKind = 11 and ImageSettings.profile = 11, colliding with MUSE_GLIMMER_IMAGE_PREPARATION = 11 and ImageSettings.muse_glimmer = 11 (note: #483 reuses Bracketed = 9 and does not claim ImageLayoutKind = 11).
    • Fix: Coordinate merge order with #483; whichever lands second must renumber its ImagePreparationKind and ImageSettings.profile tags to 12 and regenerate runtime_core_pb2.py before exporting cores.
  3. Validate tokenizer token-ID agreement in ignition/preparation/frontend.py:151-166 and record a maintainer ruling on the #74 single-checkpoint exception.

    • frontend.py:160 asserts model["image_token_id"] == 200092 and video_token_id == 200091, while lines 164-166 emit literal strings "<|patch|>", "<|image_start|>", "<|image_end|>" and literal max_image_tokens=4096 (instead of image["max_image_tokens"]) without checking that the checkpoint tokenizer encodes "<|patch|>" to model["image_token_id"] (unlike _native_image_placeholder at frontend.py:222-236). If a checkpoint tokenizer disagrees, bracketed_prompt expands to the tokenizer's ID while VisionState injects on image_token_id, silently failing to inject image features.
    • Fix: Verify the three envelope markers encode as single tokens in the checkpoint tokenizer and that image_token matches model["image_token_id"] (and read max_image_tokens=image["max_image_tokens"]). Also confirm with a maintainer that the single-checkpoint exception under #74 is granted given nvidia/Muse-Glimmer-30B-NVFP4's incompatible mixed FP8/W4A16 layout.

Subtract / Simplify

  1. Drop fixed-value wire fields from MuseGlimmerImageSettings (helios/proto/runtime_core.proto:627-636, helios/src/frontend/images/mod.rs:384-393, muse_glimmer.rs:27-63, runtime_core/{describe,protobuf}.rs, ignition/preparation/frontend.py:164-166): muse_glimmer::Processor::load (muse_glimmer.rs:39-40) rejects any patch_size != 14 or merge_size != 2, while WINDOW = 32 and TABLE_SIDE = 32 are already module constants (muse_glimmer.rs:20-22). Replacing patch_size and merge_size with const PATCH: usize = 14; const MERGE: usize = 2; shrinks the wire message before tags freeze (max_image_tokens, image_mean, image_std, and the envelope token strings are the fields that can legitimately vary).
  2. Merge identical match arms in helios/src/model/prompt.rs:53-58: Collapse Some(ImageLayoutKind::Bracketed) and Some(ImageLayoutKind::Windowed) into Some(ImageLayoutKind::Bracketed | ImageLayoutKind::Windowed) => crate::frontend::images::layouts::bracketed::prepare_input(frontend, processor, rendered, &images)?,.
  3. Avoid push-then-clear in ProcessedImages::append (helios/src/frontend/images/record.rs:27-40): Guard on if !images.cu_window_seqlens.is_empty() with let window_offset = self.cu_window_seqlens.last().copied().unwrap_or(0); instead of pushing 0, extending nothing, and clearing on len() == 1.

Nits

Dropped on verification