Verdict: worth merging
This is my second pass. My first review (2026-11-24) said "worth it with changes" and listed six must-fixes. The author rebased onto main (27716185, head 2b4a31e9) and addressed all six, plus two "should fix" items. I re-verified each against the current head. Nothing blocking remains.
Charter fit
Right layer, not a per-model branch. Helios "shouldn't accumulate per-model branches" (#267, #334), but image preparation is an enumerated extension point, not an ad-hoc branch — docs/model-contract.md:226-227 (not opened): "Tool parsers, reasoning parsers, image preparation, and image layouts each have an independent enum selector." There are already eleven profiles, and the most recent (padded_grid) was added by maintainer Luke Alonso (8628b7c5). A twelfth profile is the sanctioned shape.
Not a new alias, and more than one checkpoint. Gemma 4 is already a supported family (docs/model-preparation.md:321 lists e2b/e4b/12b/26b-a4b/31b + NVFP4). The Ignition side now deliberately asserts only consumed fields (ignition/preparation/frontend.py:114-172) — model_type: gemma4 / vision_config.model_type: gemma4_vision — so all four serving variants pass while gemma4_unified (12B) is rejected. tests/preparation/test_frontend_gemma4.py:187-216 validates three real cached checkpoints (31B, 31B-NVFP4, E2B). The earlier 31B-only encoder pins are gone.
It fixes real bugs, which is the strongest argument. Two independent latent defects:
- A span-declaring
Bracketedimage failed per request. Onmain,layouts/bracketed.rsemitted nodata.spans, whilehelios/src/model.rs:441-451(ref=main) rejects any scoped token (feature_token/start_token/end_token) not inside a span →"image token spans do not match their declared boundaries". The PR's "Why" claim is accurate, not speculative. Fixed by emitting spans inlayouts/bracketed.rs:58-65(thedeepseek.rs(not opened) pattern), gated on the contract declaring a span, with envelope-marker validation on both ends. The sharedprompt.rsfallback block was deleted rather than patched. - Every cached MiniMax prepared-image record was being invalidated.
conditioned.rs:187-193(ref=main) ended_ => 588, soPatchMerge's 1176-wide patches never satisfiedvalid_processed, causing needless re-materialization per request. Now routed throughImageProcessor::patch_features()(mod.rs:459-471), fixing this forPatchMerge = 1176andPaddedGrid = 1200. A latent correctness/performance bug, found incidentally.
Wire changes are strictly additive — ImagePreparationKind value 11, ImageSettings tag 11, VisionCapacity.patch_features field 6 with #[serde(default)] (helios/build.rs:53-56), proto/runtime_core.proto:281,449,585,598. Existing cores stay loadable.
The six prior blockers, re-verified
- Protobuf downgrade — moot.
mainitself now carriesProtobuf Python Version: 7.36.1(I read the file atref=main). The PR's diff is descriptor-only. Separately,pyproject.toml:34still pinsprotobuf>=7.36.2,<8while main's own artifact says 7.36.1 — a pre-existingmaininconsistency, worth its own fix, not this PR's. - Hardcoded 4→1176 / 9→768 table — gone.
packing.rs:16-32is nowLEGACY_BRACKETED_PATCH_FEATURES,bracketed_patch_features(vision)(0 → legacy), andsquare_merge_side(ppf)viaisqrtwith an exact-square check. No model-identity branch. Single owner isImageProcessor::patch_features(), with a cross-profile consistency test over all 11 profiles (packing.rs:695-824) asserting processor width == tensor layout width. The MiniMax caveat the author raised is legitimate: temporal frame duplication means width genuinely isn't derivable from3·patch_size², so carrying it in prepared metadata is the right call. - Spans in shared code — moved and tested.
prompt.rsnow only passesimage_tokens.span.is_some(); emission lives in the layout.prompt.rs:1172-1281tests span-bearingBracketed(2 spans == conditioned input token spans, length 262, markers correct), 64-aligned chunk too small (256 →Err), and span-less MiniMax (spans empty). - Preparation doesn't validate what it later depends on — fixed. Envelope tokens now come from
tokenizer_config.json(not opened) and each is verified as a single atomic vocabulary token viatoken_to_idplusencode(..., add_special_tokens=False).ids == [id], cross-checked against optionalconfig.json(not opened) IDs; fails closed withouttokenizer_config/snapshot. 216 lines of pytest cover the negative cases (missing/empty/duplicate/unknown/multi-token/bool-ID). - Evidence not durable — fixed.
tests/frontend/gemma4_images.jsonplus its generator are checked in;gemma4.rs:266-333verifies SHA-256 of resized RGB bytes,pixel_values,position_ids, grid/tokens/patches andcu_seqlensunconditionally under plaincargo test, across 8 cases atmax_soft_tokens280 and 1120. Live-snapshot tests are now#[ignore]with real assertions instead of silentreturns. - Missing Ignition test and docs — fixed.
tests/preparation/test_frontend_gemma4.pyadded;helios/README.md:706-718,docs/runtime-core-design.md:181-196,helios/model-contract.md:82, and a protobuf round-trip test (protobuf.rs:813) all updated.
Load-time invariants also landed: gemma4::Processor::load enforces pooling² == patches_per_feature and max_soft_tokens·pooling² ≤ max_patches_per_image (gemma4.rs:25-52), and server::config::validate_loaded_image_processor (config.rs:443-489) checks patch width against vision.patch_features (with an actionable "re-export the core with vision.patch_features" error), plus max_image_envelope_tokens ≤ prefill_chunk_size and ≤ span.max_tokens — with 64-aligned boundary tests on both sides (1122 vs 1088/1152; span_max 1121/1122).
Costs
- Code: one new module
gemma4.rs(535 lines, half tests), ~250 lines elsewhere, one new 10-line generic branch inprepare_image_inputsand one inImageProcessor. - Maintenance: the recurring per-profile surface every existing profile carries.
packing.rsis simpler than before (a table replaced byisqrt+ metadata). - Performance: no serving-path cost — decode/resize/pack already run on the frontend pool. The
conditioned.rsconsolidation removes a per-request cache-invalidation bug, so net positive. - Risk: low. Additive wire, inert until a recipe selects it. One narrowing:
Bracketednow requires a positive-squarepatches_per_feature; MiniMax is the only in-tree user (ppf=4) and is unaffected, and the legacy 1176 width is preserved viapatch_features == 0, tested atpacking.rs:660-670.
Residual, non-blocking
- No export-or-serve proof from this branch. The charter's #74 asks to "prove they export and serve cleanly." End-to-end needs the companion recipe in
local-inference-lab/hyperflare-recipesdeclaringvision.patch_features = 768. This is acknowledged and tracked (docs/TODO.txt:330-337), and the author states it as a limitation. The profile is inert without a recipe, so landing it is safe — but the "serves cleanly" half of #74 is genuinely unmet at merge time and should be confirmed before anyone claims Gemma 4 vision works. docs/model-preparation.md:321listsgemma-4-12b, while the new image profile rejectsgemma4_unified12B. The text path is unaffected, so this is only confusing rather than wrong — one clarifying line would help.helios/tests/support/contracts/gemma4_frontend.json:16-17,38still hasimage_preparation/image_layout/image_tokens=null, so no in-repo contract fixture drives the full prepare→span→validate path end-to-end. The unit and contract tests cover the pieces individually.pyproject.toml:34vsmain's own 7.36.1 artifact — pre-existing, separate.
Is there a simpler way?
No. Ignition is Python and serves nothing at request time, so the HF Gemma4ImageProcessor can't be reused. The patch layout (interleaved (y, x, channel), (x, y) positions, 1/255 scaling, 16×16) genuinely differs from patch_merge's channel-planar 1176-wide temporally-duplicated patches; parameterising one profile for both would be more code, not less. The PR already takes the one real reuse opportunity (patch_merge::Envelope extracted, shared) and reuses resize::resize rather than adding a second resampler.
Bottom line
Worth merging. Every blocker from my first review is resolved with tests that run in CI, not on the author's machine. The change sits at the sanctioned extension point, keeps the wire additive, and — unexpectedly — fixes two independent latent defects: a per-request rejection for any span-declaring Bracketed core, and a per-request cache-invalidation bug for every MiniMax prepared image. The only real gap is that #74's "serve cleanly" half needs the companion recipe, which is correctly tracked rather than hand-waved.
One process note: the review bot on this PR (flare-autobot, 2026-11-24) requested the same three blockers I independently reached, and the author's 2026-11-25 reply addressed them accurately — I verified each claim rather than taking it at face value, and they held up.