Conventions scratchpad · NVIDIA/hyperflare-inference #533

Raw Markdown for agents: https://autobot.eidonix.com/p/42267983-2f40-4a78-ab2b-5e65c10cafd1.md

#1 [high] Blocking: multi-host export silently ignores --request-context

ignition/cli/serve.py:193-206 (_export_hosts, the export --ranks > 1 path) calls planning.plan(...) with row_shard_prefill=args.row_shard_prefill at :206 but never context=args.request_context. The single-host export path _prepare passes it at serve.py:289, debug_serve at serve.py:472, bench.run at bench.py:177. So ignition export MODEL --ranks 2 --request-context 131072 accepts the flag and drops it: the cap never reaches Plan.context_target, preparation/bootstrap.py:58 passes the recipe max, and the exported core keeps full context. grep for request_context returns only serve.py:289, :472, bench.py:177, planning.py:460, :699, plus the two doc hits — no other site.

Why it matters: AGENTS.md bans silent ignores (charter line 13 "Don't silently ignore API fields… Never accept it and quietly drop it (#417)"), and this is a preparation setting whose whole point is the exported core; the multi-host path is the supported path for multi-host serving. The precedent is unambiguous: every preparation flag in _prepare appears in _export_hosts (mixed_prefill, prompt_logprobs, row_shard_prefill at :201-206, joint_tuning/shard_hyperconnections via the replace at :207-211).

Fix: add context=args.request_context to the planning.plan call at serve.py:206.

Settle-by-test: a parametrized test in tests/cli/test_commands.py (like test_row_shard_prefill_flag_is_model_agnostic, :59-70) that drives the export parser path and asserts the resulting plan's context_target for both ranks=1 and ranks>1; or a GPU-free unit test on the _export_hosts plan construction.

#2 [high] Should fix: cap is not recorded in plan JSON or the preparation manifest

The established convention for a new preparation setting is three-fold, and the PR does none of it:

  1. Plan.to_dict() — ignition/planning.py:389-442 lists every plan field (mixed_prefill :401, prompt_logprobs :402, joint_tuning :407, shard_hyperconnections :408, row_shard_prefill :409, force_moe_decode_a16 :412, plus "context": self.context, "checkpoint_context": self.recipe.context at :430). There is no context_target / prepared_context / request_context key, so the {"plan": …} JSON printed by export (serve.py:215, :485), debug-serve (serve.py:485) and bench (bench.py:182), and copied into bench result configuration.preparation (bench.py:243-248), does not describe the cap. prepared_context is the value actually handed to the recipe (bootstrap.py:58, "context"), yet to_dict()["context"] keeps reporting min(recipe.context, tokens), so the recorded plan misreports the prepared context.
  2. ignition/preparation/rebuild_manifest.py:343-454 from_plan — adds one SCOPE_DEPLOYMENT parameter per plan-level preparation option (prefill_chunk :387, max_concurrency :380, row_shard_prefill :392, context_parallel :370). No request_context/context entry, and Plan has no hook forcing it, so nothing validates it.
  3. reproduction_arguments (rebuild_manifest.py:231-318) — emits a --flag per recorded setting (--prefill-chunk-size :263, --row-shard-prefill :306). A core exported with --request-context 131072 therefore records reproduction args that re-export the recipe max; the manifest cannot reproduce the core it belongs to.

Rule: AGENTS.md "Configuration" (~lines 452-456): "A setting … is an advanced flag carried through the plan into the recipe's PreparationConfig, so the plan, its printed report, and its recorded measurements describe what was prepared." That sentence is exactly the contract violated here, and the sibling flags it names as precedent all satisfy it.

Fix: add "request_context": self.context_target (or "prepared_context") to to_dict(), plus add('request_context', SCOPE_DEPLOYMENT, plan.context_target) in from_plan and args.extend(['--request-context', str(plan.context_target)]) in reproduction_arguments, guarded by if plan.context_target is not None. Note from_plan's add() skips None, matching the existing optional entries.

Settle-by-test: extend tests/cli/test_planning.py:92-106 (the for candidate in (ordinary, sharded, fitted) loop) with a capped plan and assert the manifest key, its scope, and that --request-context appears in reproduction_args — that test already asserts exactly this shape for --row-shard-prefill.

#5 [high] Research summary

Reviewed PR #533 through the conventions-and-duplication lens: read every changed file in context (ignition/planning.py Plan/fit/plan, ignition/cli/{init,bench,preparation,serve}.py, ignition/preparation/bootstrap.py, docs/cli-design.md), plus the precedents they should follow — Plan.to_dict, rebuild_manifest.from_plan/reproduction_arguments, Configuration, the bench argument reuse, and the repo rules (AGENTS.md, docs/design-review.md, charter). Four findings recorded in the scratchpad.

  1. Blocking — multi-host export silently drops the cap: _export_hosts (serve.py:193-206) builds planning.plan(...) without context=args.request_context, unlike _prepare (:289), debug_serve (:472) and bench (bench.py:177). Every neighbouring preparation flag is forwarded there; the charter/AGENTS.md ban accepting a field and quietly dropping it.

  2. Should fix — the cap is unrecorded: no context_target/prepared_context key in Plan.to_dict (planning.py:389-442, which lists every other plan field and still reports the uncapped context at :430), no SCOPE_DEPLOYMENT parameter in from_plan, and no --request-context in reproduction_arguments (rebuild_manifest.py:231-318, :343-454) — the exact "plan, printed report, and recorded measurements describe what was prepared" contract in AGENTS.md, which all sibling flags satisfy.

  3. Nit — duplication: prepared_context (planning.py:368-373) is context plus one term and could be folded; effective_context = min(result.context, result.prepared_context) (:694) is provably a no-op.

  4. Should fix — placement: the flag is added to the shared capacity group so bench inherits it, though bench has its own --contexts contract and the adjacent flags (--mixed-prefill, --prompt-logprobs) are explicitly rejected there (bench.py:115-116); and the cap bypasses Configuration entirely, unlike --prefill-chunk-size/--max-concurrency/--force-moe-decode-a16, with nothing recording that choice.

No issue with the docs row's wording or the bootstrap.py retarget itself: plan.prepared_context is the right seam and the flag is threaded through derive/fit/plan in the conventional keyword style.

#6 [high] Review coverage: what was checked with no finding

Scope: every changed file was read in its surrounding code, not only the diff.

Checked and found consistent with precedent (no finding):

Tests: the PR adds none. The precedents that would pin findings 1-3 already exist and are cheap: tests/cli/test_commands.py:59-70 (parametrized over ["export", "debug-serve", "bench"], asserts the flag is model-agnostic and appears in help) and tests/cli/test_planning.py:71-139 (asserts to_dict()["row_shard_prefill"], reproduction_args membership, and the manifest key/scope for each candidate plan).

#7 [high] Summary: findings index and PR metadata

PR #533 "Cap the per-request context target", author roobyz (CONTRIBUTOR), open, base main, head 1a006c6, 7 files +35/−15, no reviews, no CI checks. Supersedes closed PR #454 (same author, same title, closed 2026-11-23 after CHANGES_REQUESTED from yatesdr).

Findings by severity (details in the individual notes):

  1. Blocking — _export_hosts (serve.py:193-206) never passes context=args.request_context, so export --ranks N accepts and silently drops the cap. Note "Blocking: multi-host export silently ignores --request-context".
  2. Should fix — the cap is absent from Plan.to_dict(), rebuild_manifest.from_plan and reproduction_arguments, so the printed plan, the recorded preparation manifest and the exported reproduction args all misdescribe the core. Note "Should fix: cap is not recorded in plan JSON or the preparation manifest".
  3. Nit — Plan.prepared_context duplicates Plan.context with one extra term and effective_context = min(result.context, result.prepared_context) (planning.py:694) is a no-op. Note "Nit: prepared_context/effective_context duplicate Plan.context".
  4. Should fix — the flag is placed in the shared capacity group so bench inherits a contract it cannot honour (bench has --contexts and never exports a core), and it bypasses Configuration unlike every sibling preparation flag, with nothing recording that decision. Note "Should fix: flag placed in the shared capacity group reaches bench, and has no Configuration home".

Rules cited across the findings: AGENTS.md "Don't silently ignore API fields"/charter line 13 (#417); AGENTS.md "Configuration" (a plan-carried setting must be described by the plan, its printed report and its recorded measurements); AGENTS.md "A setting has one of three homes: the recipe declaration, the configuration file, or a command-line flag"; docs/design-review.md principle 10 (explicit configuration); AGENTS.md "Require focused, meaningful validation" for the missing tests.

Recommendation: request changes — fix 1 and 2, decide 4 (reject the flag in bench / add a config key or say it is command-line only), and add the two precedent tests.

#9 [high] Research summary

Conventions-and-duplication review of PR #533 at head de1b5b5. I read every changed file in context (ignition/planning.py Plan.__post_init__/fit/plan, ignition/cli/{init.py, bench.py, preparation.py, serve.py}, ignition/preparation/{bootstrap.py, rebuild_manifest.py}, tests/cli/test_planning.py, docs/cli-design.md) against AGENTS.md (esp. Configuration §452-456, Required PR descriptions), docs/design-review.md, docs/cli-design.md §3.1-3.4, and the closest precedents (#454's review of this same feature, --row-shard-prefill/--mixed-prefill/--prompt-logprobs threading).

Two of my earlier findings are now fixed at this head and must not be repeated: _export_hosts forwards context=args.request_context (serve.py:206), and the setting is now recorded in all three artifacts (Plan.to_dict "context_target" planning.py:432; reproduction_arguments --request-context rebuild_manifest.py:264-265; from_plan SCOPE_DEPLOYMENT entry :390). I also withdraw the earlier "bench should not inherit the flag" concern: bench.py:177 threads it and planning.py:248 now validates required_context against prepared_context, so bench is coherent.

Remaining findings, all confirmed in code:

Should fix — the cap is missing from the two places the repository makes every other preparation setting visible. (a) serve.py:302-316: the "Select GPUs" progress line enumerates each preparation choice (mixed prefill, joint tuning, BF16 sharded hyperconnections, row-sharded prefill, …); --request-context adds no field, so an export at a reduced context prints a plan line identical to stock. (b) bench.py:243-248: details["configuration"]["preparation"] whitelists 17 plan keys including prefill_chunk and row_shard_prefill but not context_target, so a benchmark run that prepared graphs at a capped context records a configuration that does not say so. AGENTS.md:452-456 states the setting must be carried "through the plan into the recipe's PreparationConfig, so the plan, its printed report, and its recorded measurements describe what was prepared"; these are the printed report and recorded measurements. Fix: add one field to each list, mirroring row_shard_prefill.

Should fix — one flag's validation is split across two homes, against the neighbouring precedent. The positive-count check lives in fit (planning.py:461-462) while the page-multiple check lives in Plan.__post_init__ (planning.py:289-290). The precedent for a chunk-shaped flag is a single block in plan() that validates form and range together (planning.py:622-625 for --prefill-chunk-size, which owns both "multiple of 64" and the 64..recipe.context range); __post_init__ holds cross-field checks. Splitting them means fit's copy re-executes on every candidate fit() call (planning.py:666-676 calls it from candidates/attempt/automatic), and a reader looking for one flag's rules must open two functions. Fix: keep both in __post_init__ (where page_tokens is available) or both in plan().

Nit — prepared_context restates context instead of composing it. context = min(recipe.context, tokens) (planning.py:366-368) and prepared_context = min(recipe.context, context_target, tokens) (planning.py:370-375); the same three-way min is written twice, and the if context_target is None early return exists only to reproduce recipe.context. Because min(context, prepared_context) is then needed at planning.py:696 to recover the true served limit, the code carries two overlapping definitions plus a reconciling min. Writing prepared_context as min(self.context, self.context_target) (with context_target or tokens, or a None guard returning self.context) collapses the three into one expression, removes the redundant effective_context local, and makes prepared_context == context on the no-op path — which is what the test asserts anyway (stock_plan.prepared_context == recipe.context holds only because the pool happens to exceed 262144 in the fixture, so the no-op claim is currently fixture-dependent rather than structural).

Nit — to_dict()["context"] keeps reporting the uncapped limit beside the cap. Precedent is the checkpoint_context/context pair (planning.py:432): checkpoint_context is the declared maximum, context the effective served limit. After this PR the exported core serves prepared_context, yet context still reports min(recipe.context, tokens), so the JSON a consumer reads names a limit the core will reject; only the sibling context_target reveals it. The new test deliberately pins this (d["context"] == capped.context # stock pool-bound value). Either fold the cap into context (keeping checkpoint_context as the recipe max, as today) or document in the key's vicinity that context is pool-bound and prepared_context is the served ceiling.

No duplicated helper or existing abstraction is bypassed: the bootstrap.py:58 seam reuses BasePreparationConfig.context rather than adding a field, the derive() pass-through follows the row_shard_prefill shape, and no new runtime mechanism duplicates --kv-cache-limit (the cap must reach max_sequence_tokens, which the runtime flag cannot — the point #454 settled).

#10 [high] Supersedes #1 and #4: two prior findings are FIXED at head de1b5b5

Run 998's findings #1 and #4 are OUT OF DATE. Do not repeat them in the final report.

  1. WITHDRAWN (was blocking): _export_hosts now forwards the flag — ignition/cli/serve.py:206 ends row_shard_prefill=args.row_shard_prefill, context=args.request_context). Multi-host export no longer drops it. debug_serve (:472) and _prepare (:289) also forward it, and bench.py:177 too.

  2. WITHDRAWN (was should-fix): the cap IS recorded in all three artifacts:

    • Plan.to_dict(): ignition/planning.py:432 — "context": self.context, "context_target": self.context_target, "checkpoint_context": self.recipe.context.
    • reproduction_arguments: ignition/preparation/rebuild_manifest.py:264-265 — if plan.context_target is not None: args.extend(['--request-context', str(plan.context_target)]).
    • from_plan: rebuild_manifest.py:390 — add('context_target', SCOPE_DEPLOYMENT, plan.context_target). So this now matches AGENTS.md:452-456's three-artifact requirement at the manifest level (see the new finding about the printed report and benchmark record levels, which are still missing).
  3. WITHDRAWN (was should-fix): "bench should not inherit the flag". bench.py:177 threads context=args.request_context, and planning.py:248 now validates selection.required_context > self.prepared_context, so bench's --contexts contract is compared against the capped value. Coherent, not a defect. Note this also closes the old Autobot finding against planning.py:248.

Verified at head commit de1b5b5 (PR #533, open, 9 files, +98/-18, CI: no checks).

#11 [high] Should fix: cap absent from the progress report line and the benchmark preparation record

SHOULD FIX (Conventions/duplication). The cap is missing from the two human-facing surfaces where every sibling preparation setting appears.

(a) ignition/cli/serve.py:302-316 — the "Select GPUs" progress line enumerates each preparation choice: · prompt logprobs, · mixed prefill, · expert scales, · online MXFP8, · language model only, · compile workers, · autotune effort, · native dense activations, · MoE decode A16, · DFlash2 proposals, · joint tuning, · BF16 sharded hyperconnections, · row-sharded prefill. --request-context adds none. So ignition export M --request-context 131072 prints a plan line byte-identical to stock, and the operator cannot see from the terminal that the core was prepared at a reduced context.

(b) ignition/cli/bench.py:243-248 — details["configuration"]["preparation"] whitelists 17 plan keys: "tensor_parallel", "prefill_chunk", "stream_overlap", "context_parallel", "context_parallel_size", "native_dense_activations", "force_moe_decode_a16", "autotune_effort", "compile_workers", "speculative_token_capacity", "speculation", "expert_scale_compression", "mla_compute_mode", "row_shard_prefill", "online_mxfp8", "online_mxfp8_scope", "language_model_only". context_target is not among them, so a ignition bench --request-context N run records a JSON configuration that does not state the context its graphs were prepared at — even though the PR threads the flag into bench (bench.py:177) and into plan.to_dict() (planning.py:432) which _measure reads at bench.py:237.

Why it matters: AGENTS.md:452-456 (Configuration) — "A setting that only experiments need is an advanced flag carried through the plan into the recipe's PreparationConfig, so the plan, its printed report, and its recorded measurements describe what was prepared." These are exactly the printed report (a) and the recorded measurements (b).

Fix: add context_target (or the formatted --request-context N) to serve.py's f-string, next to row-shard-prefill, and add "context_target" to bench.py's key tuple.

#13 [high] Blocking: head 02023eba drops the page-multiple validation the new test still asserts

At head 02023eba (PR #533) there is no --request-context page-multiple validation anywhere:

Therefore tests/cli/test_planning.py:238-240 (with pytest.raises(UsageError, match="multiple of the"): planning.plan(..., context=100, ...)) cannot pass: plan(...context=100) now succeeds and pytest.raises fails. The PR description still advertises "a page-multiple validation", and the test still pins it, so description, test and code disagree at this head. No CI checks on the head.

Why it matters beyond the test: prepared_context (planning.py:377-381) is passed verbatim to BasePreparationConfig.context (bootstrap.py:58) → max_sequence_tokens. Helios rejects a core whose prepared_sequence_tokens / limits.max_sequence_tokens is not a multiple of page_tokens at load (helios/src/model/catalog.rs:44-70, !prepared_sequence_tokens.is_multiple_of(page_tokens.max(1)) → "invalid prepared model configuration"). Without the export-time check an unaligned target exports cleanly and fails when serving starts.

Settle by: pytest tests/cli/test_planning.py (one command) and a decision on whether an unaligned target is rejected, floored, or accepted. Recommended: validate min(recipe.context, context_target) % page_tokens in plan(), which keeps 100 rejected (100 % 64 = 36) and accepts an oversized target that resolves to an aligned value.

#14 [high] Withdrawn at head 02023eba: plan line, bench record and to_dict now carry the cap

Findings #11 and the S1 of report #12 are FIXED at head 02023eba and must not be re-raised:

Nit that still stands: format(x, ',') at serve.py:319 is the only format()-based number rendering in ignition/cli; the neighbours use f-string : or planning.format_gpus. Cosmetic only. Another nit: docs/cli-design.md:1443 says "The checkpoint maximum" while the new row :446 and neighbours say "the recipe's maximum" — one term for one thing.

#15 [high] Should fix: --request-context validation home departs from the plan() pre-flight precedent

SHOULD FIX (conventions). --request-context positivity is validated in fit (planning.py:467-468: if context is not None and context <= 0: raise UsageError(...)), while plan() validates its sibling flag's form and range together in one pre-flight block: planning.py:635-637 if chunk % 64 or not 64 <= chunk <= recipe.context: raise UsageError(f"--prefill-chunk-size for {checkpoint.alias} must be a multiple of 64 from 64 through {recipe.context:,}"). Every other flag-level rule in plan() sits in that block (planning.py:615-637: mixed-prefill, online-mxfp8, language-model-only, max-concurrency, image-concurrency, prefill-chunk); Plan.__post_init__ (planning.py:224-296) holds cross-field rules that need other plan fields (benchmark selection :242-265, force-moe-decode-a16 :266-275, shard-hyperconnections :276-280, row-shard-* :281-296). --request-context's two rules are now split the worst way: one in fit, the missing one nowhere (see entry #13).

Cost of the misplacement: fit is re-entered per candidate world size and per shortfall probe through fitted/automatic/candidates/attempt (planning.py:677-742), so a check that can never change re-runs inside the search loop rather than once.

Fix: move the positivity check into plan()'s pre-flight block next to :635-637 and put the page-multiple check there too, so both rules for one flag live in one function. The new test drives both through planning.plan(...) (tests/cli/test_planning.py:234-240), so moving them drops no coverage.

#17 [high] Research summary

Reviewed PR #533 at head 02023eba through the conventions-and-duplication lens: every changed file (planning.py, cli/init.py, cli/serve.py, cli/bench.py, cli/preparation.py, preparation/bootstrap.py, preparation/rebuild_manifest.py, docs/cli-design.md, tests/cli/test_planning.py) read in context, plus the consumers that changed behaviour (bootstrap common_preparation_kwargs, rebuild_manifest, and Helios's load-time catalog validation).

Verdict: one blocking issue, one should-fix, two nits. Blocking: at this head the page-multiple validation the PR describes is gone from the code (planning.py has only the --prefill-chunk-size "multiple of 64" check at :636 and context_target appears only at :186/:379/:381/:438/:549), yet tests/cli/test_planning.py:238-240 still asserts plan(..., context=100) raises — so the added test cannot pass, and nothing at export time protects the aligned-max_sequence_tokens requirement Helios enforces at load (helios/src/model/catalog.rs:44-70). Should fix: the positivity check now lives alone in fit (planning.py:467-468) instead of the plan() pre-flight block that owns every sibling flag's form and range (planning.py:615-637). Nits: effective_context = min(result.context, result.prepared_context) (planning.py:709) is provably a no-op beside prepared_context's overlap with context, and to_dict() now names the same quantity three ways; plus the doc's "checkpoint maximum" vs "recipe's maximum" wording split.

Two findings from my previous turn are fixed at this head and were withdrawn with evidence (the serve "Select GPUs" line at serve.py:319, the bench configuration.preparation whitelist at bench.py:248, and to_dict()'s prepared_context at planning.py:438). Full details are in scratchpad notes 13-16; the multi-host and manifest-recording gaps remain withdrawn.

#18 [high] Report of 2026-11-26 (run 2): PR #533 at head 02023eba — one blocker, one should-fix, four nits

Conventions-and-duplication review — PR #533 "Cap the per-request context target"

PR https://github.com/NVIDIA/hyperflare-inference/pull/533 · author roobyz · open · base main · head 02023eba · 9 files · no reviews · no CI checks on the head. Supersedes the same author's closed #454.

Lens: each new construct against its closest in-repository precedent, and duplicated helpers/mechanisms. Every changed file read in surrounding code; callers followed (export, debug-serve, bench, multi-host _export_hosts, derive/fit/plan, bootstrap.common_preparation_kwargs, rebuild_manifest, Helios load).

Verdict: one blocking issue, one should-fix, four nits.

Blocking

B1 — The page-multiple validation the PR describes and tests no longer exists in the code; the new test therefore cannot pass. tests/cli/test_planning.py:238-240 asserts planning.plan(..., context=100) raises UsageError matching "multiple of the". At this head ignition/planning.py contains no --request-context alignment rule at all: grep "multiple of" → only :636-637 (--prefill-chunk-size … "must be a multiple of 64 from 64 through {recipe.context:,}"); grep context_target → :186 (field), :379/:381 (prepared_context), :438 (to_dict), :549 (fit ctor keyword). Plan.__post_init__ (:224-296) and plan()'s pre-flight (:615-637) hold no such check. So plan(context=100) succeeds and pytest.raises fails; description, test and code disagree. Why it matters beyond the test: prepared_context (:377-381) flows verbatim to BasePreparationConfig.context (ignition/preparation/bootstrap.py:58) → max_sequence_tokens, and Helios rejects a core whose prepared_sequence_tokens / limits.max_sequence_tokens is not a multiple of page_tokens (helios/src/model/catalog.rs:44-70: !prepared_sequence_tokens.is_multiple_of(page_tokens.max(1)) / !limits.max_sequence_tokens.is_multiple_of(page_tokens) → "invalid prepared model configuration"). Without an export-time check, an unaligned target exports cleanly and dies at serve start. Fix: validate the served quantity, min(recipe.context, context_target) % page_tokens, in plan()'s pre-flight block; 100 % 64 = 36 stays rejected, and an oversized target that resolves to an aligned value is accepted (matching docs/cli-design.md:446 "below the recipe's maximum" and the description's clamp claim). Settle by pytest tests/cli/test_planning.py — no CI ran on this head.

Should fix

S1 — One flag, two validation homes (no precedent). --request-context's positivity rule sits alone in fit (planning.py:467-468), while plan() owns every sibling flag's form and range in one pre-flight block (planning.py:615-637: mixed-prefill, online-mxfp8, language-model-only, max-concurrency, image-concurrency, prefill-chunk :635-637). Plan.__post_init__ (:224-296) is reserved for cross-field rules needing other plan fields (benchmark selection :242-265, force-moe-decode-a16 :266-275, shard-hyperconnections :276-280, row-shard-* :281-296). Cost: fit re-runs per candidate world size and per shortfall probe (fitted/automatic/candidates/attempt, :677-742), so a check that can never differ executes inside the search loop. Fix: move it, and B1's rule, into plan()'s pre-flight beside :635-637. The test drives both through planning.plan(...) (tests/cli/test_planning.py:234-240), so moving them drops no coverage.

Nits

N1 — effective_context = min(result.context, result.prepared_context) (planning.py:709) is provably a no-op. With a target, prepared_context = min(recipe.context, target, tokens) <= context = min(recipe.context, tokens); without one, prepared_context = recipe.context >= context. The chunk check could read result.prepared_context alone. The context_target is None early return at :379-380 is load-bearing (it reproduces the pre-PR recipe.context that bootstrap.py:58 passed) — do not fold it to self.context; the capped arm could read min(self.context, self.context_target).

N2 — to_dict() (planning.py:438) names one quantity three ways — prepared_context, context_target, and checkpoint_context (which equals prepared_context whenever no target is set), beside the pool-bound context. context's meaning is now deliberate (tests/cli/test_planning.py:227 pins it), but a JSON reader must know which is the served ceiling.

N3 — docs wording split: docs/cli-design.md:1443 says "The checkpoint maximum" where the new row (:446) and its neighbours say "the recipe's maximum".

N4 — serve.py:319 is the only format(x, ',') number rendering in ignition/cli (no other match in the package); neighbours use f-string : or planning.format_gpus. Cosmetic.

Verified clean — do not re-raise

Open questions

  1. Did B1 reproduce? Not run here; it is a grep-level fact plus one pytest command. The head has no CI checks.
  2. Intended rule for an unaligned target above the recipe maximum — reject, floor, or accept on the resolved value? Needs a decision, then a line in docs/cli-design.md:446 and the help text.
  3. Should to_dict()["context"] stay pool-bound (as tests/cli/test_planning.py:227 pins) or become the served ceiling? Only a maintainer can say whether external consumers depend on it.
  4. The VRAM table is the description's claim; nothing in this tree pins it and no test can.

#20 [high] Blocking: --request-context bound rejects a target above the recipe max, contradicting the PR's own test and docs

Head 9118add (after #545 merged; the parameter system is now declarative).

At ignition/parameters.py:1309-1321 the new field declares: context_target: int | None = param(None, flag="--request-context", ..., min_value=1, max_fn=_recipe_context_limit, manifest_key="context_target", scope=ParameterScope.DEPLOYMENT, repro_always=True, help="cap ... must be a multiple of the page token count")

_recipe_context_limit (parameters.py:1268-1269) returns context.recipe.context (262144 for the fixture, tests/cli/test_planning.py:139).

ParameterGroup.validate_fields (parameters.py:505-545) enforces max_fn: with no multiple_of it takes the elif branch at :533-545 and raises f"{flag} for {alias} must be 1 through {max}" when value > max. RecipeParameters.validate calls super().validate (:1463); planning.plan calls params.validate(pre_context) (:540) and fit calls it again (:456).

Consequence: planning.plan(..., parameters=replace(base_params, context_target=500000)) raises UsageError, but tests/cli/test_planning.py:310-313 asserts exactly that call succeeds and clamps: oversized = planning.plan(..., parameters=replace(base_params, context_target=500000)) assert oversized.prepared_context == recipe.context and docs/cli-design.md:468 states "resolves to the smaller of N and the recipe maximum", and Plan.prepared_context (planning.py:357-363) implements min(recipe.context, target). So validation, test and docs disagree three ways; the test fails on the oversized case.

Fix options: drop max_fn (keep min_value=1) so oversized targets clamp as documented, or keep the rejection and change the test + docs/cli-design.md:468 + the help text (parameters.py:1320) to say "at most the recipe maximum".

Note: the min_value=1 path is exercised by tests/cli/test_planning.py:315-317 and matches "--request-context" via the min_val == 1 message at parameters.py:541-542, so that arm is fine.

#21 [high] Should fix: page-multiple rule hand-written in Plan while ParamSpec already has multiple_of

Head 9118add.

ParamSpec already carries multiple_of (ignition/parameters.py:81) and ParameterGroup.validate_fields enforces it with one canonical message (parameters.py:524-532: "{flag} for {alias} must be a multiple of {n} from {lo}{hi}"). The closest precedent for a tokened capacity flag uses it: RecipeParameters.prefill_chunk declares min_value=64, max_fn=_recipe_context_limit, multiple_of=64 (parameters.py:1294-1308).

The new context_target field (parameters.py:1309-1321) does NOT declare multiple_of, but its help string says "must be a multiple of the page token count". The rule is instead hand-written in Plan.post_init (ignition/planning.py:186-190), with a different message shape ("--request-context {target:,} is not a multiple of the {page_tokens:,}-token page size"), raising UsageError from the dataclass constructor.

Why it deviates: one flag's form now has two validation homes — generic ParamSpec bounds in parameters.py, and a bespoke page-alignment check in planning.py — whereas every other declared flag validates in exactly one place (validate_fields). The reason multiple_of cannot be used verbatim is that the page size is dynamic (Plan.page_tokens, planning.py:324-325, is adjusted by adjust_page_tokens), which is exactly the shape max_fn already solves for bounds (ParamSpec.max_fn, parameters.py:92). The precedent-consistent fix is a multiple_fn(group, context) beside max_fn/min_attr, or passing the resolved page size through ParameterContext, so the declared rule and the enforced rule stay in one place.

Also worth noting: when min_value=1 and max_fn are both present and the hand check runs, the two messages differ in wording for one flag, and Plan.post_init runs on every replace() of a Plan, including the ones inside fit's sizing loop (planning.py:475-480) where page_tokens cannot change.

Settled by: pytest tests/cli/test_planning.py (the new test at :319-321 expects "multiple of the" from planning.plan).

#22 [high] Blocking: --request-context is never emitted in reproduction_args (base-field skip) — capped cores are not reproducible

Head 9118add.

RecipeParameters.reproduction_args (ignition/parameters.py:1469-1528) emits the core universal flags by naming them explicitly: :1483 args.extend(["--max-concurrency", str(self.max_concurrency)]) :1484 args.extend(["--prefill-chunk-size", str(self.prefill_chunk)]) and then skips every base field when iterating declared specs: :1491 base_field_names = {f.name for f in fields(RecipeParameters)} :1494 if dc_field.name in base_field_names or not spec.cli or not _is_enabled(...): continue

context_target is declared on RecipeParameters itself (parameters.py:1309), so it is a base field: the generic loop skips it and no explicit line emits it. Its repro_always=True (:1319) is therefore dead metadata — that flag is only consulted by the generic loop at :1519, which can never reach this field.

Consequence: from_plan's reproduction_args (ignition/preparation/rebuild_manifest.py:261 → params.reproduction_args) never contains --request-context, so a prepared core with a capped context cannot be reproduced from its recorded arguments — the recorded command re-exports at the full recipe context, a different core. tests/cli/test_planning.py:324-325 asserts "--request-context" in manifest["reproduction_args"], so it fails.

Fix, following the sibling precedent on the two lines above: after :1484 add if self.context_target is not None: args.extend(["--request-context", str(self.context_target)]) and drop the ineffective repro_always from the declaration (or keep it only after the field is emitted by the generic loop, i.e. don't declare it on the base class).

Confirm with: pytest tests/cli/test_planning.py::test_request_context_target_prepared_context_and_manifest — static read only here, no CI on this head.

#26 [high] Coverage: verified clean through the conventions-and-duplication lens

Head 9118add. Checked and clean through the conventions-and-duplication lens — do not re-raise:

#27 [high] Research summary

Conventions-and-duplication review of PR #533 at head 9118add (after #545's compositional RecipeParameters landed, which moves the flag from hand-written argparse into a declared param(...) spec).

Two blockers, both static-read findings that the PR's own new test contradicts:

  1. The declared upper bound makes the oversized-clamp path impossible. context_target declares max_fn=_recipe_context_limit (ignition/parameters.py:1309-1321 → :1268-1269 → validate_fields :533-545), so context_target=500000 on a 262144-context recipe raises --request-context for X must be 1 through 262144. But Plan.prepared_context (planning.py:357-363) and docs/cli-design.md:468 both promise min(recipe.context, N), and tests/cli/test_planning.py:310-313 asserts the clamp. Validation, test and docs disagree three ways.

  2. --request-context is never emitted in reproduction_args. RecipeParameters.reproduction_args names the universal flags explicitly (:1483-1484) and skips every base field in its generic loop (:1491, :1494). context_target is a base field, so its repro_always=True is dead metadata and the recorded command re-exports at full context — a different core. tests/cli/test_planning.py:324-325 asserts the flag is present.

Should fix: the page-multiple rule is hand-written in Plan.__post_init__ (planning.py:186-190) while ParamSpec.multiple_of already exists and is what the closest precedent, --prefill-chunk-size (parameters.py:1294-1308), uses — so one flag has two validation homes with two message shapes; context_target declares no status_label, so unlike roce_ring/roce_chain (parameters.py:1368, :1377) the cap never reaches serve.py's printed plan line (:269), which AGENTS.md:452-456 requires; and the two closed enumerations of core universal fields (docs/cli-design.md:448-451, docs/preparation-development.md:17-19) were not updated.

Nits: unconditional context_hint naming a cap the deployment may not have applied (serve.py:68); three names for one served ceiling in to_dict (planning.py:392-397); two overlapping ceiling accessors.

The mechanism itself is well-matched to repository convention — spec-level declaration following prefill_chunk field for field, generated flag/help, the single bootstrap.py:132 seam, manifest plumbing through the generic path, and one-line bench coherence at planning.py:212 — details, citations and the verified-clean list are in scratchpad entries 20-26.

#28 [high] Report of 2026-11-26 (run 3): PR #533 at head 9118add — two blockers, three should-fix, three nits

Conventions-and-duplication review — PR #533 "Cap the per-request context target"

PR https://github.com/NVIDIA/hyperflare-inference/pull/533 · author roobyz · open · base main · head 9118add · 6 files (+69/−5) · no reviews · no CI checks on the head. Follows the same author's closed #454.

Lens: each new construct compared with its closest in-repository precedent, and any existing helper/mechanism it duplicates. Every changed file read in context. Callers followed: export, debug-serve, bench, multi-host _export_hosts, derive/fit/plan, bootstrap.common_preparation_kwargs, rebuild_manifest.from_plan/reproduction_arguments, and Helios load-time validation (helios/src/server/config.rs:131-226, helios/src/model.rs:261-273, helios/src/model/catalog.rs:44-70).

Heads differ from my last turn: #545 (compositional RecipeParameters and dynamic CLI) has merged, so the flag is no longer a hand-written argparse entry in ignition/cli/__init__.py; it is now a declared param(...) field on RecipeParameters. This strengthens the conventions lens — the declaration is the single place where a flag's form, bounds, help, manifest key and repro behaviour are supposed to live, and two of the new findings are departures from that one-place rule.

Verdict: blocking issues

Blocking 1 — the declared bound makes the PR's own oversized-clamp behaviour unreachable

Where: ignition/parameters.py:1309-1321 (declaration), :1268-1269 (_recipe_context_limit), :533-545 (enforcement); contradicted by ignition/planning.py:357-363, tests/cli/test_planning.py:310-313, docs/cli-design.md:468.

# ignition/parameters.py:1309-1321
    context_target: int | None = param(
        None,
        flag="--request-context",
        group="capacity and compression",
        metavar="N",
        value_type=int,
        min_value=1,
        max_fn=_recipe_context_limit,      # <- recipe.context, 262144 in the fixture
        manifest_key="context_target",
        scope=ParameterScope.DEPLOYMENT,
        repro_always=True,
        help="cap the prepared per-request context at N tokens; must be a multiple of the page token count",
    )

ParameterGroup.validate_fields (parameters.py:505-545) enforces max_fn through the elif branch at :533-545 and raises f"{flag} for {alias} must be 1 through {max}". RecipeParameters.validate calls super().validate(ctx) (:1463); planning.plan calls params.validate(pre_context) (planning.py:540) before any candidate is fitted, and fit calls it again (:456).

So (fixture recipe context is 262144, tests/cli/test_planning.py:139):

# tests/cli/test_planning.py:310-313 — asserts the call SUCCEEDS and clamps
    oversized_params = replace(base_params, context_target=500000)
    oversized = planning.plan(recipe, recipe.checkpoints[0], gpus, selected=(0, 1), parameters=oversized_params)
    assert oversized.parameters.context_target == 500000
    assert oversized.prepared_context == recipe.context

and Plan.prepared_context (planning.py:357-363) implements min(self.recipe.context, target), and docs/cli-design.md:468 says "resolves to the smaller of N and the recipe maximum". Validation, test and docs disagree three ways; the test fails on the oversized case.

Fix (pick one, then align all three): drop max_fn=_recipe_context_limit and keep min_value=1, so an oversized target clamps as documented and as prepared_context implements; or keep the rejection and change tests/cli/test_planning.py:310-313, docs/cli-design.md:468 and the help string (parameters.py:1320) to say "at most the recipe maximum". The sibling prefill_chunk (parameters.py:1294-1308) uses max_fn=_recipe_context_limit because a chunk above the context is genuinely invalid — for a cap, clamping is the documented contract, so the precedent points at dropping it here.

Not a finding: the min_value=1 path works and matches --request-context via the min_val == 1 message (parameters.py:541-542), exercised by tests/cli/test_planning.py:315-317.

Blocking 2 — --request-context never reaches reproduction_args, so a capped core is not reproducible

Where: ignition/parameters.py:1469-1528 (especially :1483-1484, :1491, :1494, :1519), reached from ignition/preparation/rebuild_manifest.py:261.

# ignition/parameters.py:1483-1484 — the universal flags are emitted BY NAME
        args.extend(["--max-concurrency", str(self.max_concurrency)])
        args.extend(["--prefill-chunk-size", str(self.prefill_chunk)])
...
# :1491, :1494 — and then every base field is skipped by the generic loop
        base_field_names = {f.name for f in fields(RecipeParameters)}
        for dc_field, spec in self._param_fields():
            if dc_field.name in base_field_names or not spec.cli or not _is_enabled(self, spec, ctx):
                continue

context_target is declared on RecipeParameters itself (parameters.py:1309), so it is a base field: the generic loop skips it, and no explicit line emits it. Its repro_always=True (:1319) is therefore dead metadata — that flag is only consulted in the generic loop (:1519), which can never reach this field.

Consequence: from_plan's reproduction_args (rebuild_manifest.py:331-333 → reproduction_arguments :261 → params.reproduction_args(context)) never contains --request-context, so the recorded command rebuilds at the full recipe context — a different core, and the exact thing a reproduce-from-metadata record exists to prevent (AGENTS.md:452-456: plan, printed report and recorded measurements must describe what was prepared). tests/cli/test_planning.py:324-325 asserts "--request-context" in manifest["reproduction_args"], so it fails.

Fix, following the two-line precedent directly above it: after :1484 add

        if self.context_target is not None:
            args.extend(["--request-context", str(self.context_target)])

and drop the ineffective repro_always=True from the declaration (or move context_target out of the by-name base list). Only the capped case emits, so an unset flag stays byte-equivalent to stock.

Should fix

S1 — the page-multiple rule is hand-written in Plan while ParamSpec.multiple_of already exists

ParamSpec.multiple_of (parameters.py:81) is enforced by validate_fields with one canonical message (:524-532), and the closest precedent for a tokened capacity flag uses it: prefill_chunk declares min_value=64, max_fn=..., multiple_of=64 (parameters.py:1294-1308).

The new field does not declare multiple_of, even though its own help says "must be a multiple of the page token count" (parameters.py:1320). The rule instead lives in Plan.__post_init__ (planning.py:186-190) with a different message shape.

# ignition/planning.py:186-190
        target = self.parameters.context_target
        if target is not None and target % self.page_tokens != 0:
            raise UsageError(
                f"--request-context {target:,} is not a multiple of the {self.page_tokens:,}-token page size"
            )

Why it departs: one flag's form now has two validation homes — generic spec bounds in parameters.py, bespoke page alignment in planning.py — whereas every other declared flag validates in exactly one place. The reason multiple_of cannot be used verbatim is that the page size is dynamic (Plan.page_tokens, planning.py:324-325, adjusted by adjust_page_tokens), which is precisely the shape max_fn already solves for bounds. Precedent-consistent fix: a multiple_fn(group, context) beside max_fn (or carry the resolved page size in ParameterContext), so declared and enforced rules stay in one place. Plan.__post_init__ also re-runs on every replace() inside fit's sizing loop (planning.py:475-480) where page_tokens cannot change.

S2 — the cap is missing from the printed plan line because the field declares no status_label

ignition export MODEL --request-context 131072 prints a "Select GPUs" line built from plan.parameters.status_parts(plan.parameter_context) (ignition/cli/serve.py:269), and status_parts renders a part only for specs declaring status_label (parameters.py:694-707; override at :1554-1559). The new field declares none. The sibling base fields that change serving do:

# ignition/parameters.py:1368
        status_label=lambda v: "experimental RoCE ring (native neighbor relays)" if v else None,

The plan (Plan.to_dict, planning.py:379-416) and the bench record (bench.py:265 **plan.parameters.to_dict(plan.parameter_context)) both carry the cap; only the printed report does not — and AGENTS.md:452-456 names the plan, its printed report and its recorded measurements together. Fix: add a guarded status_label=lambda v: f"request context {v:,}" if v is not None else None, so a stock export's line stays byte-identical.

S3 — the two closed enumerations of core universal fields were not updated

Both are closed lists of the same set, so the PR leaves two statements contradicting the code it adds; a reader of the prep-development doc concludes the cap lives in an external recipe package. The PR did add the flag row (docs/cli-design.md:468) and the owner row (:1436), so this is an omission in one place, not missing documentation overall. Fix: add the field to both lists, or replace each list with a pointer to ignition/parameters.py so it cannot drift again.

Nits

N1 — context_hint names a cap the deployment may not have applied. serve.py:68 unconditionally appends "and the --request-context cap". When the flag is unset — still the default, and the byte-equivalent path the PR claims — no cap exists. The same dict keys its optional entry on presence (**({"decode_weight_bytes": ...} if checkpoint.decode_weight_bytes > 0 else {}), serve.py:70). Guard the clause the same way.

N2 — three names for one served ceiling in to_dict. planning.py:392-397 spreads the parameter dict (which emits context_target) then adds "context": self.context, "prepared_context", "checkpoint_context": self.recipe.context. With no target prepared_context == checkpoint_context; with a pool-bound plan context == prepared_context. A JSON consumer must know which is the served bound. Unlike pages/tokens/guaranteed_tokens, these are restatements. Drop checkpoint_context, or document the three in one place.

N3 — two overlapping ceiling accessors. Plan.context (planning.py:352-355) and Plan.prepared_context (:357-363) differ by one term and the test pins both meanings (tests/cli/test_planning.py:302-303); defensible, but each docstring describes itself alone. State the relationship ("context is bounded by the prepared pool; prepared_context is the export-time ceiling").

Verified clean through this lens — do not re-raise

Open questions

  1. Which is intended for a target above the recipe maximum — clamp (as prepared_context, docs/cli-design.md:468 and tests/cli/test_planning.py:310-313 say) or reject (as max_fn enforces)? Only the author can pick; the three surfaces must then agree.
  2. Should to_dict()["context"] stay pool-bound while prepared_context is the export ceiling? tests/cli/test_planning.py:303 pins the current meaning; external consumers are not visible in this tree.
  3. The VRAM table in the description is untestable here — nothing in the tree pins it, and no GPU was available. It also holds only under --kv-cache-limit context|concurrency; whether the description says so is a description-mechanics question for another lens.
  4. Nothing was executed. No CI checks ran on head 9118add, and every behavioural claim above is a static read. pytest tests/cli/test_planning.py tests/cli/test_parameters.py settles Blocking 1, Blocking 2 and S1 in one command.

#30 [high] Report of 2026-11-27 (run 4): PR #533 at head e623985 — prior blockers fixed; two should-fix duplication findings

Review of PR #533 (cap the per-request context target) at head e6239855, conventions-and-duplication lens. Files read in context: ignition/parameters.py (ParamSpec 61-102, param 104-112, _flag_name/_dest_name 186-202, validate_fields 505-545, validate 547-551, manifest_parameters 596-616, reproduction_args 618-655, to_dict 667-692, status_parts 694-707, prefill_chunk 1294-1308, context_target 1309-1320, roce_ring/chain 1360-1377, RecipeParameters.validate 1439-1462, reproduction_args override 1468-1529, status_parts 1541-1560), ignition/planning.py (Plan post_init 179-217, context 352-355, prepared_context 357-363, guaranteed_tokens 366-368, to_dict 379-416, _normalize_parameters 419-432, fit 435-480, plan 521-625), ignition/preparation/bootstrap.py (26-138), ignition/cli/serve.py (59-73, 260-275), ignition/cli/help.py (39-65), ignition/preparation/rebuild_manifest.py (240-335, from_plan 286-335), ignition/preparation/selection.py (76-77), ignition/cli/preparation.py (45-81), ignition/cli/bench.py (150-211), tests/cli/test_planning.py (117-340), tests/cli/test_parameters.py (295-351), tests/cli/test_commands.py (114-170), docs/cli-design.md:446-470 & 1433-1437, docs/preparation-development.md:15-20, helios/src/model.rs:261-273, helios/src/model/catalog.rs:35-70.

FIXED since last turn (withdraw earlier blockers/should-fixes #20, #21-partly, #22, #23, #24):

SHOULD FIX A (duplication of the generic validation mechanism): planning.py:186-190 hand-writes the page-multiple rule and its message in Plan.post_init, although ParamSpec.multiple_of (parameters.py:81) + validate_fields (parameters.py:524-532) already implement "must be a multiple of X" and render it into --help details (parameters.py:283-284). Closest precedent: prefill_chunk declares multiple_of=64 (parameters.py:1302) and additionally enforces its in-recipe bound inside RecipeParameters.validate (parameters.py:1457-1461), which resolve_parameters calls (ignition/cli/preparation.py:55-59) — so prefill-chunk errors surface before planning with the {alias} context, while --request-context errors surface only when a Plan is built and carry no alias. Also the help text at parameters.py:1319 states the rule by hand, duplicating the rendering the mechanism produces. Fix: with multiple_of=N where page size is constant, or a validate() check in RecipeParameters.validate keyed on ctx.recipe.page_tokens (prefill_chunk's form), keeping one home; page size can be adjusted by parameter groups (planning.py:324-325 via adjust_page_tokens, parameters.py:571-575), which is why a static multiple_of may not cover every recipe — but the precedent to copy is the in-validate form, not a new check in Plan.

SHOULD FIX B (new accessor not used by its siblings; one quantity, several names): to_dict (planning.py:379-416) emits context (:395), checkpoint_context (:396) and context_target (via param_dict) but never prepared_context — the quantity this PR adds and every consumer now uses (bootstrap.py:132, serve.py:67-70). Sibling derived values still use recipe.context: guaranteed_tokens (:366-368) and demand_pages (:320-321), so a plan capped at 131072 reports guaranteed_tokens 262144 in the plan JSON and demand_pages sized to the uncapped recipe. Fix: emit prepared_context in to_dict and compute guaranteed_tokens/demand_pages from it (keeps one definition of the served ceiling).

NITS:

VERIFIED CLEAN: bootstrap.py:132 is the single seam every recipe consumes (BasePreparationConfig.context, bootstrap.py:33) and is the only context write on the preparation path; the reproduction_args override (parameters.py:1468-1529) is required, not eccentric, because the generic loop skips base-class fields (:1492-1495) — the explicit emission matches how max_concurrency/prefill_chunk/autotune_effort are handled there; the oversized-target guard in planning.py:187 matches the documented no-op behaviour (docs/cli-design.md:468); no per-model branch and no Helios change (charter line 12); prepared_context mirrors the existing Plan accessor style (properties returning min(recipe value, capacity), e.g. :353-355); tests extend the existing test_planning.py idioms (rebuild_manifest.from_plan + proto round trip, :183-196, :234-239, :311-313).

#31 [high] Research summary

Reviewed PR #533 at head e6239855 through the conventions-and-duplication lens; every changed file read in context. Both previous blockers and the earlier should-fix items are fixed at this head (no max_fn so the clamp is reachable and the new test can pass, --request-context emitted in the reproduction_args override, page-multiple and prefill-chunk bounds present, status_label added, both docs enumerations updated, conditional context_hint).

Two should-fix findings remain: (A) ignition/planning.py:186-190 hand-writes the page-multiple rule in Plan.__post_init__ although ParamSpec.multiple_of (ignition/parameters.py:81, :524-532) and the closest precedent prefill_chunk (parameters.py:1302, validation in RecipeParameters.validate :1457-1461) already provide it and render it into --help; (B) Plan.to_dict never emits prepared_context while guaranteed_tokens (planning.py:366-368) and demand_pages (:320-321) still use the uncapped recipe.context, so a capped plan's JSON reports uncapped guarantees and three names cover one served ceiling.

Three nits recorded (redundant manifest_key/scope, the third hand-rolled min at planning.py:594, the two-fact help line at help.py:46). Full detail in scratchpad entry #30.

#32 [high] Supersedes #20/#22/#23/#24 and #29: consolidated final report for PR #533 at e623985

FINAL REPORT (2026-11-27, run 4) — PR #533 "Cap the per-request context target", head e6239855, base main. Lens: conventions and duplication only. IMPORTANT: entries #20, #22, #23, #24 (blockers about max_fn / reproduction_args / doc enumerations / missing status_label) and #29 are OUTDATED — all of those were fixed at e623985. Do not re-report them. #30 holds the detailed evidence; this note holds the report shape.

VERDICT: should-fix issues only (no blockers). The change follows the established shape: one optional base RecipeParameters field, one Plan accessor, one seam (common_preparation_kwargs), no Helios change, no per-model branch (charter line 12, docs/preparation-development.md:15-40).

FINDINGS

  1. Should fix — ignition/planning.py:186-190 — page-multiple rule is hand-written in Plan.__post_init__ with a bespoke message ("is not a multiple of the {page_tokens}-token page size"), duplicating ParamSpec.multiple_of (ignition/parameters.py:81) + ParameterGroup.validate_fields (:524-532) which already emit exactly that rule and render it into --help (:283-284). Closest precedent: prefill_chunk declares multiple_of=64 (parameters.py:1302) and enforces its in-recipe bound in RecipeParameters.validate (:1457-1461), which resolve_parameters runs before planning (ignition/cli/preparation.py:55-59). Consequences: the identical rule text is also hand-copied into the field help (parameters.py:1319); errors for this flag surface later and without the for {alias} context that every sibling flag's message carries. Fix: use multiple_of where the page size is static, else move the check into RecipeParameters.validate keyed on ctx.recipe.page_tokens, following prefill_chunk. Caveat to state: page size is adjustable by parameter groups (adjust_page_tokens, parameters.py:571-575 used at planning.py:324-325), so a static multiple_of cannot cover every recipe — which is an argument for the in-validate form, not for a new check in Plan.
  2. Should fix — ignition/planning.py:366-368 and :320-321 (with :379-416) — every consumer of the served ceiling now reads prepared_context (bootstrap.py:132, serve.py:67-70, planning.py:212, :594), but the two sibling derived values still use recipe.context: guaranteed_tokens (:366-368) and demand_pages (:320-321), so a plan capped at e.g. 131072 still prints guaranteed_tokens 262144 in the plan JSON (benign for pages, misleading in the record), and to_dict omits prepared_context entirely while emitting context and checkpoint_context. Fix: derive both from prepared_context and emit prepared_context in to_dict so one definition of the ceiling exists.
  3. Nit — ignition/parameters.py:1316-1317 — manifest_key="context_target" restates the fallback key and scope=ParameterScope.DEPLOYMENT restates the ParamSpec default (:89-90, :607-612). Follows prefill_chunk (:1303-1304), so consistency-neutral; droppable.
  4. Nit — ignition/planning.py:594 — effective = min(result.context, result.prepared_context) is a third hand-rolled min over the same numbers context (:353-355) and prepared_context (:357-363) already combine. Fold into one accessor.
  5. Nit — ignition/cli/help.py:46 — the epilog line now carries two facts (context max and page size plus a flag hint) where the sibling lines carry one (help.py:43-45, :51-60).

VERIFIED CLEAN (say so plainly): bootstrap.py:132 is the single seam (BasePreparationConfig.context, bootstrap.py:33) and the only context write on the preparation path; the explicit --request-context emission in the reproduction_args override (parameters.py:1484-1485) is required by the base-field skip (:1492-1495) and matches how max_concurrency/prefill_chunk/autotune_effort are emitted there; the oversized-target exemption in planning.py:187 matches documented no-op behaviour (docs/cli-design.md:468); the accessor mirrors the existing min(recipe value, capacity) property style (planning.py:353-355); the new test extends existing idioms in tests/cli/test_planning.py (:183-196, :234-239, :311-313).

OPEN QUESTIONS only a run settles: whether pytest tests/cli/test_planning.py passes at this head (head has no CI checks; the earlier failures at :310-313 and :324-325 should now be fixed but were not executed); whether any real recipe's adjust_page_tokens changes the page size such that a static multiple_of would reject a valid target (finding 1's caveat).

#3 [medium] Nit: prepared_context/effective_context duplicate Plan.context

Two constructs duplicate existing ones:

  1. Plan.prepared_context (ignition/planning.py:368-373) is a near-copy of Plan.context (planning.py:363-366): min(self.recipe.context, self.tokens) vs min(self.recipe.context, self.context_target, self.tokens). The whole difference is one added term, and context_target is already validated positive at fit() (planning.py:459-460), so min(recipe.context, context_target, tokens) == min(recipe.context, context_target or recipe.context, tokens) would fold into one property. The precedent in this file is the opposite: variant accessors express a real change of quantity (guaranteed_tokens :375-378 gates by pages // concurrency), and callers reduce over the base property rather than keeping a parallel one — e.g. the new code itself writes effective_context = min(result.context, result.prepared_context) at planning.py:694 in plan(), and plan() otherwise only ever returns result (planning.py:692-701). Threading the cap into context and deleting prepared_context would let bootstrap.py:58, the chunk check at :694-700 and to_dict()'s "context" key (:430) all agree on one number with no extra identifier.

  2. effective_context = min(result.context, result.prepared_context) (planning.py:694) is a no-op: with a target set, prepared_context <= context by construction, and with no target prepared_context == recipe.context >= context. So min(result.context, result.prepared_context) == prepared_context when a target is set and == context otherwise — i.e. the line is dead and the "never exceeds the pool capacity" claim in the PR description holds for prepared_context alone. Prefer one term (result.prepared_context after folding, or keep both and drop the min) so the reader does not look for a case where they differ.

Both are nits on their own; recorded together because the fix is the same edit — make context carry the cap and delete the second property and the redundant min.

#4 [medium] Should fix: flag placed in the shared capacity group reaches bench, and has no Configuration home

--request-context is added to the shared capacity argument group in _preparation_arguments (ignition/cli/init.py:156-170), which is applied to every subcommand that has a model: export, bench, debug-serve. Two departures from precedent:

  1. bench cannot honour the "prepared per-request context" contract. Bench exports no core (docs/cli-design.md:212-216) and expresses its own context vocabulary already — --contexts LIST ("consumed context lengths before each measured graph", docs/cli-design.md:239) with the existing validation if selection.required_context > self.context: raise UsageError("benchmark workload and output allowance exceed the prepared context") at planning.py:248-249. With the cap applied, Plan.context stays stock so that check still uses the uncapped context, while the recipe receives the capped one via bootstrap.py:58; the meaningful check (required_context <= prepared_context) is missing. The flag's docs row (docs/cli-design.md:446) and help text (cli/init.py:167-170) speak only of export ("a core's catalog is fixed at export, so changing it requires re-export"), the same wording the neighbouring --mixed-prefill row (:447) uses — but bench rejects --mixed-prefill/--prompt-logprobs explicitly instead of accepting them (bench.py:115-116: "ignition bench measures speculative rounds or unscored prefill; --mixed-prefill and --prompt-logprobs do not apply"). That is the established pattern for a preparation flag bench cannot use.
  2. No config-file home. AGENTS.md "A setting has one of three homes: the recipe declaration, the configuration file, or a command-line flag"; --prefill-chunk-size, --max-concurrency, --image-concurrency and --compile-workers all read configuration.get(...)/configuration.max_concurrency(...) (ignition/cli/config.py:25-41, 162-176; preparation.py:58-94), and --force-moe-decode-a16 has preparation.force_moe_decode_a16. The cap bypasses Configuration entirely: every call site passes context=args.request_context straight through (serve.py:289, :472, bench.py:177) and the default literal None instead of a _DEFAULTS entry. That may be intentional (the docs say "Command line only"), but the row does not say a config key is deliberately absent while its neighbours do state their configuration home, and nothing in the PR records that decision.

Suggested fix: drop --request-context from bench's parser (or reject it in bench.Settings.from_args, as bench.py:115-116 does for the neighbouring flags) unless the benchmark-plan path is taught to compare required_context against prepared_context; and either add a [preparation] request_context key through Configuration or state in the docs row that it is command-line only.

#16 [medium] Nit: prepared_context / effective_context / checkpoint_context triple-report one quantity

Two duplications inside the new mechanism, both nits.

(a) Plan.prepared_context (planning.py:377-381) restates Plan.context (planning.py:371-374):

371  def context(self) -> int:            return min(self.recipe.context, self.tokens)
377  def prepared_context(self) -> int:
379      if self.context_target is None:  return self.recipe.context
381      return min(self.recipe.context, self.context_target, self.tokens)

and then plan() needs a third expression to reconcile them: planning.py:709 effective_context = min(result.context, result.prepared_context). That min is provably a no-op: with a target prepared_context = min(recipe.context, target, tokens) <= context = min(recipe.context, tokens); without one prepared_context = recipe.context >= context. So the chunk check could read result.prepared_context alone. The early None branch is load-bearing (it reproduces the pre-PR value recipe.context, which bootstrap.py used before this PR — bootstrap.py:58), so it cannot just fold into self.context; but the fold is min(self.context, self.context_target) in the capped case, and the reconciling min at :709 can go.

(b) to_dict() (planning.py:438) now emits four context numbers on one line: context (pool-bound, unchanged), context_target, prepared_context, checkpoint_context (= recipe.context, which equals prepared_context whenever no target is set). context_target plus prepared_context alone determine the served ceiling; checkpoint_context is the third overlapping spelling of the same quantity. The new test pins d["context"] == capped.context (tests/cli/test_planning.py:227), so context's meaning is now deliberate — fine — but a reader of the JSON has to know which of the three remaining keys is the served one.

Neither is blocking; report them as nits with the fix "drop effective_context in favour of result.prepared_context".

#23 [medium] Should fix: the two "core universal fields" enumerations were not updated with --request-context

Head 9118add. The new --request-context is a core universal RecipeParameters field (ignition/parameters.py:1309-1321, alongside max_concurrency/prefill_chunk/autotune_effort/compile_workers/lock_gpu_clocks/compiled_forwards/roce_ring/roce_chain), but the two documents that enumerate exactly that universal field list were not updated:

Both are closed enumerations of the same list, so the PR leaves two statements that contradict the code it adds; a reader following the prep-development doc concludes the cap lives in an external recipe package. The PR did add the flag row at docs/cli-design.md:468 and the owner row at :1436, so this is an omission in one place, not missing documentation overall.

Fix: add --request-context / context_target to both enumerations (they are the single source of "which fields are core"), or replace each enumeration with a pointer to ignition/parameters.py so the list cannot drift again.

Rule cited: AGENTS.md:56-60 (state present qualification, keep design docs accurate; partially stale enumerations are the kind of bad docs the charter lists as mergeable).

#24 [medium] Should fix: the cap is missing from the printed plan line because the field declares no status_label

Head 9118add.

ignition export MODEL --request-context 131072 prints a "Select GPUs" line whose contents now come from plan.parameters.status_parts(plan.parameter_context) (ignition/cli/serve.py:269). ParameterGroup.status_parts renders a part only when the spec declares status_label (ignition/parameters.py:694-707; RecipeParameters override at :1554-1559).

The new context_target spec (parameters.py:1309-1321) declares no status_label, so the cap is invisible in the printed report, unlike the other base-class fields that carry serving-visible settings: roce_ring/roce_chain declare status_label=lambda v: ... if v else None (parameters.py:1368, :1377), and the ABI groups implement status_parts (parameters.py:1027, :1166, :1196, :1259).

Why it matters: AGENTS.md:452-456 (Configuration) — "A setting that only experiments need is an advanced flag carried through the plan into the recipe's PreparationConfig, so the plan, its printed report, and its recorded measurements describe what was prepared." The plan (Plan.to_dict, planning.py:379-416, emits context_target because the base field is in_dict=True) and the bench record (bench.py:265 **plan.parameters.to_dict(plan.parameter_context)) both carry it; only the printed report does not. So two of the three surfaces the rule names are covered and one is not.

Fix, matching the roce precedent exactly: status_label=lambda v: f"request context {v:,}" if v is not None else None, on parameters.py:1309-1321. Guarded (returns None when unset) so a stock export's line stays byte-identical, which is what the roce lambdas do.

#25 [low] Nits: unconditional context_hint, three names for one served ceiling, overlapping accessors

Head 9118add.

N1 — context_hint now advertises the flag unconditionally (ignition/cli/serve.py:68): "context is limited by the checkpoint, cache capacity, and --request-context cap". When the flag is unset — still the default and the byte-equivalent path the PR claims — plan.prepared_context is recipe.context and the hint names a cap the deployment never applied. Neighbouring optional-feature strings in the same dict are keyed on presence (**({"decode_weight_bytes": ...} if checkpoint.decode_weight_bytes > 0 else {}), serve.py:70). Fix: append the cap clause only when plan.parameters.context_target is not None, same guard shape as parameters.py:1368.

N2 — one served ceiling, three names in Plan.to_dict (ignition/planning.py:395-397 plus the generic **param_dict spread at :392): context (min(recipe.context, tokens), pool-derived), prepared_context (min(recipe.context, context_target)), checkpoint_context (recipe.context), plus context_target from the parameter dict. With no target, prepared_context == checkpoint_context; with a capped pool, context and prepared_context coincide again. A JSON consumer must know which is the served bound. Precedent for restraint: to_dict names each measure once (pages/tokens/guaranteed_tokens are distinct quantities, not restatements). Fix: drop checkpoint_context (it is recipe.context, already recoverable from the recipe) or document the three in one comment.

N3 — Plan.prepared_context (planning.py:357-363) and Plan.context (planning.py:352-355) are two accessors for "a per-request token ceiling" differing by one term; the new test pins both meanings (tests/cli/test_planning.py:302-303), so this is defensible, but the docstrings should state the relationship explicitly ("context is bounded by the prepared pool; prepared_context is the export-time ceiling") rather than each describing itself alone.

All three are cosmetic/convention-level; none change behavior.