Simplicity scratchpad · NVIDIA/hyperflare-inference #533

Raw Markdown for agents: https://autobot.eidonix.com/p/e1b05b25-4025-4300-bafc-dd59e7630578.md

#1 [high] BLOCKING: multi-host export silently drops --request-context

PR #533 adds --request-context to the shared _preparation_arguments group (ignition/cli/init.py:167-170), so export, debug-serve and bench all accept it. Three of the four planning call sites were threaded:

The fourth, _export_hosts (ignition/cli/serve.py:163-250), which export() dispatches to when args.ranks > 1 (serve.py:153-156), calls planning.plan(...) at serve.py:193-206 with no context= argument. plan() defaults context=None, so a multi-host export with --request-context 131072 prepares the recipe maximum and reports success.

Rule violated: AGENTS.md "Don't silently ignore API fields" / charter line "If a standard request field is passed in, either implement it according to the spec or reject it." Also the new docs row (docs/cli-design.md:446) promises the cap applies on export, with no multi-host carve-out.

Fix: pass context=args.request_context into the planning.plan call at serve.py:205-206, next to row_shard_prefill=args.row_shard_prefill. A test asserting _export_hosts/plan() receives the target (or rejecting --request-context with --ranks > 1) settles it.

#2 [high] SHOULD FIX: plan report and reproduction args omit the new setting

Plan.context_target (ignition/planning.py:176) is read only by Plan.prepared_context (planning.py:369-373) and set by fit (planning.py:535). Two plan-introspection paths that every other setting in the plan goes through were not updated:

  1. Plan.to_dict() (planning.py:389-442) still publishes only "context": self.context (line 430) and "checkpoint_context": self.recipe.context. Neither the requested target nor prepared_context appears. This dict is the JSON plan printed by export/debug-serve/bench (serve.py:215, serve.py:485, bench.py:182) and saved as the benchmark's preparation record (bench.py:237-248, which hand-picks keys). After --request-context 131072 the printed plan therefore shows context = min(recipe.context, tokens) — the stock number — and nothing that says the core was prepared for 131072.

  2. rebuild_manifest.reproduction_arguments() (ignition/preparation/rebuild_manifest.py:231-318) emits --max-concurrency, --prefill-chunk-size, --row-shard-prefill, --autotune-effort, etc., but not --request-context (grep: no occurrence outside planning.py/cli). So flare inspect's reproduction_args, and the preparation.parameters list built by from_plan (rebuild_manifest.py:343-454), cannot reproduce the exported core: replaying them silently yields the recipe maximum.

Rule: AGENTS.md Configuration section — "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."

Fix: add "prepared_context": self.prepared_context (and the target, or just the prepared value) to to_dict, and add to reproduction_arguments: if plan.context_target is not None: args.extend(['--request-context', str(plan.context_target)]) plus a SCOPE_DEPLOYMENT entry in from_plan if the parameter list is meant to be complete.

#3 [high] Lens D consolidated: tests absent, validation misplaced, prose bloat

Lens D (simplicity) findings, all verified in code (three earlier scratchpad_write calls failed at turn end; this consolidates them):

a) NO TESTS. Nothing in tests/ references --request-context, context_target or prepared_context (search_code over tests/ returns no matches). The PR adds a CLI flag, a dataclass field, a property, a validation and a rewritten error with no test. AGENTS.md "Require focused, meaningful validation" ("Tests must exercise the affected behavior or contract"); charter "Bring real evidence". #454 (same author, same feature) was rejected partly for exactly this and it is unchanged. Smallest proving test, using the fixture recipe in tests/cli/test_planning.py (context=262144, prefill_chunk=4096, page_tokens=64): (i) planning.fit(..., context=65536).prepared_context == 65536; (ii) omitting context gives prepared_context == recipe.context and is == the stock plan — this is the PR's loudest claim ("omitting the flag is a no-op, byte-equivalent to stock") and is currently only asserted by prose; (iii) common_preparation_kwargs(plan, ...)["context"] == 65536 (ignition/preparation/bootstrap.py:58), which is the one line that makes the cap reach the core; (iv) planning.plan(..., context=2048) raises the new default-chunk error, and with an explicit --prefill-chunk-size above the cap raises the other arm.

b) THE POSITIVE-TARGET CHECK IS IN THE WRONG PLACE, and can be deleted from fit. fit validates at ignition/planning.py:459-460, but fit runs inside plan.fitted() which is called once per candidate world size (planning.py:684-690) and again for every option probe (planning.py:707-724), so a value that cannot change is re-checked many times per command. Smaller version: drop the if context is not None and context <= 0: raise ... branch from fit (planning.py:459-460) and validate once — either in the flag (type= helper on capacity.add_argument at cli/init.py:167) or with a single guard at the top of plan() beside the other flag validation (planning.py:601-619), which already carries the --max-concurrency and --image-concurrency range checks. Same message, one site, outside the candidate loop.

c) DEAD EXPRESSION. At planning.py:694, effective_context = min(result.context, result.prepared_context). prepared_context is min(recipe.context, ...), so prepared_context <= recipe.context and context == min(recipe.context, tokens): the min can never select result.context unless it equals prepared_context. Write if chunk > result.prepared_context: and use result.prepared_context in both message arms; delete the local.

d) FAT ERROR TEXT (nit). planning.py:696-700, the default arm says "pass --prefill-chunk-size (a multiple of 64) below 131,072 or a larger --request-context", restating syntax the help already gives (cli/init.py:163-166 states "a multiple of 64"). The two arms can stay (the maintainer asked for the distinction in #454) but both can be one line each.

e) HELP TEXT AND DOCS ROW ARE LONGER THAN THE SETTING (nit). cli/init.py:167-170: "…Omitted flag uses the recipe's max context (the pool fills the free VRAM)" — the parenthetical explains sizing nobody asked about and duplicates the docs. Sibling --prefill-chunk-size uses one clause plus a default. Suggested: help="cap the prepared per-request context and max_sequence_tokens at N tokens; longer requests are rejected (default: the recipe's maximum context)". docs/cli-design.md:446 likewise carries a rationale clause ("Shortening the per-request context buys concurrency headroom in a memory-constrained multi-model deployment, since the per-request cache allocation is sized from the prepared context") that duplicates the Configuration-table row at :1443 and the KV section at :829-841; keep the convention used by neighbours ("Command line only; a core's catalog is fixed at export, so changing it requires re-export"), drop the rationale to the PR description.

f) NOT A FINDING: the flag's placement in the capacity and compression argument group (cli/init.py:156) is right; Plan.context_target as an optional field is the minimal change and needs no enum or config key; prepared_context returning the recipe max when unset (planning.py:371-372) is a deliberate no-op that keeps the existing recipes unchanged, so it should stay rather than be folded into context.