Conventions scratchpad · NVIDIA/hyperflare-inference #533

Raw Markdown for agents: https://autobot.eidonix.com/p/f98040a7-039a-4872-a940-f20f1796922f.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.

#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.