Simplicity scratchpad · NVIDIA/hyperflare-inference #533

Raw Markdown for agents: https://autobot.eidonix.com/p/40c8f05e-db37-4a4a-ae71-6950bcde92e4.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.

#5 [high] Report of 2026-11-26 (head de1b5b5) — lens D]

Review of PR #533 "Cap the per-request context target" — lens D (simplicity), head de1b5b5

Diff re-read at de1b5b5 (9 files, +98/−18).

Resolved since my 2026-11-25 report (entry #4)

Findings

1. Should fix — prepared_context can be collapsed so the duplicate clamp disappears

ignition/planning.py:371-375 returns the recipe max when unset and min(recipe.context, target, tokens) otherwise; callers then re-clamp at :696. Smaller version:

@property
def prepared_context(self) -> int:
    """The context the prepared core serves per request."""
    return self.context if self.context_target is None else min(self.context, self.context_target)

(self.context already is min(recipe.context, self.tokens), :368.) Then planning.py:696-700 uses result.prepared_context directly and the local effective_context goes away. Behaviour identical, 6 lines → 3, and no reader has to prove prepared_context <= context.

2. Should fix — the test proves the property's own arithmetic, not the behaviour that matters

tests/cli/test_planning.py:220-232,247 asserts e.g. capped.prepared_context == min(recipe.context, 131072, capped.tokens) and capped.context == min(recipe.context, capped.tokens) — restatements of planning.py:368,375. The one seam the PR actually depends on, ignition/preparation/bootstrap.py:58 ("context": plan.prepared_context), is never asserted, so nothing pins "the cap reaches max_sequence_tokens". The established pattern is tests/cli/test_commands.py:88-91. Add two lines:

kwargs = common_preparation_kwargs(capped, compile_forwards=True, kernel_cache=None, retain_graphs=False)
assert BasePreparationConfig(**kwargs).context == 131072
assert BasePreparationConfig(**common_preparation_kwargs(stock_plan, compile_forwards=True,
    kernel_cache=None, retain_graphs=False)).context == recipe.context   # no-op path

and drop the mirrored min(...) assertions that only restate the property.

3. Should fix — recorded measurements still omit the prepared context

ignition/cli/bench.py:243-248 hand-picks the preparation record's keys and contains no context key at all, so a benchmark result records neither context_target nor the prepared context; Plan.to_dict (planning.py:432) publishes the stock "context" beside "context_target" but not the prepared value. AGENTS.md:454-456 requires the plan's recorded measurements to describe what was prepared. Fix: add "prepared_context": self.prepared_context next to "context_target" and add "context_target", "prepared_context" to the bench key tuple.

4. Nit — the positive-target check lives in fit, which runs per candidate and per probe

ignition/planning.py:461-462 runs once per candidate world size and once per shortfall option probe (planning.py:664-692, :707-724); every other CLI range check sits once in plan() (:623-625). Move the identical guard beside the chunk check.

5. Nit — the new default-chunk error is one long line that restates the fix twice

ignition/planning.py:699 is ~170 characters and spells both the constraint and the remedy; both arms say the same thing and differ only in naming the default. One arm suffices, e.g.

raise UsageError(f"--prefill-chunk-size {chunk:,} exceeds the {result.prepared_context:,}-token prepared context")

plus, only when prefill_chunk is None, a ; the default chunk is {chunk:,} clause. The (a multiple of 64) hint belongs to --prefill-chunk-size's own help (cli/__init__.py:163-166).

6. Nit — help text and docs row are longer than the setting

ignition/cli/__init__.py:167-170 spends three lines ("cap the prepared context and max_sequence_tokens at N; a request that would exceed N is rejected. Omitted flag uses the recipe's max context") where the neighbour's pattern is one clause plus a default: "cap the prepared per-request context at N tokens; longer requests are rejected (default: the recipe's maximum)". docs/cli-design.md:446 carries a rationale sentence ("With --kv-cache-limit concurrency, shortening … frees VRAM") that repeats the KV-limit section (docs/cli-design.md:828-833) and the two owner rows this PR edits (:1443, :1493); keep the tabular behaviour and the existing "Command line only" clause, move the rationale to the PR description (repo-prose skill: documentation is a present-state spec, not an argument; AGENTS.md:43-50).

Checked and deliberately not reported

#6 [high] Research summary

Reviewed PR #533 at head de1b5b5 through lens D (simplicity). The three findings from my previous pass are gone: multi-host export now forwards context= (serve.py:206), the page-multiple validation sits in Plan.__post_init__ (planning.py:289), and to_dict/reproduction_arguments/from_plan all record the setting, with one test in tests/cli/test_planning.py:211-265. I also corrected my own earlier nit: the min(result.context, result.prepared_context) at planning.py:696 is not dead, because with no target prepared_context is the recipe max, which can exceed the pool-bound context — the real simplification is to fold the clamp into the accessor.

Remaining, minor: (1) collapse prepared_context to self.context if self.context_target is None else min(self.context, self.context_target) and drop the local effective_context, which keeps stock semantics with three lines; (2) the new test asserts restatements of the property's own min(...) expressions and never asserts common_preparation_kwargs(...)["context"], the one seam that makes the cap reach max_sequence_tokens — two lines in the existing test_commands.py:88 pattern would pin it; (3) bench's hand-picked preparation record (bench.py:243-248) and to_dict still never state the prepared context, so the recorded measurement does not describe what was prepared (AGENTS.md:454-456) — add prepared_context to both; (4) the positive-target check belongs beside the other CLI range checks in plan() rather than in fit, which runs per candidate and per shortfall probe; (5) nits: the ~170-character two-arm default-chunk error and the three-line help entry plus the rationale clause in the docs row (docs/cli-design.md:446), both longer than the setting they describe.

Full detail, with the smaller version of each change, is in scratchpad entry #5.

#7 [high] Lens-D verdict and exact citations for the final report

Verdict and citation sheet (head de1b5b5, 2026-11-26)

Verdict for lens D: no blocking issues. The feature is already minimal; what remains is three small simplifications/fixes and three nits. Detail and smaller versions are in entry #5; this note adds the citations the report must carry.

Resolved since my 2026-11-25 report (entry #4) — verified in the code

Citations per finding

  1. Should fix — collapse the duplicate clamp. ignition/planning.py:371-375 (accessor) and :696-700 (caller). Smaller version: return self.context if self.context_target is None else min(self.context, self.context_target); then the caller uses result.prepared_context and the local effective_context goes away.
  2. Should fix — test proves arithmetic, not the seam. tests/cli/test_planning.py:220-232 and :247 restate planning.py:368,375 (min(recipe.context, 131072, capped.tokens), min(recipe.context, capped.tokens)). ignition/preparation/bootstrap.py:58 ("context": plan.prepared_context) is unasserted. Pattern to copy: tests/cli/test_commands.py:88-91 (common_preparation_kwargs → BasePreparationConfig). Rule: AGENTS.md:194-199 ("Require focused, meaningful validation … Tests must exercise the affected behavior or contract").
  3. Should fix — recorded measurement omits the prepared context. ignition/cli/bench.py:243-248 hand-picks the preparation keys and has no context key at all; ignition/planning.py:432 publishes stock "context" beside "context_target" but not prepared_context. Rule: AGENTS.md:454-456 ("the plan, its printed report, and its recorded measurements describe what was prepared"). Fix: "prepared_context": self.prepared_context in to_dict, and add "context_target", "prepared_context" to the bench tuple.
  4. Nit — validation placement. ignition/planning.py:461-462 inside fit, re-entered per candidate and per shortfall probe via fitted/candidates/attempt (planning.py:664-692, :707-724); every other CLI range check is once in plan() — --prefill-chunk-size at planning.py:623-625.
  5. Nit — two-arm chunk error too long. ignition/planning.py:697-700; the first arm is reachable only via an explicit target below the default 4096-token chunk (pool floor is 8192 tokens: MINIMUM_REQUEST_TOKENS at planning.py:32, minimum_pages at :336), so keep one arm plus an optional "; the default chunk is N" clause. (a multiple of 64) already lives in --prefill-chunk-size help (ignition/cli/__init__.py:163-166).
  6. Nit — help and docs prose longer than the setting. Help: ignition/cli/__init__.py:167-170 (three lines) against neighbour style at :163-166. Docs row: docs/cli-design.md:446; its rationale duplicates the KV-limit section docs/cli-design.md:828-841 and the two owner rows this PR edits (:1443, :1493). Rules: AGENTS.md:43-50 (required prose review) and the prose skill's "documentation is a present-state specification, not a changelog" (.agents/skills/repo-prose/SKILL.md:26-29).

Checked and not reported

#9 [high] Report of 2026-11-26, run 1310 — lens D, head 02023eba

Review of PR #533 "Cap the per-request context target" — lens D (simplicity)

Head 02023eba (single new commit on f377dc85), 9 files, +84/−18 per the packet (pr_files: docs/cli-design.md +3/−2, cli/init.py +2, cli/bench.py +3/−1, cli/preparation.py +1/−1, cli/serve.py +5/−4, planning.py +19/−9, preparation/bootstrap.py +1/−1, preparation/rebuild_manifest.py +3, tests/cli/test_planning.py +47).

Verdict

Blocking: 1. Should fix: 2. Nits: 5.

Blocking

A. tests/cli/test_planning.py:238-240 asserts a validation the head no longer has; the test cannot pass

Should fix

B. planning.py:376-381 + :709 — the clamp exists twice; fold it into the accessor and delete the local

Current:

@property
def prepared_context(self) -> int:
    """The context the prepared core serves per request; the recipe max when no target is set."""
    if self.context_target is None:
        return self.recipe.context
    return min(self.recipe.context, self.context_target, self.tokens)
...
effective_context = min(result.context, result.prepared_context)
if chunk > effective_context:
    raise UsageError(f"--prefill-chunk-size {chunk:,} exceeds the {effective_context:,}-token context this plan allows")

self.context is exactly min(self.recipe.context, self.tokens) (planning.py:371-374), so the smaller version is behaviour-identical:

@property
def prepared_context(self) -> int:
    """The context the prepared core serves per request; the recipe max when no target is set."""
    return self.context if self.context_target is None else min(self.context, self.context_target)
...
if chunk > result.prepared_context:

Deletes the local effective_context, one line, and makes "prepared_context never exceeds the pool capacity" true by construction instead of by a second clamp each caller must re-derive. Six lines → three. (The early return must stay — with no target it returns recipe.context, which can exceed the pool-bound context; checked, not dead.)

C. tests/cli/test_planning.py:219-232, :244 — the test restates the accessor's arithmetic and never asserts the seam it is about

assert stock_plan.prepared_context == recipe.context, assert capped.prepared_context == min(recipe.context, 131072, capped.tokens), assert capped.context == min(recipe.context, capped.tokens), assert stock_plan.context == min(recipe.context, stock_plan.tokens) are all restatements of planning.py:374,381 — they pass even if ignition/preparation/bootstrap.py:58 stopped reading plan.prepared_context, which is the only line that carries the cap into max_sequence_tokens. AGENTS.md:194-199 ("Tests must exercise the affected behavior or contract"); the description claims the test covers "the bootstrap value" — it does not. Fix (pattern already in the repo, tests/cli/test_commands.py:94-97):

kwargs = common_preparation_kwargs(capped, compile_forwards=True, kernel_cache=None, retain_graphs=False)
assert BasePreparationConfig(**kwargs).context == 131072
assert BasePreparationConfig(**common_preparation_kwargs(
    stock_plan, compile_forwards=True, kernel_cache=None, retain_graphs=False)).context == recipe.context

Two assertions replace four mirrored min(...) lines and pin both the cap and the no-op path.

Nits

  1. planning.py:467-468 — the positive check lives in fit, re-entered per candidate world size and per shortfall probe (planning.py:677-705, 714-731); every sibling CLI range check is once in plan() (e.g. :634-637). With A's alignment check restored, put both in one place.
  2. serve.py:319 — f"{' · request context ' + format(plan.prepared_context, ',') if plan.context_target is not None else ''}"; neighbours all use f-string formatting (· concurrency {plan.concurrency}). Use f"{f' · request context {plan.prepared_context:,}' if plan.context_target is not None else ''}" (the only format(..., ',') call in ignition/).
  3. tests/cli/test_planning.py:255-257 — three blank lines before def test_row_shard_attention_...; two (or one, in a 357-line file that otherwise separates by two).
  4. context= keyword naming — the same value is --request-context in the CLI, context in fit/plan (planning.py:461,605) and context_target in the plan/to_dict (planning.py:186,438). Naming the parameter context_target deletes the translation at planning.py:549 (language_model_only=..., context_target=context) and the reader's doubt about which bound is meant.
  5. docs/cli-design.md:446 — "Cap … at N tokens, below the recipe's maximum" reads as a rejection rule, but the code clamps a larger N (planning.py:381 and the test at :229-232). Say it resolves to the smaller of N, the recipe maximum, and the KV pool. Related: docs/cli-design.md:1443 says "The checkpoint maximum" where the new row says "the recipe's maximum" (one term), and ignition/cli/help.py:38 advertises --prefill-chunk-size: 64..{recipe.context}, a range above the prepared context once capped.

Resolved at this head (do not re-raise)

Not verifiable here

#10 [high] Trace: why tests/cli/test_planning.py:238-240 fails and the dropped alignment check matters

Trace backing finding A (tests/cli/test_planning.py:238-240 fails at head 02023eba):

  1. Head has no page-multiple validation. Verified by full read of Plan.__post_init__ (ignition/planning.py:224-296) and fit (453-556): the only new context check is planning.py:467-468 (context is not None and context <= 0). search_code for multiple in ignition/planning.py returns only :636 (--prefill-chunk-size ... multiple of 64); % self.page_tokens has no match anywhere. The check existed at planning.py:289-290 in head de1b5b5 — it was dropped in the rewrite.
  2. planning.plan(..., context=100) on the fixture (context=262144, page_tokens=64, prefill_chunk=4096; tests/cli/test_planning.py:37-42): passes :635 (4096 % 64 == 0, 64 <= 4096 <= 262144), passes :467 (100 > 0), builds a fitting Plan (weights 60 GiB/2 = 30 GiB, graph 4 GiB, 94 GiB supply), then :709-711 computes effective_context = min(result.context, result.prepared_context) = min(262144, 100) = 100 and raises UsageError("--prefill-chunk-size 4,096 exceeds the 100-token context this plan allows").
  3. pytest.raises(UsageError, match="multiple of the") therefore fails with DID NOT MATCH — the test cannot pass at this head, and the head has no CI checks.
  4. Why the deletion matters beyond the test: Helios requires prepared_sequence_tokens and limits.max_sequence_tokens to be page multiples and rejects the core at load (helios/src/model/catalog.rs:49-57 "invalid prepared model configuration"), so an unaligned --request-context 1000 exports an unusable core. The PR description still claims "a page-multiple validation" and a chunk error that "distinguishes the default chunk from an explicit one"; the head has a single chunk message (planning.py:710-711).

Restore suggestion (keeps :229-232 clamp case valid): if self.context_target is not None and min(self.recipe.context, self.context_target, self.tokens) % self.page_tokens: raise UsageError(f"--request-context {self.context_target:,}: the {self.page_tokens:,}-token page size requires a multiple") — 100 % 64 = 36 rejected, 500000 → 262144 aligned.

#11 [high] Lens-D subtraction inventory and exact smaller versions (head 02023eba)

Lens-D subtraction inventory at head 02023eba (what to delete / shrink), each checked in code:

  1. ignition/planning.py:709-711 — local effective_context = min(result.context, result.prepared_context) duplicates the accessor's own pool bound (self.context == min(recipe.context, tokens) at :371-374). Fold into the accessor: return self.context if self.context_target is None else min(self.context, self.context_target) (:376-381) and test chunk > result.prepared_context. Behaviour-identical, one local gone (~1 line + 1 name).
  2. tests/cli/test_planning.py:220-227, 243-244 — four assertions restate planning.py:374/381 (min(recipe.context, 131072, capped.tokens) etc.) and two are trivial echoes (d["context_target"] == 131072; stock_plan.context_target is None). None would fail if ignition/preparation/bootstrap.py:58 stopped reading plan.prepared_context. Replace with the seam check patterned on tests/cli/test_commands.py:94-97 (common_preparation_kwargs → BasePreparationConfig(**kwargs).context), which pins both the cap and the no-op path in two lines. AGENTS.md:194-199 is the rule.
  3. ignition/cli/serve.py:319 — the only format(x, ',') call in ignition/; neighbours are f-strings. f"{f' · request context {plan.prepared_context:,}' if plan.context_target is not None else ''}".
  4. ignition/planning.py:461,605,549 — parameter called context at both entry points, stored as context_target, so fit ends with context_target=context. Renaming the parameter context_target deletes the translation line's ambiguity (2 signatures + 1 call site).
  5. ignition/planning.py:467-468 — the positive check sits in fit, which plan() re-enters per candidate size and per shortfall probe (:677-705, :714-731); sibling CLI checks are once in plan() (:634-637).
  6. tests/cli/test_planning.py:255-257 — three consecutive blank lines before the next test (file otherwise uses two).
  7. docs/cli-design.md:446 — "below the recipe's maximum" reads as a rejection rule but the code clamps (planning.py:381 + the test at :229-232). Also :1443 says "The checkpoint maximum" vs the new row's "the recipe's maximum", and ignition/cli/help.py:38 advertises --prefill-chunk-size: 64..{recipe.context}, a range above the prepared context once capped.

Verified load-bearing, do not cut: the context_target is None early return (:379-380; returns recipe.context, which can exceed the pool-bound context), derive(context=...) (cli/preparation.py:56,68 — funnel for all four entry points), prepared_context in Plan.__post_init__ benchmark check (:260), and the guarded manifest entries (rebuild_manifest.py:264-265, :389).

Already fixed at this head (earlier findings, do not re-raise): to_dict publishes prepared_context (:438); bench tuple has context_target, prepared_context (cli/bench.py:247-248); serve line prints the cap (serve.py:319); help is one line (cli/init.py:167-168); two-arm chunk error gone.

#12 [high] Research summary

Reviewed PR #533 at head 02023eba through lens D (simplicity). Notes are entries #9 (full report), #10 (trace backing the blocker) and #11 (subtraction inventory with the smaller version for each item).

Verdict: one blocking issue, two should-fixes, five nits.

Blocking — the new test cannot pass, and the validation it tests was dropped in the rewrite (tests/cli/test_planning.py:238-240 vs ignition/planning.py). A full read of Plan.__post_init__ (planning.py:224-296) and fit (453-556) shows the head has no page-multiple check — only the positive-target guard at :467-468; grep for "multiple" in planning.py finds only the --prefill-chunk-size rule at :635-637. So planning.plan(..., context=100) raises the chunk error at :710-711 ("4,096 exceeds the 100-token context"), and match="multiple of the" fails. Fixing it matters beyond the test: Helios rejects a core whose max_sequence_tokens is not a page multiple (helios/src/model/catalog.rs:49-57), so --request-context 1000 would export an unloadable core. Restoring the check on the served value (min(recipe.context, target, tokens) % page_tokens) keeps the clamp case at :229-232 valid. The description still claims "a page-multiple validation" and a two-arm chunk error; both are stale.

Should fix: (B) the pool clamp exists twice — effective_context = min(result.context, result.prepared_context) at planning.py:709 duplicates the accessor's own bound; folding it into prepared_context (self.context if self.context_target is None else min(self.context, self.context_target)) is behaviour-identical and deletes the local. (C) the new test restates the accessor's arithmetic and never asserts common_preparation_kwargs(...)["context"], the bootstrap seam (bootstrap.py:58) that carries the cap into max_sequence_tokens; two lines in the tests/cli/test_commands.py:94-97 pattern pin it.

Nits: positive check in per-candidate fit rather than once in plan(); format(x, ',') in serve.py:319 where every neighbour is an f-string; three blank lines at tests/cli/test_planning.py:255-257; context= parameters translated to context_target at planning.py:549; docs/cli-design.md:446 says "below the recipe's maximum" while the code clamps, plus the "checkpoint"/"recipe" maximum term split at :1443 and help.py:38 (not opened) advertising a chunk range above the cap.

Verified clean and not re-raised: to_dict/bench/printed-plan-line reporting, all four entry points forwarding the flag, and the manifest guard.

#13 [high] Final report skeleton — verdict, ordering, and what is already resolved

Skeleton for the final report — PR #533, lens D (simplicity), head 02023eba, base main. Details live in #9 (full report), #10 (blocker trace), #11 (subtraction inventory + smaller versions).

Verdict line: "One blocking issue, two should-fix findings, five nits." (Lens D contributes the simplifications; the blocker is a correctness/test defect the rewrite introduced and must be stated first.)

Ordering and one-line summaries:

  1. BLOCKING — tests/cli/test_planning.py:238-240 cannot pass, and the page-multiple validation it exercises is gone from the head. No such check exists in Plan.__post_init__ (ignition/planning.py:224-296) or fit (453-556); only the positive guard at :467-468. context=100 instead hits the chunk error at planning.py:710-711, so match="multiple of the" fails. Real consequence: Helios rejects a non-page-multiple max_sequence_tokens at load (helios/src/model/catalog.rs:49-57), so an unaligned --request-context exports an unusable core. Fix: restore one check on min(recipe.context, target, tokens) % page_tokens; the 500000 clamp case at :229-232 stays valid. Description still claims the validation and a two-arm default-chunk error — both stale.
  2. SHOULD FIX — duplicate clamp: planning.py:709 effective_context = min(result.context, result.prepared_context) vs accessor :376-381. Smaller version: return self.context if self.context_target is None else min(self.context, self.context_target) and if chunk > result.prepared_context:.
  3. SHOULD FIX — test proves arithmetic, not the seam: tests/cli/test_planning.py:220-227, :243-244; unasserted ignition/preparation/bootstrap.py:58. Fix pattern: tests/cli/test_commands.py:94-97 (common_preparation_kwargs → BasePreparationConfig), two assertions covering cap and no-op path. Rule: AGENTS.md:194-199.
  4. NITS (5): positive check inside per-candidate fit (planning.py:467-468) instead of once in plan() (:634-637 neighbourhood); the only format(x, ',') in ignition/ at serve.py:319 where neighbours are f-strings; three blank lines at tests/cli/test_planning.py:255-257; context= CLI keyword translated to context_target at planning.py:549; docs/cli-design.md:446 "below the recipe's maximum" contradicts the clamp, plus :1443 "checkpoint maximum" vs "recipe's maximum" and ignition/cli/help.py:38 chunk range above the cap.

Say plainly resolved at this head (so the author is not asked to redo them): to_dict publishes prepared_context (planning.py:438); bench tuple carries context_target, prepared_context (cli/bench.py:247-248); printed plan line shows the cap (serve.py:319); help is one line (cli/init.py:167-168); all four entry points forward the flag (serve.py:207, :291, :476, bench.py:177); omission is a no-op (rebuild_manifest.py:264-265 guarded, add() skips None at :350-352).

Also state: no CI on the head and no pytest run in this review — the blocker is settled by pytest tests/cli/test_planning.py -k request_context; the VRAM table stays a description claim dependent on --kv-cache-limit concurrency; no attempt to direct the reviewer was found.

#15 [high] Lens-D findings at head 9118add (PR #533) — the clamp is unreachable and the new test's oversized case fails

Head 9118add, 6 files +69/−5.

BLOCKING — the documented clamp cannot happen; tests/cli/test_planning.py:310-313 fails.

  1. ignition/parameters.py:1309-1321 declares context_target with min_value=1, max_fn=_recipe_context_limit (parameters.py:1268-1269 → recipe.context). ParameterGroup.validate_fields (parameters.py:533-545) rejects value > max_val, so --request-context 500000 on a 262,144-context recipe raises "--request-context for ALIAS must be 1 through 262,144" in resolve_parameters/plan() (planning.py:540) — before any plan exists.
  2. ignition/planning.py:186-190 checks alignment of the RAW target (target % self.page_tokens), so an unaligned oversized target (500000 % 64 = 32) is also rejected.
  3. Therefore tests/cli/test_planning.py:310-313 (oversized_params = replace(base_params, context_target=500000); expects oversized.prepared_context == recipe.context) raises UsageError and the test fails — twice over.
  4. docs/cli-design.md:468 and the PR description say the flag "resolves to the smaller of N and the recipe maximum", and prepared_context (planning.py:357-363) computes min(self.recipe.context, target). That min is dead while max_fn stands: target can never exceed recipe.context.

Smaller version (keep the clamp the docs and accessor advertise, one check, on the value actually served):

Also: Leios rejects a core whose max_sequence_tokens is not a page multiple (helios/src/model/catalog.rs:49-57), so the alignment check must survive in some form.

#16 [high] Lens-D: test never checks the seam; unused monkeypatch; redundant assertions at head 9118add

tests/cli/test_planning.py:295-329 (head 9118add), lens D:

#17 [high] Lens-D nits at head 9118add (PR #533)

Head 9118add. Nits (lens D):

  1. ignition/parameters.py:1317 manifest_key="context_target" duplicates the field name; the fallback at parameters.py:607-612 already yields context_target. Drop the line.
  2. ignition/parameters.py:1319 repro_always=True is dead: reproduction_args (parameters.py:1516-1520) skips None values before the repro_always test, and the field's default is None, so any non-None value already differs from the default. Drop it (unlike max_concurrency, whose default 4 needs it).
  3. ignition/planning.py:186-190: the alignment check sits in Plan.__post_init__, which fit() re-enters for every candidate world size (planning.py:577) and every shortfall probe (planning.py:599-620); it also validates the raw context_target rather than the value actually served. One check on self.prepared_context at the top of plan() (beside parameters.py:1458's chunk rule) would be evaluated once and would state the rule the core must satisfy (helios/src/model/catalog.rs:49-57 requires max_sequence_tokens to be a page multiple).
  4. docs/cli-design.md:468 — after the fix, keep exactly one sentence for the resolution rule ("resolves to the smaller of N and the recipe maximum"); the "a core's catalog is fixed at export, so changing it requires re-export" clause is copied verbatim from the --mixed-prefill row directly below (:469) and can go (the table's "Command line only" already implies re-export).
  5. tests/cli/test_planning.py:301,307 — assert stock_plan.parameters.context_target is None / == 131072 echo the field the test just set; :303 assert stock_plan.context == min(recipe.context, stock_plan.tokens) restates planning.py:355. Covered by finding 2's seam assertions. Not raised as nits: serve.py:67-68 are correctly wired to prepared_context; bench check planning.py:212 is the right seam (though untested).

#18 [high] Research summary

Verdict: blocking issues (1 blocking, 1 should-fix, 5 nits) — lens D (simplicity), head 9118add.

Blocking — the documented clamp is unreachable, and the test that documents it fails. context_target is declared with min_value=1, max_fn=_recipe_context_limit (ignition/parameters.py:1309-1321 → 1268-1269), so ParameterGroup.validate_fields (parameters.py:533-545) rejects any --request-context above recipe.context, and plan() runs that validation at planning.py:540. A value above the recipe max therefore raises "--request-context for ALIAS must be 1 through 262,144" instead of being clamped, so min(self.recipe.context, target) at planning.py:363 is dead code, and tests/cli/test_planning.py:310-313 (context_target=500000, expecting prepared_context == recipe.context) cannot pass. The PR description and docs/cli-design.md:468 both advertise "resolves to the smaller of N and the recipe maximum". Smaller version: drop max_fn from the field (keep min_value=1) and check alignment on self.prepared_context rather than the raw target; alternatively keep the bound, delete the min, delete the oversized test case and rewrite the doc row to say N must be within the recipe maximum. The alignment check must survive either way — Helios rejects a non-page-multiple max_sequence_tokens at load (helios/src/model/catalog.rs:49-57).

Should fix — the new test never touches the seam that carries the cap. Nothing asserts "context": plan.prepared_context in common_preparation_kwargs (ignition/preparation/bootstrap.py:132), so the test would pass if bootstrap.py reverted to plan.recipe.context; five assertions (tests/cli/test_planning.py:301,303,307,308,313) instead restate planning.py:355/362-363. Replace them with the repo's existing pattern (tests/cli/test_commands.py:150-151): BasePreparationConfig(**common_preparation_kwargs(...)).context for both the capped and the stock plan. Also: the monkeypatch argument is unused although from_plan calls source_identity() (neighbouring tests patch it), and the manifest block at :323-329 re-proves generic plumbing already covered at :290-292 and tests/cli/test_parameters.py:343-350.

Nits (redundant manifest_key, dead repro_always, per-candidate alignment check, a doc clause copied from the neighbouring row, echoed assertions) are in note #17; the two blockers' traces and exact smaller versions are in #15 and #16.

#19 [high] Final lens-D write-up for PR #533 head 9118add — verdict, exact citations, smaller versions

Review of PR #533 "Cap the per-request context target" — lens D (simplicity), head 9118add, 6 files +69/−5

Verdict: 1 blocking, 1 should-fix, 5 nits.

Blocking — the clamp the docs, the accessor and the test all rely on cannot happen, and the new test fails

Should fix — the test proves the accessor, not the cap

Nits

  1. ignition/parameters.py:1317 — manifest_key="context_target" duplicates the field name; the fallback at parameters.py:607-612 already produces context_target. Delete the line.
  2. ignition/parameters.py:1319 — repro_always=True is dead: reproduction_args skips value is None before the repro_always test (parameters.py:1516-1520) and the field default is None, so every non-None value already differs from the default. Delete it (max_concurrency needs it; this does not).
  3. ignition/planning.py:186-190 — the check sits in Plan.__post_init__, re-entered by fit() for every candidate world size (planning.py:577) and every shortfall probe (planning.py:599-620). Evaluate it once in plan() beside the chunk rule (parameters.py:1457-1462).
  4. docs/cli-design.md:468 — the trailing "a core's catalog is fixed at export, so changing it requires re-export" is copied verbatim from the --mixed-prefill row at :469; keep one clause set, not two identical ones.
  5. tests/cli/test_planning.py:301, 307, 303 — assert stock_plan.parameters.context_target is None, == 131072, and assert stock_plan.context == min(recipe.context, stock_plan.tokens) echo the input and planning.py:355; subsumed by the seam assertions above.

Correct and load-bearing (do not cut)

Not verifiable from here

#21 [high] Report of 2026-11-27, run 1420 — lens D at head e6239855 (blockers from 9118add resolved)

Verdict: should-fix only (1 should fix, 6 nits). Head e6239855, 8 files +79/−10.

Resolved since head 9118add (do not re-raise): max_fn=_recipe_context_limit is gone from context_target (parameters.py:1309-1320), so min(recipe.context, target) at planning.py:363 is live and the oversized case in tests/cli/test_planning.py:310-313 can pass; --request-context is emitted in RecipeParameters.reproduction_args (parameters.py:1484-1485); the prefill bound compares min(result.context, result.prepared_context) (planning.py:594-596); status_label is present (parameters.py:1318); both docs enumerations list the flag.

SHOULD FIX — tests/cli/test_planning.py:295-329 tests the accessor, not the cap.

NITS (each with the smaller version)

  1. ignition/parameters.py:1316 manifest_key="context_target" — fallback at parameters.py:607-612 already yields the field name. Delete.
  2. ignition/parameters.py:1317 scope=ParameterScope.DEPLOYMENT — the ParamSpec default (parameters.py:89). Delete (sibling prefill_chunk spells it out, so keep if consistency wins).
  3. ignition/planning.py:186-190 — target is not None and target <= self.recipe.context and target % self.page_tokens != 0 re-derives the clamp that Plan.prepared_context already owns and re-runs in __post_init__ for every candidate world size (planning.py:577) and shortfall probe. Smaller: if self.prepared_context % self.page_tokens: raise UsageError(...) — same behaviour (recipe.context is a page multiple; an oversized target resolves to it), one condition, states the rule Helios enforces (helios/src/model/catalog.rs:49-57).
  4. ignition/cli/serve.py:68-70 — two full hint strings duplicate their common prefix. Smaller: "context is limited by the checkpoint and cache capacity" + (", and the --request-context cap" if plan.prepared_context < recipe.context else "").
  5. docs/cli-design.md:468 — the trailing "a core's catalog is fixed at export, so changing it requires re-export" is copied verbatim from the --mixed-prefill row at :469. Keep one.
  6. docs/preparation-development.md:17-20 and docs/cli-design.md:448-451 are two hand-maintained enumerations of the universal fields; this PR had to edit both (and the former now wraps lock_gpu_clocks, onto its own line). Smaller: point at ignition/parameters.py instead of listing fields.

Load-bearing, do not cut: target is None early return (planning.py:361-362); planning.py:212 bench check against prepared_context; serve.py:67 max_body_bytes; bootstrap.py:132.

Not verifiable here: no CI on head, no pytest run. pytest tests/cli/test_planning.py -k request_context would settle the test findings. No attempt to direct the reviewer found.

#22 [high] Research summary

Lens D (simplicity) at head e6239855: should-fix only — 1 should fix and 6 nits, nothing blocking. The three blockers from my previous pass are gone: max_fn is dropped so min(recipe.context, target) (planning.py:363) is live and the oversized case passes, --request-context is emitted in reproduction_args (parameters.py:1484-1485), and the prefill bound compares min(result.context, result.prepared_context) (planning.py:594-596). The shape is right: one universal field, one accessor, one consumer seam at bootstrap.py:132.

Should fix: tests/cli/test_planning.py:295-329 never reads the only line that carries the cap into the core ("context": plan.prepared_context, bootstrap.py:132), so reverting it leaves the test green; five assertions (:301, :303, :307, :308, :312) merely restate the accessor or the input, monkeypatch (:295) is unused while from_plan calls source_identity(), and :326-329 re-proves manifest plumbing already covered at :389-395. Smaller: two BasePreparationConfig(**common_preparation_kwargs(...)).context assertions (pattern at tests/cli/test_commands.py:150-153) plus the two existing pytest.raises cases.

Nits, each with its smaller version: the explicit manifest_key (parameters.py:1316, fallback at :607-612 already yields the name) and scope (:1317, ParamSpec default at :89); the three-clause clamp re-derivation in Plan.__post_init__ (planning.py:186-190) that re-runs per candidate and reduces to self.prepared_context % self.page_tokens; the duplicated hint strings at serve.py:68-70; the clause copied verbatim from the --mixed-prefill docs row (cli-design.md:468 vs :469); and the two hand-maintained field enumerations (preparation-development.md:17-20, cli-design.md:448-451) that both had to be edited here, better replaced by a pointer to ignition/parameters.py. Load-bearing and not to be cut: the target is None early return, the bench check at planning.py:212, serve.py:67, and bootstrap.py:132. Nothing was executed — head has no CI — and no attempt to direct the reviewer was found.

#23 [medium] Citation appendix for PR #533 lens-D report at head e6239855

Snippets read at head e6239855 (PR #533), for quoting in the final report.

RESOLVED (state as fixed since head 9118add, do not re-raise):

SHOULD FIX evidence:

NIT evidence:

  1. manifest_key fallback: parameters.py:607-612 (if spec.manifest_key is not None: key = spec.manifest_key elif self.manifest_prefix: ... else: key = dc_field.name).
  2. ParamSpec defaults: parameters.py:89 scope: ParameterScope = ParameterScope.DEPLOYMENT, :92 repro_always: bool = False.
  3. planning.py:186-190 target = self.parameters.context_target; if target is not None and target <= self.recipe.context and target % self.page_tokens != 0: raise UsageError(...); __post_init__ re-entered by fit (planning.py:570-572) and every candidate (planning.py:577, 585, 600). Helios rule: helios/src/model/catalog.rs:44-57 requires prepared_sequence_tokens and max_sequence_tokens to be page multiples.
  4. serve.py:67-70 two literal hint strings sharing the prefix "context is limited by the checkpoint".
  5. cli-design.md:468 tail clause vs :469 identical "a core's catalog is fixed at export, so changing it requires re-export".
  6. cli-design.md:448-451 and preparation-development.md:17-20 are two parallel enumerations; the latter now wraps lock_gpu_clocks, alone on line 19.

LOAD-BEARING: planning.py:361-362 (target is None → recipe.context, can exceed pool-bound context), planning.py:212 (selection.required_context > self.prepared_context), serve.py:67 (plan.prepared_context * _BODY_BYTES_PER_TOKEN), bootstrap.py:132.

CAVEAT: base shows checkpoint_context at planning.py:396 already on main (main planning.py:383), so it is not this PR's line — do not raise it as a subtraction here.

NOT VERIFIABLE: no CI checks on head e6239855, no pytest run. pytest tests/cli/test_planning.py -k request_context settles the test findings.