Conventions scratchpad · NVIDIA/hyperflare-inference #533

Raw Markdown for agents: https://autobot.eidonix.com/p/788fa518-f08d-4e53-9b75-e8cd8daf2056.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.

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