Correctness scratchpad · NVIDIA/hyperflare-inference #533

Raw Markdown for agents: https://autobot.eidonix.com/p/f94a9c4b-7ade-43bb-bbf0-e31b77a66065.md

#1 [high] Blocking: --request-context is silently ignored on multi-host export

ignition/cli/serve.py:193-206: _export_hosts calls planning.plan(...) with the full flag set but ends at row_shard_prefill=args.row_shard_prefill) — no context=args.request_context, while the same PR added it at serve.py:289 (_prepare), serve.py:472 (debug_serve) and bench.py:177.

Effect: ignition export MODEL --ranks 2 --request-context 131072 accepts the flag and prepares at the recipe max context with no warning; the KV-pool saving the PR is about never happens. The charter ("Don't silently ignore API fields", charter line 13) and AGENTS.md:452-456 make a silently accepted setting a defect. Fix: pass context=args.request_context in the _export_hosts plan() call (and check args carries the attribute for that subcommand — _preparation_arguments is shared by export, so it does).

#2 [high] Blocking: capped context is not page-aligned, so the exported core fails to load in Helios

ignition/planning.py:368-373 Plan.prepared_context returns min(recipe.context, context_target, tokens). fit() validates only context > 0 (planning.py:459-460) and plan() validates only the prefill chunk (planning.py:694-700). Nothing requires the result to be a multiple of the page size.

ignition/preparation/bootstrap.py:58 now puts that value into the preparation config as context, which becomes the core's max_sequence_tokens; Helios reads it as prepared_sequence_tokens (helios/src/server/config.rs:131-148) and helios/src/model/catalog.rs:44-71 rejects a core unless BOTH prepared_sequence_tokens and limits.max_sequence_tokens are multiples of page_tokens ("invalid prepared model configuration").

So ignition export MODEL --request-context 200000 with a 128-token page (MiniMax M3.1 Flash page_tokens=128, per tests/server/test_minimax_m3_cache.py:110; fixture recipes use 64/128) prepares and exports happily, then flare run CORE fails at load with an opaque configuration error. 200000/128 = 1562.5. Fix: round the target down (or reject it) to a multiple of page_tokens in fit()/Plan.__post_init__, and say so in the error message, e.g. "--request-context 200000: must be a multiple of the 128-token page".

#3 [high] Should fix: the cap is invisible in the printed plan and in reproduction arguments

ignition/planning.py:389-442 Plan.to_dict() reports "context": self.context (stock: min(recipe.context, tokens)) and "checkpoint_context": self.recipe.context, but never prepared_context/context_target. ignition/cli/serve.py:215,485 and bench.py:182 print plan.to_dict() as the plan report, so a capped export prints a plan identical to an uncapped one.

Likewise ignition/preparation/rebuild_manifest.py:231-318 reproduction_arguments() emits no --request-context, and from_plan() (rebuild_manifest.py:343-395) records no key for it. AGENTS.md:452-456 requires an advanced flag be "carried through the plan into the recipe's PreparationConfig, so the plan, its printed report, and its recorded measurements describe what was prepared"; docs/runtime-core-design.md:372,452 make reproduction_args the reproduction contract rendered by flare inspect.

Effect: flare inspect prints an ignition export command that reproduces the uncapped 256K core, not the 128K core that was shipped, and neither the printed plan nor the manifest shows the cap. Fix: emit the capped value in to_dict (e.g. a prepared_context/request_context key) and add if plan.context_target is not None: args.extend(['--request-context', str(plan.context_target)]) plus a request_context deployment-scope parameter in from_plan.

#6 [high] Research summary

Reviewed PR #533 (cap the per-request context) through the correctness lens: read the full diff, then the changed functions in context (planning.py Plan/fit/plan, bootstrap.py's common_preparation_kwargs, all four CLI entry points, bench's Settings/BenchmarkSelection) and followed the value into Helios (server/config.rs, model/catalog.rs, model.rs fit_context) and into the export/reproduction paths (rebuild_manifest.py). Four confirmed findings plus verification notes are in the scratchpad:

  1. Blocking — _export_hosts (serve.py:193–206) never forwards context=args.request_context, so ignition export --ranks N --request-context N silently ignores the flag: no error, no cap, no KV saving. This contradicts the charter's "don't silently ignore API fields" rule and the AGENTS.md rule that an advanced flag be carried through the plan.
  2. Blocking — prepared_context = min(recipe.context, target, tokens) is never required to be page-aligned, yet it becomes the core's max_sequence_tokens, which Helios rejects at load unless it is a multiple of page_tokens (catalog.rs:44–71). A cap such as 200000 with a 128-token page exports fine and then fails to load in flare run.
  3. Should fix — Plan.to_dict() and rebuild_manifest.reproduction_arguments()/from_plan() record nothing about the cap, so an export prints a plan identical to an uncapped one and flare inspect reproduces the wrong (256K) core; AGENTS.md and the runtime-core design doc both require the opposite.
  4. Should fix — bench's required_context check (planning.py:248) compares against the stock Plan.context, so a --contexts list above the cap passes planning and only fails in the runner after the whole GPU preparation and graph capture.

Nit: a target above the recipe max is clamped silently, with no notice, though the docs describe the flag as a cap below that maximum. Nothing else surfaced in the changed code; the no-flag path does look byte-equivalent to stock.

#9 [high] Research summary

Verdict: blocking (two defects in the test this PR adds; the earlier code blockers are fixed, and two nits remain). Time ran out before I could write these to the scratchpad, so they are recorded here in full.

Fixed since my last review (verified in code at head de1b5b5)

Blocking: the added test cannot pass — tests/cli/test_planning.py:229-232 contradicts the new validation

The test plans with context=500000 and asserts a plan with prepared_context == min(recipe.context, oversized.tokens). The fixture recipe has page_tokens=64 and RankCosts.page_tokens is unset, so Plan.page_tokens == 64 (planning.py:329-332), and 500000 % 64 == 32. Plan.__post_init__ (planning.py:289-290) therefore raises UsageError("--request-context 500,000 is not a multiple of the 64-token page size"), and the assertion never runs. Fix: use an aligned over-size target (e.g. 524288, which is 64 × 8192) for the clamp case, and keep a separate unaligned value for the rejection case. Note the behavioural consequence of validating the raw target rather than prepared_context: a target above recipe.context/tokens is rejected when unaligned even though it clamps to an aligned value and changes nothing — worth deciding explicitly (accept, floor, or reject) and saying so in the docs row at docs/cli-design.md:446.

Blocking: the manifest assertion names a field that does not exist — tests/cli/test_planning.py:257

assert by_key["context_target"].value.int64_value == 131072 — PreparationValue has int_value = 2 and uint_value = 3 (helios/proto/runtime_core.proto:124-133), and _preparation_value() writes non-negative ints as uint_value (ignition/preparation/rebuild_manifest.py:333). Python protobuf exposes only the declared names, so int64_value raises AttributeError; even with the name corrected to int_value the assertion would read 0 because the oneof holds uint_value. Fix: assert by_key["context_target"].value.uint_value == 131072 (matching tests/preparation/test_native_publication.py:78 (not opened)).

Both failures are plain-arithmetic/name facts, so pytest tests/cli/test_planning.py settles them; the PR head has no CI checks, which is presumably why they were not seen.

Nits

No other caller, configuration, or persisted-state interaction turned up in this lens: derive()/fit()/plan() are the only Plan constructors, Plan is frozen so the new defaulted field cannot break existing construction, replace() in the CLI paths preserves the cap, multi-host peers receive the prepared config from rank zero, and Helios reads the cap only through the existing max_sequence_tokens / limits path.

#10 [high] Blocking: the PR's new test cannot pass — clamp case violates the new page-multiple validation

Verified at head de1b5b5 on PR #533.

tests/cli/test_planning.py:229-232:

    # Clamp: target > recipe max -> prepared_context == min(recipe.context, tokens)
    oversized = planning.plan(recipe, recipe.checkpoints[0], gpus, context=500000, **base)
    assert oversized.context_target == 500000
    assert oversized.prepared_context == min(recipe.context, oversized.tokens)

#12 [high] Blocking: derive() has no context parameter — NameError/TypeError breaks export, debug-serve, bench

HEAD 02023eba. ignition/cli/preparation.py:45-56 — derive(...) signature lists gpus, concurrency, speculation, prefill_chunk, context_parallel, context_parallel_size, stream_overlap, roce_ring, roce_chain, mixed_prefill, prompt_logprobs, expert_scale_compression, online_mxfp8, online_mxfp8_scope, language_model_only, compile_workers, tuning_gpus, autotune_effort, image_concurrency, mla_compute_mode, lock_gpu_clocks, native_dense_activations, shard_hyperconnections, row_shard_prefill, row_shard_attention, force_moe_decode_a16. There is NO context parameter (grep context: int|^context|context = in that file: no match).

But :69 (inside derive, in the planning.plan(...) call) reads row_shard_attention=row_shard_attention, context=context) — context is an undefined name, so derive() raises NameError whenever it is reached. And its callers pass context=args.request_context, which is an unexpected keyword → TypeError:

So every preparation command is broken at this head regardless of whether the flag is used, and tests/cli/test_commands.py:88,114 (preparation.derive(...)) fail with NameError too. Diff context: preparation.py hunk only changed :69, adding context=context — the parameter was never added (diff shows row_shard_attention=row_shard_attention, context=context) as the only change in that file, +1/-1).

Fix: add context: int | None = None to the derive signature (threading it to planning.plan(..., context=context)). Blocking: no CI checks ran on the head.

#13 [high] Blocking: the page-multiple validation the test expects does not exist at head; test's two assertions still fail

HEAD 02023eba, tests/cli/test_planning.py:211-254 (test_request_context_target_prepared_context_and_manifest).

(a) Page-multiple validation is absent from the code. Repo-wide grep for multiple of the matches ONLY tests/cli/test_planning.py:239; page size matches nothing in ignition/. In ignition/planning.py the only context_target uses are :186 (field), :260 (bench compare), :379-381 (prepared_context), :438 (to_dict), :549 (context_target=context); the only alignment-ish check is the prefill-chunk % 64 at :635. Plan.__post_init__ (:224-296) contains no context_target validation, and fit (:467-468) only rejects context <= 0. → with pytest.raises(UsageError, match="multiple of the") at :239-240 fails ("DID NOT RAISE"), so the new test still cannot pass. The clamp case at :230 then runs: min(262144, 500000, tokens) = 262144 = min(recipe.context, tokens), so :231-232 would pass. → The PR description ("a page-multiple validation") and the test's "Valid target/non-page-multiple target rejected" comments do not match the code. → Real consequence of the missing check: --request-context 100 (or any non-multiple of Plan.page_tokens) exports a core whose max_sequence_tokens = 100; helios/src/model/catalog.rs:50-57 rejects a core unless both prepared_sequence_tokens and limits.max_sequence_tokens are multiples of page_tokens (is_multiple_of), so the export succeeds and the core fails to load at serve time. Note prepared_context = min(recipe.context, target, tokens) — tokens (pages*page_tokens) and recipe.context are aligned, so the check belongs on min(self.recipe.context, self.context_target) % self.page_tokens (an over-max target then still resolves to the aligned recipe max, matching the documented clamp).

(b) tests/cli/test_planning.py:254 — by_key["context_target"].value.int64_value. helios/proto/runtime_core.proto:124-133 declares PreparationValue{bool_value=1, int_value=2, uint_value=3, float_value=4, string_value=5, list_value=6}; there is no int64_value field → AttributeError. Even with the right name, ignition/preparation/rebuild_manifest.py:329-333 _preparation_value writes non-negative ints as uint_value, so int_value would read 0. Fix: assert .value.uint_value == 131072.

#14 [high] Correctness lens, head 02023eba: what is fixed, nits, verified-clean

HEAD 02023eba (all verified in the code).

FIXED since my last round (do not re-raise):

NITS remaining (each verified):

  1. ignition/cli/serve.py:68 max_body_bytes still sizes the HTTP body from recipe.context, and :69 context_hint says "context is limited by the checkpoint and available cache capacity". With a cap, both overstate the served ceiling (a body accepted for a prompt the engine rejects at admission). Use plan.prepared_context.
  2. ignition/cli/help.py:38 advertises --prefill-chunk-size: 64..{recipe.context}, a range above the effective bound once capped.
  3. docs/cli-design.md:1443 says "The checkpoint maximum" while the new row (:446) and :1493 say "the recipe's maximum"; and while the docs/helptext call it a cap below the recipe maximum, a target above the maximum is silently clamped with no notice (planning.py:381).
  4. ignition/cli/init.py:167-168 helptext says "cap the prepared context and max_sequence_tokens at N tokens" without stating the alignment requirement (which the code currently does not enforce at all — see the blocking note).

Verified-clean through this lens: Plan frozen + context_target default None keeps every existing Plan(...) construction valid (only planning.py:535 constructs it); derive's other call sites in tests; bench Selection validation (selection.py:76-77 required_context) uses the prepared context now; helios/src/model.rs:268-272 narrows max_sequence_tokens to the pool, catalog.rs:26-71 validates the load.

#15 [high] Research summary

Reviewed PR #533 at head 02023eba through the correctness lens: read the full diff, then each changed function in context (planning.py Plan/prepared_context/fit/plan, bootstrap.py, rebuild_manifest.py, serve.py and bench.py call sites, the new test) plus the consumers in Helios (model.rs fit_context, model/catalog.rs load validation, proto schema).

Verdict: blocking. Three defects, two of them new this round:

  1. derive() has no context parameter (ignition/cli/preparation.py:45-56) yet line 69 passes context=context (undefined name → NameError) and all four callers pass context=args.request_context (TypeError): serve.py:207, serve.py:291, serve.py:476, bench.py:177. Every preparation command is broken at this head with or without the flag, and tests/cli/test_commands.py:88 (not opened),114 fail too. The diff for that file is +1/−1: the call site was updated, the signature was not.
  2. The page-multiple validation the test asserts does not exist. Repo-wide, multiple of the occurs only in the test (tests/cli/test_planning.py:239); Plan.__post_init__ has no context_target check and fit only rejects <= 0. So the new test's pytest.raises fails, and the unguarded path ships a core whose max_sequence_tokens is unaligned — which helios/src/model/catalog.rs:50-57 rejects at load, i.e. long after export.
  3. tests/cli/test_planning.py:254 reads value.int64_value, a field that does not exist (proto declares int_value/uint_value), and _preparation_value writes non-negative ints as uint_value (rebuild_manifest.py:329-333), so even the right name would read 0.

Fixed since my last round and verified in the code: the flag reaches all four entry points, to_dict/printed plan line/reproduction args/manifest scope, bench compares against prepared_context, and omission is byte-equivalent to main. Remaining nits: serve.py:68-69 still sizes the body and the context hint from recipe.context; help.py:38 (not opened) advertises a chunk range above the effective bound; docs:1443 says "checkpoint maximum" where the new row says "recipe's maximum", and an over-maximum target is silently clamped with no notice. Details in scratchpad entries #12-14.

#16 [high] Report input: verdict, settling checks, and description-vs-code mismatches (head 02023eba)

Verdict for PR #533 at head 02023eba: blocking (3). No CI checks on the head; nothing was executed in this environment, so every claim below is a static reading of the code and one grep settles each.

BLOCKING 1 — derive() has no context parameter.

BLOCKING 2 — the page-multiple validation does not exist.

BLOCKING 3 — tests/cli/test_planning.py:254 reads a nonexistent proto field.

DESCRIPTION vs CODE (worth one line in the report; the description is material, not instruction):

Rule basis cited: charter line 42 (check compatibility across supported targets, state and graph transitions, and that existing artifacts still load — blocker 2 is exactly a load-time incompatibility); charter line 13 / AGENTS.md "don't silently ignore" (a flag that errors out on every command, and a documented validation that does not exist).

#17 [high] Correction to entry #10: the clamp case now PASSES; do not repeat the old 500000 claim

Entry #10 and #11 recorded that tests/cli/test_planning.py:230 (context=500000 on a 64-token page fixture) would be rejected by a new page-multiple validation, so the clamp assertions never ran. That is no longer true at head 02023eba: there is no such validation anywhere in ignition/ (see entry #13). planning.plan(..., context=500000) therefore succeeds, context_target == 500000 (:231) and prepared_context == min(262144, 500000, tokens) == min(262144, tokens) (:232), so the clamp case passes and is the one part of the new test that works.

Consequence for the report: the blocking item is the missing validation (test assertion at :239 is what fails), not a spurious rejection. The earlier "500000 % 64 == 32 is rejected" reasoning should not be repeated.

#19 [high] Blocking: above-maximum --request-context is rejected, not clamped; the PR's own test fails

Head 9118addd.

ignition/parameters.py:1309-1321 declares context_target with min_value=1, max_fn=_recipe_context_limit, and _recipe_context_limit (:1268-1269) returns context.recipe.context. ParameterGroup.validate_fields (:522-545) raises when a value exceeds a resolved max: "… must be 1 through {max}". RecipeParameters.validate calls validate_fields (:1440-1463), and Plan.__post_init__ calls self.parameters.validate(...) first (ignition/planning.py:184-190), as does fit (:456).

Consequence 1 (test fails): tests/cli/test_planning.py:310-313 builds replace(base_params, context_target=500000) on a recipe with context=262144 (fixture, :139) and asserts oversized.prepared_context == recipe.context. planning.plan reaches fit → params.validate → UsageError "--request-context for fixture-alias must be 1 through 262,144", so the assertion never runs. The clamp branch in Plan.prepared_context (planning.py:363, min(self.recipe.context, target)) is therefore unreachable through any validated path, since validate always runs before it.

Consequence 2 (doc/description vs code): docs/cli-design.md:468 says "--request-context N … resolves to the smaller of N and the recipe maximum", and the PR description repeats "min(recipe.context, N) otherwise" and "a cap above the pool still shrinks the export artifact…" — but the flag actually rejects N above the recipe max instead of resolving to it.

Fix: pick one. Either drop max_fn=_recipe_context_limit (keeping min_value=1) so N > recipe max clamps as documented and the test passes, or keep the bound and change tests/cli/test_planning.py:310-313 plus docs/cli-design.md:468 to say values above the recipe maximum are rejected. Settling command: pytest tests/cli/test_planning.py -k request_context.

#20 [high] Blocking: a cap below the recipe's prefill chunk exports a core Helios refuses to load

Head 9118addd.

ignition/planning.py:594-596 still compares the chunk against the stock context:

if params.prefill_chunk > result.context:      # result.context == min(recipe.context, tokens)
    raise UsageError(f"--prefill-chunk-size … exceeds the {result.context:,}-token context …")

and RecipeParameters.validate only bounds the chunk by the recipe context (ignition/parameters.py:1457-1462: 64 <= self.prefill_chunk <= ctx.recipe.context). Neither knows about context_target.

Preparation then hands plan.prepared_context to every recipe (ignition/preparation/bootstrap.py:132, "context": plan.prepared_context), which becomes the exported core's max_sequence_tokens, and Helios requires prefill_chunk_size <= max_sequence_tokens:

Reproduction from documented defaults: Qwen3.8-27B's recipe chunk is 4096 (docs/cli-design.md:244), and --request-context 2048 is legal (page-aligned, >= 1, <= recipe max). The plan check compares 4096 against result.context (e.g. 262144), passes, the export succeeds, and flare run rejects the core with the prefill error. Same for --request-context 64/128/… below the chunk.

Fix: in planning.plan (and/or Plan.__post_init__), compare the chunk against min(plan.context, plan.prepared_context) and name the cap in the message — e.g. --prefill-chunk-size 4096 exceeds the 2048-token context --request-context allows. Note the bench check was already moved to prepared_context (planning.py:212), so this is the one remaining stock-context comparison in the same file.

Settling command: pytest tests/cli/test_planning.py plus a unit assertion that planning.plan(..., parameters=replace(base, context_target=2048)) raises for a recipe with prefill_chunk=4096.

#21 [high] Nits and verified-clean paths, head 9118addd

Head 9118addd (also true at 02023eba).

  1. ignition/cli/serve.py:67 now sizes max_body_bytes from plan.prepared_context, but ignition/cli/help.py:46 still prints Context: {recipe.context:,} tokens (page size: {recipe.page_tokens}) for MODEL --help, and docs/cli-design.md:468's row is the only place --request-context bounds the chunk. When the cap is set, the dynamic help advertises an uncapped context and an uncapped --prefill-chunk-size upper bound that preparation then rejects (see the chunk/cap finding). Fix: not fixable from help alone (help is recipe-static and has no plan), so at minimum keep --request-context's own help text saying the cap also bounds --prefill-chunk-size.

  2. ignition/planning.py:395-396: to_dict() records "context": self.context (still min(recipe.context, tokens), the stock pool-derived bound) and "checkpoint_context": self.recipe.context, but nothing records prepared_context — the value now actually exported as max_sequence_tokens. The {"plan": …} JSON printed by export/debug-serve/bench (serve.py:204,433, bench.py:194) therefore cannot show the served context. Fix: add "prepared_context": self.prepared_context to to_dict. (context_target itself does appear via parameters.to_dict, so the cap value is recorded; the effective per-request context is not.)

  3. ignition/parameters.py:1320 help text says the cap "must be a multiple of the page token count", but page size is world-size dependent (Plan.page_tokens at planning.py:324-325 via adjust_page_tokens), and the check lives in Plan.__post_init__ (:186-190) rather than beside the other plan() flag checks (contrast prefill_chunk's check at :1457). Behaviour is correct; the split just means --request-context alone can pass validation in resolve_parameters and fail later in planning. Nit.

  4. ignition/preparation/rebuild_manifest.py:270-283 _preparation_value writes non-negative ints as uint_value; the new test only asserts scope (tests/cli/test_planning.py:329), so it does not cover the value field. Nit.

  5. tests/cli/test_planning.py:300-303 calls the uncapped plan "stock" without defining it.

Verified clean at this head: prepare/resolve_parameters funnel (ignition/cli/preparation.py:45-59) now has no undefined context — the old blocker is genuinely gone; derive (:62-81) takes parameters=; common_preparation_kwargs (bootstrap.py:123-137) passes plan.prepared_context as the single seam; the page-multiple validation now exists (planning.py:186-190) with the "multiple of the" wording the test matches; repro_always=True makes --request-context appear in reproduction_args (parameters.py:1519-1520), which the test asserts; omitting the flag leaves prepared_context == recipe.context (planning.py:361-362), byte-identical to main.

#22 [high] Research summary

Reviewed PR #533 at head 9118addd through the correctness lens: full diff, then each changed function in context (planning.py Plan/prepared_context/plan/fit, parameters.py RecipeParameters validate/reproduction_args/manifest_parameters, bootstrap.py, serve.py, rebuild_manifest.py, the new test) and the Helios side each value reaches (scheduler.rs validate_prefill, model/catalog.rs, model.rs fit_context, server/config.rs).

The previous round's three blockers are genuinely fixed: derive() takes parameters=, the page-multiple validation exists in Plan.__post_init__ with the "multiple of the" wording the test matches, and the test no longer reads a nonexistent proto field. Two new blockers, both about the interaction of the new cap with other validated bounds:

  1. --request-context above the recipe maximum is rejected, not clamped — parameters.py:1309-1321 sets max_fn=_recipe_context_limit, validate_fields (:522-545) raises, and Plan.__post_init__/fit run that validation before prepared_context is ever computed. So the PR's clamp branch (planning.py:363) is unreachable and tests/cli/test_planning.py:310-313 (context_target=500000 on a 262144-token fixture) fails. It also contradicts docs/cli-design.md:468 and the PR description, which both say the flag resolves to the smaller of N and the recipe maximum.

  2. A cap below the recipe's prefill chunk exports a core Helios refuses to load. planning.py:594-596 still compares the chunk to the stock result.context, and parameters.py:1457-1462 bounds it only by the recipe context; but preparation hands plan.prepared_context to recipes as max_sequence_tokens (bootstrap.py:132), and helios/src/scheduler.rs:66-77 (called from model/catalog.rs:42) requires prefill_chunk_size <= max_sequence_tokens. With the documented Qwen3.8-27B chunk of 4096, --request-context 2048 is accepted and the export succeeds, then flare run rejects the core. The bench check in the same file was already moved to prepared_context (:212), so this is the one remaining stock-context comparison.

Nits (recorded with lines): cli/help.py:46 (not opened) still advertises the uncapped recipe context and chunk bound; Plan.to_dict records context and checkpoint_context but never prepared_context, so the printed plan JSON cannot show the served context; the page-multiple check lives in Plan.__post_init__ rather than beside the other flag checks; the test asserts manifest scope only, not the value field. Omitting the flag is byte-equivalent to main, and the common_preparation_kwargs seam is the right shape.

Full detail is in scratchpad entries #19-#21; the run is also reflected in the note history from prior rounds.

#23 [high] Report input, head 9118addd: verdict, settling checks, stale-entry index

Verdict at head 9118addd: blocking issues (two). Written from entries #19-#21; do not re-report anything in entries #1-#18 — they review earlier heads.

Blocking 1 — above-maximum --request-context is rejected, not clamped; the PR's own test fails.

Blocking 2 — a cap below the recipe prefill chunk exports a core Helios refuses to load.

Nits (details in entry #21): cli/help.py:46 uncapped context/chunk bound in MODEL --help; Plan.to_dict (planning.py:395-396) has no prepared_context key so the printed plan JSON cannot show the served context; the page-multiple check sits in Plan.__post_init__ (:186-190) instead of beside the other flag checks; the new test asserts manifest scope but not the value field (uint_value at rebuild_manifest.py:270-283).

Verified clean at this head (entry #21): resolve_parameters/derive funnel intact (cli/preparation.py:45-81), common_preparation_kwargs seam, page-multiple validation present with the expected wording, repro_always=True puts --request-context in reproduction_args, and no flag ⇒ prepared_context == recipe.context (byte-equivalent to main).

Superseded prior entries (do not repeat): #1 (multi-host flag dropped — _export_hosts now calls resolve_parameters(..., multi_host=True)), #2/#5/#10/#13 (no page validation — it exists now), #3 (manifest/repro silence — repro_always and manifest_key now cover it), #12 (missing derive(context=) — gone), #17 (old 500000 claim — re-evaluated as blocker 1 above, on a different ground).

#25 [high] Research summary

Correctness review — PR #533 "Cap the per-request context", head e6239855

The three blockers I raised at the previous head (9118addd) are fixed at this head and are not repeated: max_fn=_recipe_context_limit is gone so the clamp branch is live, reproduction_args hand-emits --request-context, plan() bounds the prefill chunk by min(result.context, result.prepared_context), and _export_hosts now receives parameters resolved from args so the multi-host path sees the flag. One new blocking defect in the added test, and one behaviour regression I can show in the code.

Blocking

tests/cli/test_planning.py:295-329 — the new test calls rebuild_manifest.from_plan without stubbing source_identity. from_plan (ignition/preparation/rebuild_manifest.py:286, used at :312) calls source_identity(), which imports flare_heliopause, requires FlashInfer's native sources and raises RuntimeError when flashinfer is absent (ignition/preparation/source_identity.py:39-41, :78-81). Every sibling test that reaches from_plan stubs it — test_planning.py:159, :223, :333 and test_parameters.py:296 (not opened) all do monkeypatch.setattr("ignition.preparation.source_identity.source_identity", lambda: "test-source"). The new test takes monkeypatch and never uses it, so pytest tests/cli/test_planning.py fails in any environment without FlashInfer/native build (head has no CI checks, so this was not observed). Fix: add the same one-line monkeypatch.setattr at the top of the test.

Should fix

ignition/planning.py:212 — the bench context check got looser on the uncapped path. It was selection.required_context > self.context, where context = min(recipe.context, tokens) (planning.py:353-355); it is now > self.prepared_context, which with no cap equals recipe.context (planning.py:361-362) and is therefore ≥ the old bound whenever the KV pool cannot hold the full recipe context — the common case. A bench --contexts list that exceeds the pool-derived context now passes planning and fails only after the full GPU download, tuning and graph capture, at ignition/bench/runner.py:388 ("benchmark case exceeds prepared capacities"). The fix is the same shape the chunk check already uses at planning.py:594: compare against min(self.context, self.prepared_context).

ignition/planning.py:395-396 — to_dict() still records no served context. It reports "context": self.context (stock, pool-derived) and "checkpoint_context": self.recipe.context, but not prepared_context, so the {"plan": …} JSON printed by export (serve.py:206, :435) and bench (bench.py:194) cannot show the value actually exported as max_sequence_tokens. The raw target does appear via parameters.to_dict.

ignition/parameters.py:1318 — status_label reports the raw target, not the effective context. With --request-context 500000 on a 262144-context recipe the "Select GPUs" line (serve.py:270-274 → parameters.py:1555-1560) prints "request context 500,000 tokens" while the served context is 262,144. The label only receives the value, so this needs to move to Plan (or clamp in the label against the recipe maximum).

Nits

Verified clean

prepared_context is exact no-flag equivalent (recipe.context, the value common_preparation_kwargs passed before); the clamp and the oversized (500000) case now work because the page-alignment check is gated on target <= self.recipe.context (planning.py:187) — an above-maximum, unaligned target resolves to the aligned recipe context; min_value=1 yields "--request-context must be a positive integer" and :100 % 64 yields "…not a multiple of the 64-token page size", matching both pytest.raises patterns; manifest_key/DEPLOYMENT scope and the reproduction-arg emission match the test's assertions; serve.py:67-70 sizes max_body_bytes from the cap and names it in context_hint only when active; the Helios side is coherent — catalog.rs:42,49,54-57, scheduler.rs:66-77 and model.rs:268 (fit_context = min(prepared, pages × page)) mean a cap cannot make the exported core invalid now that chunk ≤ cap is enforced at export.

Nothing in the PR text attempted to direct my behaviour. Settling checks: pytest tests/cli/test_planning.py -k request_context for the blocking item; a plan whose tokens < recipe.context plus a bench selection above it for the regression.

#26 [high] Report of 2026-11-27, run ~1500 — head e6239855: verdict, findings, verified-clean

Correctness review — PR #533 "Cap the per-request context", head e6239855 (commit message "Cap the per-request context", pushed 2026-11-26)

Verdict: blocking (one blocking defect, in the PR's own new test)

Supersedes entry #24 (head 9118addd). All three old blockers are FIXED at this head and must not be repeated:

Blocking

tests/cli/test_planning.py:295-329 — the new test calls rebuild_manifest.from_plan (line 323) without stubbing source_identity. from_plan → reproduction_arguments/from_plan call source_identity() (ignition/preparation/rebuild_manifest.py:286, :312, imported :290). source_identity() imports flare_heliopause, requires FlashInfer's native sources, and raises RuntimeError when flashinfer is missing (ignition/preparation/source_identity.py:39-41 for the import check; :78-81 for FlashInfer native source directory is unavailable). Every sibling test that reaches from_plan stubs it: tests/cli/test_planning.py:159, :223, :333 and tests/cli/test_parameters.py:296, all with monkeypatch.setattr("ignition.preparation.source_identity.source_identity", lambda: "test-source"). The new test takes monkeypatch as a parameter and never uses it — a tell that the stub was dropped. Head has no CI checks (PR state: "CI on the head commit: no checks"), so this was not observed. Fix: one line at the top of the test, identical to :223.

Should fix

  1. ignition/planning.py:212 — the bench check got looser on the uncapped path. Was selection.required_context > self.context (context = min(recipe.context, tokens), planning.py:353-355); now > self.prepared_context, which with no cap returns recipe.context (planning.py:361-362) and is therefore >= the old bound whenever the KV pool is smaller than the recipe maximum — the common case. A bench --contexts list above the pool-derived context passes planning and fails only after download + tuning + graph capture, at ignition/bench/runner.py:388 (benchmark case exceeds prepared capacities). Fix mirrors planning.py:594: compare against min(self.context, self.prepared_context).

  2. ignition/planning.py:395-396 — to_dict() records no served context. Reports "context": self.context (stock) and "checkpoint_context": self.recipe.context, never prepared_context. The {"plan": …} JSON printed by export (serve.py:206 and :435) and bench (bench.py:194) therefore cannot show the value exported as max_sequence_tokens. The raw target does appear through parameters.to_dict. Note: the previous Autobot review suggested deleting checkpoint_context instead; either way prepared_context (the served extent) is what is missing.

  3. ignition/parameters.py:1318 — status_label prints the raw target, not the effective context. status_label=lambda v: f"request context {v:,} tokens" if v else None renders via status_parts (parameters.py:1555-1560) into the "Select GPUs" line (serve.py:270-274). With --request-context 500000 on a 262144-context recipe it prints "request context 500,000 tokens" while the served context is 262,144. Fix: clamp in the label against the recipe maximum (label has no ParameterContext) or move the label to Plan.

Nits

Verified clean (so the report can say the lens found nothing else)

Settling checks

#4 [medium] Should fix: benchmark required_context is validated against the stock context

ignition/planning.py:248 (if selection.required_context > self.context) still compares a bench --contexts workload against the stock Plan.context, not prepared_context. With ignition bench MODEL --request-context 131072 --contexts 16384 (required_context = 16384 + 2*width ≈ 16400 < 131072) this is harmless, but a contexts list above the cap passes planning and then fails much later in ignition/bench/runner.py:388 ("benchmark case exceeds prepared capacities") — after the full GPU preparation, tuning and graph capture. Fix: compare against self.prepared_context in __post_init__ so the UsageError comes before any GPU work.

Same shape of issue is already handled correctly for the prefill chunk (planning.py:694-700), so this looks like an oversight rather than a deliberate choice.

#5 [medium] Verification notes: page alignment and silent clamping above the recipe max

Caveat for entry #2: recipes live in the external hyperflare_recipes repository (AGENTS.md:381), so a recipe's prepare() could in principle round config.context before declaring max_sequence_tokens. Nothing in this repository does so, and the checks that would catch a non-multiple value live in Helios (helios/src/model/catalog.rs:44-71), i.e. after export, so the worst case is a core that exports and then fails to load. Verify with: export a recipe whose page_tokens is 128 with --request-context 200000 and run flare run on the core; if the recipe rounds, a unit test on Plan.prepared_context page alignment is what settles it.

Related nit (same file, planning.py:459-460): fit() only rejects context <= 0; a target above recipe.context is silently clamped (min(recipe.context, ...)) with no notice, while docs/cli-design.md:446 describes the flag as a cap "below the recipe's maximum". Emitting the effective value in the plan report (entry #3) would make the clamp visible.

#7 [medium] Verified-clean paths (no finding): no-flag equivalence, pool clamp, error messages

Checked and correct, no finding:

Files read in full or in the relevant span: ignition/planning.py (Plan 160-442, fit 445-542, plan 583-732), ignition/preparation/bootstrap.py, ignition/cli/{init,bench,serve,preparation}.py, ignition/preparation/{execution,model,rebuild_manifest,selection}.py, ignition/declaration.py, helios/src/{server/config.rs, model.rs, model/catalog.rs, scheduler.rs, core/memory.rs}, tests/cli/{test_planning,test_commands}.py, docs/cli-design.md diff, charter, AGENTS.md.