PR #683: ignition: propagate CLI prog, move image specs to recipes, and harden state.py kernels

Raw Markdown for agents: https://autobot.eidonix.com/api/v1/cases/24ace7cb-0d23-4800-aa19-2d2c29a393dd

Opened by a workflow run, Dec 2, 2026 11:48 AM EST. decide malicious: all_clear (100%): No malicious content found

explore

Author: lukealonso (COLLABORATOR; charter-named priority contributor) — Discord: lukealonso Motivation: External recipe packs that ship their own CLI name (e.g. ignition-jetson) recorded ignition export … in their manifests, so the reproduction command was wrong; and core ignition still hardcoded recipe-specific image model_type strings, processor classes and token IDs. A third, separate part hardens five Triton row kernels against 32-bit offset overflow and writes to the reserved null slot 0. Scale: +406 / −148 in 8 files Proposal:

Full report · Notes

Value Proposition

Value Proposition — PR #683 (ignition: propagate CLI prog, move image specs to recipes, and harden state.py kernels)

1. Charter alignment: right direction, half-delivered

The prog fix and the removal of per-checkpoint model_type strings and literal token IDs (inkling2, qwen4_exp, 154854, …) from ignition/preparation/frontend.py directly serve "keep the runtime small and model-agnostic … shouldn't accumulate per-model branches (#267, #334)" and docs/design-review.md:42-46 principle 3. The active_prog/current_prog ContextVar plus the additive prog=None keyword on reproduction_arguments/from_plan extend the documented RecipeParameters contract (docs/preparation-development.md:11-43) without changing it, and are wire-compatible: no Rust reader — flare-cli/src/inspect.rs:453-472, heliopause/src/export/binding.rs:1107-1108, helios/src/runtime_core/preparation.rs:105-112 — assumes argv[0] == "ignition".

But "move image specs to recipes" is partial: IMAGE_PROFILES stays a closed 8-name frozenset (frontend.py:26-35) and _validate_image_payload still owns the payload schema, so a third-party recipe cannot add a profile without editing core. Bundling three unrelated changes (CLI, frontend, GPU kernels) with no shared code path also conflicts with "look for the smallest footprint in shared code" and makes the Triton half hard to review by qualified owners.

2. Novelty & status: genuinely additive, but blocking two open PRs

Nothing obsoletes or supersedes this. The hardcoded 'ignition' argv[0] is verified on main (rebuild_manifest.py:263), the 32-bit offset risk is real arithmetic, and the null-slot-0 default reinforces #659 without file overlap. However, #683 deletes the exact table that #483 (gemma4, rickybrent) and #229 (muse_glimmer, Raydius) extend — and the new extract: Callable[[Mapping, Mapping], dict] signature cannot express #483's need to open tokenizer.json/tokenizer_config.json. Landing first forces another core edit, recreating the coupling the PR removes.

3. Value vs maintenance cost

Strong: the prog change (small, unit-tested at tests/cli/test_parameters.py:362-368) and the allow_zero=False / dynamic memory_capacity guards (CUDA-tested, capacity bump without recompile). Weaker: the overflow claim has no export+serve evidence; the same-kernel gridDim.y TODO (docs/TODO.txt:366-367) is untouched; the frontend refactor is a hard TypeError break for external callers with undeclared new behaviour (requires_preprocessor, active rejection of non-empty payloads). Evidence is a self-reported 164 passed with zero CI checks on 70e84eba. The author is charter-named priority contributor (@lukealonso), so closing as low-value is precluded.

Verdict

Worth it with changes — split the state.py kernel hardening into its own PR; give ImageProcessorSpec.extract snapshot access (or land #483/#229 first); enumerate in-repo scatter_rows callers needing allow_zero=True; disclose who authored the Triton half (principle 14); and finish the profile-registry move or soften the stated goal.

Full report Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.

Classify intake

Selected: triage:review, bug, performance, enhancement, area:kernels, area:preparation

Threshold: 65%

Triage

Priority

Type

Area

Model

Apply Labels (Intake)

Applied: +triage:review, +bug, +performance, +enhancement, +area:kernels, +area:preparation

Subtraction and simplicity

Subtraction/Simplicity lens on PR #683. Verdict: the ignition/preparation/frontend.py half is over-built; the prog and state.py halves are lean and idiomatic. Four suggestions, no nitpicks.

S1 (high) — ImageProcessorSpec ships two overlapping mechanisms; nine declarative knobs have zero users. frontend.py:45-56 declares label, processor_fields, image_processor_key, image_processor_fields, image_processor_exact_keys, image_processor_optional_fields, size_fields, model_fields, model_types, vision_fields; frontend.py:209-241 consumes them in 33 lines of branching, then frontend.py:242 hands the same two mappings to extract. Grep shows no production user — only the declaration, image_settings, and the new test. Delete 45-56 and _qualified (138-139); reduce image_settings to isinstance guard + extract + payload call. ≈ −55 lines, one interface instead of ten. AGENTS.md:188-193 forbids configuration switches without a concrete requirement.

S2 (med-high) — the "recipe-owned" payload schema is still a closed core table as three near-identical branches (frontend.py:161-168, 169-183, 184-201) plus _EMPTY_IMAGE_PROFILES (frontend.py:37, 157-160). Collapse to a _PAYLOAD_FIELDS field→validator dict with one generic loop (~48 → ~20 lines); the frozenset disappears. Drop the tautological constant assertion at tests/preparation/test_frontend_spec.py:93; the real schema is helios/proto/runtime_core.proto:613-640.

S3 (medium) — prog= is dead on both public functions. rebuild_manifest.py:262-263 has no caller: serve.py:237/:338 call from_plan(model, plan), and the test uses active_prog (tests/cli/test_parameters.py:365-368). Delete the kwargs at :231 and :288, drop prog=prog, at :335, emit [current_prog(), 'export', ...].

S4 (low-med) — two knobs for one decision (frontend.py:55-56, 290-294); collapse to preprocessor: str | None = "preprocessor_config.json (not opened)".

Explicitly lean, do not change: registry.py:27-29,37-39,52-61 mirrors active_recipes exactly; state.py casts match sibling kernels and keeping SLOTS as the no-capacity fallback is justified because scatter_rows has no in-repo caller (out-of-repo ABI).

Open: are the knobs written against an existing external recipe? Who authored the Triton half? Will #483/#229 rebase onto the spec?

Full report · Notes

Correctness and contracts

PR #683's intent is sound and most code checks out (int64 casts complete across all five kernels, Proto wire format unchanged, no hot-path cost, honest disclosure of unrun checks), but four concrete defects block it as described.

  1. Blocker/Major — overflow fix unreachable. ignition/components/state.py:102-103 and :182-184 still launch (rows, cdiv(width,1024)); CUDA caps gridDim.y at 65,535, so any row > 64 MiB aborts the launch before indices reach 2^31 — the PR's own 115–215 MiB case. The open item is verbatim docs/TODO.txt:366-367 and is unmentioned. Fix by striding program_id(1) as state_transfer.py's _MAX_GRID_Y = 65_535 loop does.
  2. Major — validation moved from preparation to load. _validate_positive_int (frontend.py:142-145, used at :166-167, :180) accepts any positive int, while Helios requires position_side == 48 (helios/src/frontend/images/qwen.rs:22) and 4..=1024 max_tokens, min_pixels <= 64 MiB (deepseek_row_major.rs:14-16). main hardcoded these; now export succeeds on checkpoints flare run refuses, after a full GPU export.
  3. Major — prog is ContextVar-only. Both production from_plan calls omit prog= (ignition/cli/serve.py:237, :338); any handler invoked outside main() silently records ignition export again.
  4. Major — extract has no snapshot access (frontend.py:57, :242), so #483/gemma4 and #229/muse_glimmer cannot be expressed without another core edit; IMAGE_PROFILES and the payload schema also stay core-owned (frontend.py:26-35, 154-202).

Also: scatter_rows(allow_zero=False) now silently drops row-0 writes for existing external callers (state.py:198-203); the "12 Helios-ABI modules" claim is a pre-existing 13-name invariant (tests/preparation/test_core_boundary.py:11-25); empty-payload rejection and requires_preprocessor are undisclosed; no test covers the overflow precondition, three of five kernels, or an end-to-end main(prog=...) manifest.

Open: who authored the Triton half (design-review principle 14); whether #483/#229 will be rebased onto the spec; no evidence for the 115–215 MiB row sizes.

Full report · Notes

Final review

Recommendation: Changes Requested

The prog propagation and the five state.py Triton tl.int64 / dynamic memory_capacity / null-slot-0 kernel hardenings are technically sound, clean, and directly aligned with the core/recipe boundary. However, ignition/preparation/frontend.py regresses core Helios wire-contract validation on qwen and deepseek_row_major (allowing invalid payloads through full export to fail only at flare run), exposes a narrow extract(image, model) signature that cannot absorb in-flight PR #483 (gemma4) without another core edit, and scatter_rows has a minor CPU/CUDA validation mismatch plus an undocumented silent default change for 0-indexed external callers.

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

None.

Should Fix

  1. Enforce Helios's wire-level image payload bounds in _validate_image_payload (ignition/preparation/frontend.py:142-203).
    • Verified behavior/impact: On main, image_settings guaranteed position_side == 48 for qwen (main frontend.py:181) and min_pixels == 295936, max_tokens == 1024 for deepseek_row_major (main frontend.py:153-155). In this PR, _validate_positive_int accepts any positive Python int (including values exceeding Protobuf uint32/uint64 range), while Helios hard-rejects position_side != 48 and image_token_id == video_token_id in helios/src/frontend/images/qwen.rs:19-26 (with uint32 position_side at helios/proto/runtime_core.proto:645) and rejects !(4..=1024).contains(&max_tokens) or min_pixels > 64 * 1024 * 1024 in helios/src/frontend/images/deepseek_row_major.rs:13-21. A misconfigured recipe spec therefore passes preparation and full GPU export, failing only when flare run loads the core.
    • Fix: Validate in _validate_image_payload:
      • deepseek_row_major: 1 <= min_pixels <= 64 * 1024 * 1024 and 4 <= max_tokens <= 1024.
      • qwen: position_side == 48, image_token_id != video_token_id, and max_pixels < 2**64 (same uint64 bound on mimo max_pixels).
      • Add unit tests in tests/preparation/test_frontend_spec.py covering each rejection.
  2. Expose snapshot/tokenizer context to ImageProcessorSpec.extract so displaced profile PRs don't require another core edit (ignition/preparation/frontend.py:57, 205, 242, 277-295).
    • Verified behavior/impact: prepare_frontend already has snapshot and parses tokenizer_config.json (not opened) (frontend.py:277), yet image_settings calls spec.extract(image, model) with only the processor sub-dict and config.json (not opened). Open PR #483 (gemma4, pr/483 ignition/preparation/frontend.py:142-167) validates image envelope tokens (image_token, boi_token, eoi_token) against tokenizer_config.json (not opened) and snapshot / "tokenizer.json (not opened)". Landing extract with a 2-argument signature forces an immediate breaking change to ImageProcessorSpec when #483 rebases.
    • Fix: Either pass an optional context object/kwargs (e.g., snapshot and tokenizer_config) into image_settings / spec.extract, or settle the signature explicitly before companion recipe PRs adopt ImageProcessorSpec.
  3. Fix scatter_rows CPU/CUDA memory_capacity rank validation mismatch and document the silent allow_zero=False compatibility impact (ignition/components/state.py:175-189).
    • Verified behavior/impact: Line 176 accepts any tensor with memory_capacity.ndim >= 1 (e.g., shape (1, 2)), which works on CUDA (tl.load(MemoryCapacity) reads element 0) but crashes on CPU at line 186 (int(memory_capacity[0].item()) raises RuntimeError: a Tensor with 2 elements cannot be converted to Scalar). Additionally, changing scatter_rows's default to allow_zero=False silently drops row-0 writes for any un-updated external 0-indexed caller (unlike prepare_frontend, which raises TypeError); the PR's Compatibility & merge-order paragraph only warns about prepare_frontend / image_settings.
    • Fix: Require memory_capacity.ndim == 1 at ignition/components/state.py:176 (matching StateStorage.allocate's 1-D [backed_slots, 0] buffer at :89, or index via memory_capacity.reshape(-1)[0].item()), and explicitly note in the PR Compatibility section that external 0-indexed scatter_rows callers (e.g. KV page tables) must pass allow_zero=True in the companion recipe PRs.

Subtract / Simplify

  1. Collapse requires_preprocessor + default_preprocessor into one knob (ignition/preparation/frontend.py:55-56, 290-294).
    • requires_preprocessor: bool = True and default_preprocessor: str = "preprocessor_config.json (not opened)" split one decision ("which snapshot file to read, or none") across two fields, allowing contradictory states (e.g., requires_preprocessor=False with a custom filename). Replacing both with default_preprocessor: str | None = "preprocessor_config.json (not opened)" (where None skips reading a file and uses {} when preprocessor is None) simplifies the spec and the if/else at frontend.py:290-294.
  2. Table-drive _validate_image_payload and remove _EMPTY_IMAGE_PROFILES (ignition/preparation/frontend.py:37, 154-202).
    • The three non-empty branches repeat identical expected_keys / set(payload) != expected_keys boilerplate alongside a separate _EMPTY_IMAGE_PROFILES frozenset (:37). A small profile→field-validator table (with absent profiles defaulting to {}) eliminates _EMPTY_IMAGE_PROFILES and makes adding the Helios bounds from Should Fix #1 and future profiles concise. (Also consider whether all 9 declarative ImageProcessorSpec validation fields at :46-54 are strictly needed by the companion recipe PRs or whether a smaller core spec + shared _expected helper would be cleaner.)

Nits

Dropped on verification

Full report

Classify triage

Selected: triage:review

Threshold: 65%

Triage

Apply labels

No label changes Decision to Test: no (100%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.