Architecture scratchpad · NVIDIA/hyperflare-inference #533

Raw Markdown for agents: https://autobot.eidonix.com/p/ae1df029-8602-480b-ad88-e3d635ff56d1.md

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

ignition/cli/serve.py:193-206 (_export_hosts, the ignition export --ranks N path) builds its plan with an explicit planning.plan(...) call whose keyword list ends at row_shard_prefill=args.row_shard_prefill) — there is no context=args.request_context. The flag is registered on every preparation command (ignition/cli/init.py:167-170, via _preparation_arguments), so ignition export MODEL --ranks 2 --request-context 131072 accepts the value and then prepares a core at the recipe maximum, with no warning. Compare the three paths that do thread it: _prepare (serve.py:289), debug_serve (serve.py:472), bench.run (bench.py:177).

Why it matters: AGENTS.md "Be explicit and pin everything" / charter "Don't silently ignore API fields" and AGENTS.md:165-169 (explicit behavior). The whole claimed benefit is a smaller max_sequence_tokens; a multi-host deployment (a supported shape per AGENTS.md:157-163) gets a full-context core and no error, which the user only discovers when the VRAM payoff does not appear or the request ceiling is not enforced.

Fix: pass context=args.request_context in _export_hosts. Verified in code: diff touches only serve.py:286 and :469 (the _prepare and debug_serve call sites), not the _export_hosts call at :193.

#2 [high] Blocking: cap is absent from plan report and rebuild manifest

Three reporting surfaces omit the new setting, so neither the printed plan, the benchmark record, nor the rebuild manifest describes what was prepared:

  1. Plan.to_dict (ignition/planning.py:389-442) still emits "context": self.context and "checkpoint_context": self.recipe.context (:430) and no key for context_target or prepared_context. self.context stays stock by design (planning.py:363-366), so the plan JSON printed at serve.py:215/485, bench.py:182 reports a context the core does not serve. A core exported with --request-context 131072 prints context: 262144.
  2. rebuild_manifest.reproduction_arguments (ignition/preparation/rebuild_manifest.py:231-318) never adds --request-context, so the recorded reproduction command rebuilds a full-context core.
  3. rebuild_manifest.from_plan (rebuild_manifest.py:343-454) records no parameter for it, so nothing in the manifest distinguishes two cores that differ only in prepared context. bench.py:243-248 also selects a fixed key list from plan.to_dict() that has no context key.

Why it matters: AGENTS.md Configuration ("A setting ... is carried through the plan into the recipe's PreparationConfig, so the plan, its printed report, and its recorded measurements describe what was prepared"), AGENTS.md 431-444 (model core compatibility, metadata describes the prepared capacities), and docs/runtime-core-design.md:389 (combine-scope parameters). A core's prepared context is now a deployment-visible capacity; today it is invisible in every artifact.

Fix: add context_target (and the resolved prepared_context) to Plan.to_dict, --request-context to reproduction_arguments when the target is set, and a parameter entry in from_plan.

#5 [high] Research summary

I reviewed all seven changed files in context (ignition/planning.py, ignition/cli/{init,bench,preparation,serve}.py, ignition/preparation/bootstrap.py, docs/cli-design.md) against the charter, AGENTS.md, and docs/cli-design.md, and followed the cap into Helios (prepared_sequence_tokens → fit_context → catalog validation) and into core export. Four findings are on the scratchpad.

Two are blocking. First, the multi-host export path (_export_hosts, ignition/cli/serve.py:193-206) never passes context=args.request_context although --request-context is registered for every preparation command, so a --ranks N export silently prepares at the recipe maximum — the exact "cap does not reach the core" failure of the earlier review, now confined to one path. Second, the new setting is invisible in every artifact the project requires to describe preparation: Plan.to_dict still reports context/checkpoint_context only, and neither reproduction_arguments nor from_plan records --request-context, so the printed plan, benchmark record, and rebuild manifest all describe a core that was not prepared.

Two should-fix items: the target is only validated as positive, never against the page size, yet prepared_context becomes max_sequence_tokens that Helios requires to be page-aligned (helios/src/model/catalog.rs:44-58) — a non-multiple target looks like it exports a core that fails to load, which only an export test can settle; and the change adds no tests for shared planning behavior, while its stated motivation (headroom for a co-run model) leans on multi-model hosting, which the charter lists as a non-goal requiring sign-off. The measured VRAM table does answer the earlier "hypothetical deployment" objection, and the --kv-cache-limit overlap the prior review raised is now reconciled by the description's measurement setup, though the description would be stronger if it said what --kv-cache-limit alone cannot do.

#6 [high] Verified clean: cap does reach the core, and omission is a no-op

Checked and found correct, so the report can say these were verified rather than assumed:

  1. The cap reaches the core. ignition/preparation/bootstrap.py:58 now passes plan.prepared_context into BasePreparationConfig.context (bootstrap.py:33), and every recipe receives it through common_preparation_kwargs. That value becomes the core's max_sequence_tokens on load: helios/src/server/config.rs:131 reads it as prepared_sequence_tokens, :148 sets limits.max_sequence_tokens, and helios/src/model.rs:261-273 (fit_context) then min's it with physical pages. So the claim "a request that would exceed the cap is rejected" holds via server/request.rs:350 and scheduler.rs:2289/2358. This is the point the earlier review (#454, review comment 1) blocked on, and it is now fixed.
  2. Omitting the flag is a no-op. prepared_context returns recipe.context when context_target is None (planning.py:371-372), byte-identical to the old plan.recipe.context; Plan.context (planning.py:363-366) is untouched. fit/plan defaults are context=None, so every existing caller (including _export_hosts) behaves exactly as before — which is also why finding 1 is a silent drop rather than a crash.
  3. Pool sizing is unchanged by design. fit still gives the cache all free memory (planning.py:536-542); the cap reaches the pool only because the runtime sizes its pages from the core's now-smaller max_sequence_tokens (helios/src/runtime_core/memory.rs:631-635 via page_ceiling), plus --kv-cache-limit concurrency in the measurement. Nothing in the diff misstates this, though the description's per-slot explanation could say it explicitly.
  4. Other consumers of the plan are unaffected: ignition/cli/serve.py:68 (max_body_bytes) still uses recipe.context, so the HTTP body allowance stays generous — correct, since rejection happens at admission. ignition/cli/serve.py:538-546 (diagnostic capacity clamp) and the --direct path (ignition/direct/scheduler.py:110 reads config["max_sequence_tokens"]) both inherit the capped value, so direct execution enforces the cap too. Plan.prepared_context is read at exactly two sites: bootstrap.py:58 and the chunk check at planning.py:694.
  5. Docs are consistent with the code where it is wired: docs/cli-design.md:446, :1443, :1493 correctly describe a context limit capped at export and the prepared-context-derived cache sizing; :738's "prepared context" wording still resolves correctly to the capped value.
  6. The positive-target validation (planning.py:459-460) is in fit, so it fires on every planning path, not only plan. --request-context 0/negative yields the intended UsageError. --request-context placement in the "capacity and compression" argument group (cli/init.py:167-170) is the right home per AGENTS.md:452-456.
  7. The below-chunk error (planning.py:694-700) uses min(result.context, result.prepared_context) and its message names both remedies; with the recipe's default chunk and a low target, prefill_chunk is None selects the message that says to pass --prefill-chunk-size or a larger --request-context. Behaviour is right; only the absence of a test is a finding.

#8 [high] Blocking: the new page-multiple check validates the raw target, so the PR's own test case and the documented "cap above the recipe max is a no-op" path fail

ignition/planning.py:289-290 (new, in Plan.post_init):

if self.context_target is not None and self.context_target % self.page_tokens:
    raise UsageError(f"--request-context {self.context_target:,} is not a multiple of the {self.page_tokens:,}-token page size")

It checks the raw requested target, not the resolved prepared_context (planning.py:370-375: min(recipe.context, target, tokens)).

Two consequences, both verifiable from the code:

  1. A target above the recipe max — which the docs and the description present as a harmless clamp ("a cap above the pool resolves to the pool capacity, as stock"; docs/cli-design.md:446 default "The recipe's maximum context") — is rejected whenever it is not a page multiple, even though the core would serve the aligned recipe max.

  2. The PR's own new test contradicts the check: tests/cli/test_planning.py:229-232 builds oversized = planning.plan(recipe, recipe.checkpoints[0], gpus, context=500000, **base) and asserts prepared_context == min(recipe.context, oversized.tokens). The fixture recipe (tests/cli/test_planning.py:37-38) has context=262144, page_tokens=64, and its RankCosts declares no page_tokens (tests/cli/test_planning.py:43), so Plan.page_tokens == recipe.page_tokens == 64 (planning.py:328-332). 500000 mod 64 = 32, so the assertion never runs: planning.plan raises UsageError "not a multiple of the 64-token page size". The added test fails on the added validation.

Fix: validate the value the core will actually serve, not the request. Plan.__post_init__ cannot do that for the memory-dependent part because the first construction has pages=0, hence tokens=0, hence prepared_context==0 (planning.py:528-537 builds the Plan before replace(..., pages=...)). Correct place: end of fit (planning.py:538-544) or in plan after attempt(), checking min(recipe.context, context_target) % page_tokens (the memory-independent part), or check the final plan's prepared_context. Then either delete the test's 500000 case or keep it as the no-op proof.

Note the test also asserts capped.prepared_context == min(recipe.context, 131072, capped.tokens); 131072 is a page multiple, so that case is fine.

#9 [high] Verified fixed since last turn: multi-host path, plan report, manifest, docs, tests

Checks re-run at head de1b5b5 against the code:

  1. Multi-host export now forwards the flag: ignition/cli/serve.py:193-206 ends row_shard_prefill=args.row_shard_prefill, context=args.request_context. All four planning sites carry it: serve.py:193-206 (_export_hosts), serve.py:274-289 (_prepare, via derive), serve.py:459-472 (debug_serve), bench.py:162-177 (bench, via derive). derive forwards it (ignition/cli/preparation.py:56, 68 with keyword context=context). No remaining caller of planning.plan omits it.
  2. The plan report now carries it: ignition/planning.py:432 "context": self.context, "context_target": self.context_target, "checkpoint_context": self.recipe.context. prepared_context is derivable from those three plus tokens/page_tokens (which to_dict also emits, planning.py:440-441).
  3. The manifest now carries it: ignition/preparation/rebuild_manifest.py:264-265 emits --request-context <target> in reproduction_arguments, and :390 records context_target with SCOPE_DEPLOYMENT (add() skips None at :350-355, so an untargeted export records nothing — byte-equivalent to stock).
  4. Page-multiple validation exists (planning.py:289-290) — but validated on the wrong quantity; see the blocking note.
  5. Tests were added (tests/cli/test_planning.py:211-265) covering the no-op path, the clamp, both validations, to_dict, and the manifest keys — but one case fails; see the blocking note.
  6. Docs are consistent: docs/cli-design.md:446 now states the VRAM payoff only "With --kv-cache-limit concurrency", which matches helios/src/runtime_core/memory.rs:284-331 (page_ceiling returns None in default memory mode); :1443 and :1493 updated for the capped ceiling.
  7. The charter non-goal nit from the last report no longer applies: the description and docs row now justify the cap by single-model memory pressure, not multi-model hosting.

Still correct from entry #6: bootstrap.py:58 "context": plan.prepared_context is the only consumer that reaches the core, Helios reads it as prepared_sequence_tokens (helios/src/server/config.rs:131) and clamps limits.max_sequence_tokens (helios/src/model.rs:261-273, validated page-aligned at helios/src/model/catalog.rs:43-57).

#10 [high] Should fix: prepared_context is clamped by export-host free memory, making the exported ceiling non-reproducible

ignition/planning.py:370-375:

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

self.tokens is pages * page_tokens (planning.py:362-363), and pages is sized from the exporting host's free memory (planning.py:538-544). This value becomes the exported core's max_sequence_tokens via ignition/preparation/bootstrap.py:58.

Three consequences:

  1. The declared capacity of an exported core now depends on how much VRAM happened to be free on the export host — two exports of the same model with the same flags whose results are recorded in identical reproduction_args (ignition/preparation/rebuild_manifest.py:231-320, :390) can declare different max_sequence_tokens. That conflicts with AGENTS.md:452-456 ("the plan, its printed report, and its recorded measurements describe what was prepared") and with "Be explicit and pin everything" (charter line 14).
  2. A low target is silently lowered further without any message: on a host where tokens is 20000, --request-context 131072 prepares a 20000-token core and the printed plan reports context_target: 131072, context: 20000, tokens: 20000 — no warning that the request was not honored.
  3. The clamp duplicates Helios, which already narrows the advertised ceiling to the pool: helios/src/model.rs:260-273 fit_context sets limits.max_sequence_tokens = prepared_sequence_tokens.min(pages*page_tokens) and helios/src/model/catalog.rs:43-57 only requires max_sequence_tokens <= prepared_sequence_tokens. So min(recipe.context, context_target) is sufficient for the core.

Fix: drop the self.tokens term, return min(self.recipe.context, self.context_target). Then the resolved value is a pure function of the requested target and the recipe, reproducible from the manifest, pool-bound behaviour stays Helios's job (as stock), and page alignment follows from validating the target alone — which also removes the case that made the 500000 clamp test meaningful (see entry 8). stock path returns recipe.context, which is what the previous plan.recipe.context did; keep that.

Note Plan.context (planning.py:365-368) is untouched by this PR, so the printed context key still describes stock pool-bound behaviour, not the core; the new context_target key plus tokens/page_tokens (planning.py:440-441) make the core value derivable.

#11 [high] Research summary

Verdict: one blocking issue, one should-fix, everything else from my previous report confirmed fixed.

The PR's structure is now right. All four planning entry points forward the flag (ignition/cli/serve.py:193-206, :274-289, :459-472, ignition/cli/bench.py:162-177 via derive), Plan.to_dict reports context_target (ignition/planning.py:432), the manifest both emits --request-context (ignition/preparation/rebuild_manifest.py:264-265) and records context_target at SCOPE_DEPLOYMENT (:390), a page-multiple validation exists, tests were added, and the docs row now scopes the VRAM payoff to --kv-cache-limit concurrency, matching helios/src/runtime_core/memory.rs:284-331. The previous three blockers and both should-fix items are closed, and the multi-model non-goal concern no longer applies.

Blocking. ignition/planning.py:289-290 validates the raw requested target, not the resolved value: any non-page-multiple --request-context is rejected even when it would be clamped away by min(recipe.context, target, tokens). This breaks the PR's own new test — tests/cli/test_planning.py:230-232 plans with context=500000 against the 64-token-page fixture and is now guaranteed to raise (500000 % 64 == 32), so the added test fails on the added validation, and the "a cap above the recipe max is a no-op" path the description and docs row promise is unreachable unless the oversized value happens to be aligned. Fix by validating the value the core serves, in fit/plan after attempt() rather than in __post_init__ (which runs with pages=0, hence tokens=0, hence prepared_context=0).

Should fix. prepared_context (planning.py:370-375) also clamps by self.tokens, which is sized from the export host's free memory. That makes an exported core's declared max_sequence_tokens depend on how much VRAM was free at export while reproduction_args stay identical (AGENTS.md:452-456, "Be explicit and pin everything"), and silently lowers a requested cap with no message. Helios already performs this clamp (helios/src/model.rs:260-273 fit_context, bounded by helios/src/model/catalog.rs:43-57), so min(recipe.context, context_target) is the reproducible, sufficient value — and dropping the tokens term also removes the only case where the oversized clamp mattered.

Full detail is in scratchpad entries #8, #9 and #10.

#12 [high] Report of 2026-11-26, run 1002 (supersedes #7): verdict, findings, and what I did not verify

Supersedes entry #7 (which described an earlier head c36a6a02 + the pre-change serve.py). Review target: PR #533 head de1b5b5.

Verdict

Blocking: 1 (new, introduced by the head commit). Should fix: 1. Everything in #7's blocker list is now genuinely fixed — do not re-raise it.

Blocking

ignition/planning.py:289-290 validates the requested target instead of the resolved prepared context: if self.context_target is not None and self.context_target % self.page_tokens: raise UsageError(...) Two demonstrable consequences:

  1. The PR's own new test fails. tests/cli/test_planning.py:229-232 calls planning.plan(..., context=500000) and asserts oversized.prepared_context == min(recipe.context, oversized.tokens). Fixture: context=262144, page_tokens=64 (tests/cli/test_planning.py:37-38), RankCosts with no per-rank page_tokens (:43), so Plan.page_tokens == 64 (planning.py:328-332). 500000 % 64 = 32 → UsageError. The assertion cannot run.
  2. An oversized, unaligned target is rejected although the resolved core value would be the aligned recipe max — the "a cap above the pool/recipe max resolves to the max, as stock" behaviour that the PR description and docs/cli-design.md:446 promise. Fix: validate what the core serves — in fit/plan after attempt() (multiple of page_tokens applied to min(recipe.context, context_target), or the final prepared_context) — not __post_init__, which runs while pages=0 so tokens=0 and prepared_context=0 (planning.py:528-544). Honesty note: I did not run .venv/bin/python -m pytest tests/cli (no execution in this review); the failure is arithmetic from the fixture constants and is trivial to confirm by running that file.

Should fix

ignition/planning.py:370-375 — prepared_context also min's self.tokens (pages × page_tokens), and pages is sized from the exporting host's free memory (planning.py:538-544). That value becomes the core's max_sequence_tokens via ignition/preparation/bootstrap.py:58, so two exports with identical reproduction_args can declare different ceilings depending on export-host VRAM; it also silently lowers a requested cap with no message while to_dict still prints the requested context_target (planning.py:432). It contradicts AGENTS.md:452-456 and "Be explicit and pin everything". Helios already clamps the advertised ceiling to physical pages (helios/src/model.rs:260-273 fit_context; helios/src/model/catalog.rs:43-57 requires only max_sequence_tokens <= prepared_sequence_tokens), so min(recipe.context, context_target) is sufficient, reproducible, and makes page alignment a property of the target alone.

Confirmed fixed since #7 (cite these rather than the old blockers)

Lens judgement (architecture and scope)

Belongs in the repository: it is a preparation capacity on the existing plan → PreparationConfig → core-catalog path, not a new mechanism, and it adds no per-model branch (charter "Keep the runtime small and model-agnostic"; AGENTS.md:338-345). It is one shared flag on the existing Plan, verified by measurement (RTX PRO 6000 Blackwell, table in the description) as the charter's "measured performance/memory issue" requires. The omission path is a true no-op (prepared_context returns recipe.context, matching the old plan.recipe.context), so compatibility (AGENTS.md:431-444) holds. No new CLI flag family or fallback layer, and no Helios change — Helios needed none. Residual scope note (not a finding, worth one line): the flag is honoured by export, bench and debug-serve alike; bench's workload check moved to prepared_context (planning.py:248), which is correct and now consistent with the core.

Not verified this run

#14 [high] Blocking: derive() references an undefined name context, so export/debug-serve/bench crash

Head 02023eb, ignition/cli/preparation.py.

def derive(...) at preparation.py:45-56 has no context parameter. Its signature ends: ..., shard_hyperconnections: bool = False, row_shard_prefill: bool = False, row_shard_attention: bool = False, force_moe_decode_a16: bool | None = None) -> planning.Plan: But the body at preparation.py:69 reads: mla_compute_mode=mla_compute_mode, row_shard_prefill=row_shard_prefill, row_shard_attention=row_shard_attention, context=context)

Evidence context is undefined there:

Consequence: context=context is evaluated on every call, so NameError: name 'context' is not defined fires for ALL invocation paths, with or without --request-context:

This is the single funnel all four entry points use, so the PR's whole feature is unreachable, and the CLI cannot run at all.

Why no test caught it: the new test in tests/cli/test_planning.py exercises planning.plan(...) directly, not derive(...); the existing derive test (test_commands.py:79-97) calls derive without the new keyword and would now fail too. The head has no CI checks.

Fix (one line): add context: int | None = None to derive's keyword-only parameters (next to row_shard_attention at preparation.py:55) so it forwards to planning.plan; and add a test that drives preparation.derive(..., context=N) and asserts plan.context_target == N, so the funnel is covered.

Severity: blocking — the branch cannot export, debug-serve, or bench anything.

#15 [high] Blocking: the claimed page-multiple validation does not exist; the PR's own test asserts it and fails; unaligned targets produce a core Helios rejects at load

Head 02023eb.

  1. The description claims a "page-multiple validation". No such check exists in the code:
  1. The PR's own test contradicts the code. tests/cli/test_planning.py:238-240:

Validation: non-page-multiple target rejected

with pytest.raises(UsageError, match="multiple of the"): planning.plan(recipe, recipe.checkpoints[0], gpus, context=100, **base) With the check absent, context=100 gives prepared_context = min(262144, 100, tokens) = 100 (fixture page_tokens=64 at test_planning.py:38), so planning.plan reaches planning.py:709-711 and raises UsageError("--prefill-chunk-size 4,096 exceeds the 100-token context this plan allows") — a UsageError whose message does not match "multiple of the", so pytest.raises fails. (If the plan did not fit, CapacityError would be raised instead.) Either way the assertion fails.

  1. Why the missing validation matters beyond the test — it is a real load-time defect. ignition/preparation/bootstrap.py:58 passes plan.prepared_context into BasePreparationConfig.context (bootstrap.py:33), which becomes ServingContract.max_sequence_tokens / prepared_sequence_tokens (helios/src/server/config.rs:131,148). Helios validates at load, helios/src/model/catalog.rs:44-57: || !config.prepared_sequence_tokens.is_multiple_of(page_tokens.max(1)) || !config.limits.max_sequence_tokens.is_multiple_of(page_tokens) so an unaligned prepared context makes the exported core fail to load with "invalid prepared model configuration" — discovered only after a full export, and with no error text naming --request-context. Reachable example: --request-context 100 --prefill-chunk-size 64 passes planning.py:635 (64 <= recipe.context) and planning.py:709 (64 <= 100), exports, and the core will not load.

Fix: validate the value that is actually served, in plan()/Plan.post_init where page_tokens and recipe.context are available, e.g. reject (or page-floor) min(recipe.context, context_target) % plan.page_tokens. Then the existing context=100 case (100 % 64 = 36) is still rejected with a message containing "multiple of the" and the test passes as written. Keep the check next to the context <= 0 check so one flag has one validation home (see the nit on split homes).

Note on what now works: the previous run's burst blocker (context=500000 with 500000 % 64 == 32) is resolved by the check's removal — tests/cli/test_planning.py:229-232 now passes. This blocking finding is that the sibling case at :238-240 was left behind, and the real alignment requirement went unenforced.

Severity: blocking — the shipped test fails and an accepted flag value yields an unloadable core.

#16 [high] Should fix: prepared_context still clamped by export-host free memory, not by the requested target

Head 02023eb. Unchanged since my last run, so it persists.

ignition/planning.py:377-381: @property def prepared_context(self) -> int: if self.context_target is None: return self.recipe.context return min(self.recipe.context, self.context_target, self.tokens)

self.tokens = self.pages * self.page_tokens (planning.py:368-369), and pages is sized from available // costs.page_bytes where available derives from plan.supply_bytes = free_bytes - headroom - reserve (planning.py:360-361, 550-556) — i.e. the export host's free VRAM at export time.

So with a --request-context set, the exported core's max_sequence_tokens (bootstrap.py:58 -> server/config.rs:131,148) silently depends on how much memory was free on the export host, while reproduction_args (rebuild_manifest.py:264-265) and the context_target manifest parameter (rebuild_manifest.py:389) record only the requested target. Two exports of the same recipe with the same flags can produce different max_sequence_tokens.

Two things make this a genuine layering problem rather than a nit:

Fix: return min(self.recipe.context, self.context_target) and let Helios's existing fit_context apply the pool bound, as it already does for the untargeted path. That also makes the PR's own "cap above the pool is a no-op, matching stock" claim true by construction rather than incidentally, and keeps reproduction_args sufficient to reproduce the core (AGENTS.md:452-456).

Note the interplay with the missing alignment check (entry #15): if this clamp is removed, min(recipe.context, context_target) alignment becomes purely a function of the target, so validating min(recipe.context, context_target) % page_tokens is exactly right.

Severity: should fix (architecture/compatibility). Not blocking because the flag is opt-in and the clamp only lowers the ceiling.

#17 [high] Verified clean + nits + evidence scoping — do not re-raise the prior fixed items

Head 02023eb. Supporting detail for the final report.

Confirmed good — do not re-raise (all still true at this head):

Nits (low value, mention briefly):

  1. Two validation homes for one flag: context <= 0 now lives in fit() (planning.py:467-468), which plan() re-enters per candidate world size and per shortfall probe (planning.py:699-705), while every sibling flag check sits in plan() near the prefill-chunk block (planning.py:634-637) or Plan.post_init (planning.py:224-296). Put both request-context checks in one place.
  2. serve.py:68-69 still sizes max_body_bytes from recipe.context and says "context is limited by the checkpoint and available cache capacity" — with a cap both overstate the served ceiling.
  3. ignition/cli/help.py:38 advertises --prefill-chunk-size: 64..{recipe.context}, a range above the effective prepared context once capped.
  4. docs/cli-design.md:446 says "below the recipe's maximum" but the code silently accepts and clamps a target above it (planning.py:381); the test at test_planning.py:229-232 pins the clamp. State the clamp, don't leave the docs implying rejection.
  5. test comments use "stock" as an undefined referent (test_planning.py:217, 227) — say "the behaviour without the flag".

Evidence scoping (carried from last run, still applies): the VRAM table only holds under a non-default --kv-cache-limit; helios/src/runtime_core/memory.rs:290-291 page_ceiling returns Ok(None) for KvCacheLimit::Memory, the documented default (cli-design.md:738, :828); only Context/Concurrency size a ceiling from the prepared context (:298-320). The description's headline omits that condition; the shipped docs row (cli-design.md:446) also omits it. AGENTS.md:95-102 requires scope and material limitations attached to a measured result.

#18 [high] Report of 2026-11-26, run 1148 (supersedes entry #13)

Run 1148, head 02023eb, PR #533 "Cap the per-request context target", base main. 9 files, +84/-18.

VERDICT: blocking issues. The design is right; two mechanical defects stop the branch from working.

--- BLOCKING 1: undefined name in the shared funnel (entry #14) --- ignition/cli/preparation.py:69 passes context=context to planning.plan, but derive()'s signature (:45-56) has no context parameter and the module has no global/import of that name (verified by full-file search: only :47/:62 context_parallel*, :69, :124 context_parallel function). => NameError on every derive() call, regardless of --request-context. Breaks export (--ranks 1 via _prepare, --ranks>1 via _export_hosts), debug-serve (serve.py:476), bench (bench.py:177), and the pre-existing test tests/cli/test_commands.py:88. Only the new test_planning.py test bypasses derive() by calling planning.plan directly, which is why it was not caught. No CI on head. Fix: add context: int | None = None at preparation.py:55; add a test driving derive(..., context=N) and asserting plan.context_target == N.

--- BLOCKING 2: page-multiple validation does not exist (entry #15) --- The description claims "a page-multiple validation". There is none: no alignment check anywhere in ignition (search for "multiple of the"/page alignment returns only prefill-chunk messages at planning.py:636 and cli/init.py:165). Plan.post_init (planning.py:224-296) never inspects context_target. The PR's own test asserts it and therefore fails: tests/cli/test_planning.py:238-240 expects UsageError matching "multiple of the" for context=100; with the check gone, 100 becomes prepared_context (100 % 64 = 36 for the fixture's page_tokens=64 at :38) and plan() raises the chunk error at planning.py:709-711 instead ("--prefill-chunk-size 4,096 exceeds the 100-token context this plan allows"), whose text does not match. It is a real defect, not just a test mismatch: bootstrap.py:58 -> server/config.rs:131,148 makes prepared_context the core's max_sequence_tokens, and helios/src/model/catalog.rs:44-57 rejects a core whose max_sequence_tokens is not a multiple of page_tokens, at load. Reachable: --request-context 100 --prefill-chunk-size 64 passes planning.py:635 and :709, exports a full core, and the core will not load with "invalid prepared model configuration". Fix: validate the served value — min(recipe.context, context_target) % page_tokens — in plan()/post_init beside the context <= 0 check. context=100 is still rejected, so the existing test passes unchanged. Note: the blocker I raised last run (context=500000, 500000 % 64 == 32) is resolved by the check's removal — test_planning.py:229-232 passes now. Do not re-raise it.

--- SHOULD FIX (entry #16) --- planning.py:377-381 prepared_context min's self.tokens, which is sized from export-host free VRAM (pages <- supply_bytes <- free_bytes, planning.py:360-361, 550-556). So with a target set, the exported artifact's max_sequence_tokens depends on the export host's free memory, while reproduction_args (rebuild_manifest.py:264-265) and the manifest (…:389) record only the requested target: the same flags can reproduce a different core (AGENTS.md:452-456). Helios already applies this exact clamp at serve time (helios/src/model.rs:268-272 fit_context). Fix: return min(recipe.context, context_target) and let fit_context apply the pool bound, matching the untargeted path. This also makes the PR's "cap above the pool is a no-op, matching stock" claim true by construction.

--- NITS (entry #17) ---

  1. One flag, two validation homes: context <= 0 in fit() (planning.py:467-468, re-entered per candidate and per shortfall probe) vs. all sibling flag checks in plan()/post_init. Unify.
  2. serve.py:68-69 sizes max_body_bytes from recipe.context and its context_hint text still describes the uncapped ceiling.
  3. cli/help.py:38 advertises --prefill-chunk-size 64..recipe.context, now above the effective context when capped.
  4. cli-design.md:446 says "below the recipe's maximum" but the code silently clamps an oversize target (planning.py:381, pinned by test_planning.py:229-232). Document the clamp.
  5. "stock" is an undefined referent in test comments (test_planning.py:217, 227).

--- EVIDENCE SCOPING (AGENTS.md:95-102) --- The VRAM table holds only under a non-default --kv-cache-limit: helios/src/runtime_core/memory.rs:290-291 page_ceiling returns Ok(None) for KvCacheLimit::Memory, the default (cli-design.md:738, :828); only Context/Concurrency derive a ceiling from the prepared context (:298-320). The description's Result/headline and the docs row omit the condition, although the author's own commands pass --kv-cache-limit concurrency.

--- CONFIRMED FIXED SINCE run 1002 (entry #17) — do not re-raise --- multi-host forwarding (serve.py:207), plan report keys (planning.py:438), reproduction args + SCOPE_DEPLOYMENT parameter (rebuild_manifest.py:264-265, :389), bench configuration record (bench.py:247-248), printed serve line (serve.py:319), bench-vs-cap check (planning.py:260), omitted flag is a byte-equivalent no-op (planning.py:379-380), docs owner rows (:1443, :1493), and the field's shape (one optional frozen field defaulting to None, planning.py:186; no per-model branch, no env toggle, no Helios change — consistent with the charter's "smallest footprint in shared code" and AGENTS.md:452-456).

--- NOT VERIFIED --- Nothing was executed (no CI on head; no pytest run). Both blockers are established by reading the code: #14 from the signature/body mismatch plus a full-file name search; #15 from the absence of any alignment check plus the fixture's page_tokens and the 100/4096 chunk comparison. pytest tests/cli/test_planning.py tests/cli/test_commands.py settles both in one command. The VRAM numbers themselves rest on the description; only their --kv-cache-limit scoping is checkable here. No attempt to direct the reviewer was found in the description, diff, or docs.

#19 [high] Research summary

Verdict: blocking issues. The design and layering are right — one optional Plan field, one accessor, one keyword, one consumer line at bootstrap.py:58, no per-model branch, no env toggle, no Helios change — but two mechanical defects stop the branch from working. Full detail is in scratchpad entry #18, with the individual findings in #14–#17.

Blocking 1 — undefined name in the funnel every entry point uses. ignition/cli/preparation.py:69 passes context=context to planning.plan, but derive() (:45-56) has no context parameter and the module has no global or import of that name (a full-file search finds only context_parallel* and the context_parallel() helper). So NameError fires on every derive() call, with or without --request-context: export (both _prepare and _export_hosts), debug-serve (serve.py:476), bench (bench.py:177), and the pre-existing test_derive_forwards_row_shard_prefill (tests/cli/test_commands.py:88). The new test misses it because it calls planning.plan directly. Fix: one parameter, plus a test that drives derive(..., context=N).

Blocking 2 — the described page-multiple validation does not exist. The description says planning.py gained "a page-multiple validation"; no alignment check exists anywhere in ignition/, and Plan.__post_init__ never inspects context_target. The PR's own test therefore fails: tests/cli/test_planning.py:238-240 expects a UsageError matching "multiple of the" for context=100, which instead hits the chunk error at planning.py:709-711. This is a real load-time defect, not just a test mismatch: bootstrap.py:58 makes prepared_context the core's max_sequence_tokens, and helios/src/model/catalog.rs:44-57 rejects a core whose max_sequence_tokens is not a page multiple — so --request-context 100 --prefill-chunk-size 64 exports a full core that cannot load. Validating min(recipe.context, context_target) % page_tokens fixes both, since 100 % 64 = 36. (Last run's context=500000 blocker is resolved by the check's removal — not re-raised.)

Should fix. prepared_context (planning.py:377-381) still min's self.tokens, which is sized from the export host's free VRAM, so a targeted export's max_sequence_tokens depends on memory free at export while reproduction_args record only the target — the same flags can reproduce a different core (AGENTS.md:452-456). Helios already applies this clamp at serve time (helios/src/model.rs:268-272); returning min(recipe.context, context_target) would match the untargeted path and make the "cap above the pool is a no-op" claim true by construction.

Nits: two validation homes for one flag; serve.py:68-69 and cli/help.py:38 still advertise the uncapped context; the docs row says "below the recipe's maximum" while the code silently clamps; "stock" is an undefined referent in test comments. One evidence point: the VRAM table holds only under a non-default --kv-cache-limit (memory.rs:290-291 returns Ok(None) for the default), which the description omits.

Nothing was executed — the head has no CI checks — but both blockers follow from reading the code; pytest tests/cli/test_planning.py tests/cli/test_commands.py settles them.

#20 [high] Per-file coverage ledger: all 9 changed files read in context at head 02023eb

Completeness ledger for the final report (head 02023eb, PR #533, 9 files, +84/-18 per pr_files). Every file below was read in context, not only as a diff hunk.

  1. ignition/planning.py (+19/-9) — read 150-300, 300-400, 430-455, 455-600, 600-743.
    • :186 context_target: int | None = None (frozen dataclass, default None — existing constructions unaffected).
    • :377-381 prepared_context (min recipe.context/context_target/tokens; early return on None = the no-op path).
    • :224-296 __post_init__: NO context_target validation (basis of blocking #15).
    • :467-468 context <= 0 check in fit() (nit: separate home from sibling checks).
    • :260 bench selection compares required_context > prepared_context.
    • :438 to_dict emits context/context_target/prepared_context/checkpoint_context.
    • :635-637 prefill-chunk validation vs recipe.context; :709-711 effective_context chunk error.
    • :550-556 pages <- available // page_bytes; :360-361 supply_bytes <- free_bytes (basis of should-fix #16).
  2. ignition/cli/preparation.py (+1/-1) — read 1-44, 40-95, 96-160, plus full-file "context" search.
    • :45-56 derive signature has NO context param; :69 passes context=context (blocking #14).
    • :124-132 context_parallel() is the only other "context" name; module imports (:7-15) include nothing named context.
  3. ignition/cli/serve.py (+5/-4) — read 55-80, 130-175, 196-215, 258-300, 300-325, 462-482.
    • :207 _export_hosts forwards the flag (multi-host gap closed); :291 _prepare; :476 debug_serve.
    • :319 prints · request context {prepared_context} guarded on context_target.
    • :68-69 _server_options still sizes max_body_bytes from recipe.context and describes the uncapped ceiling (nit).
  4. ignition/cli/bench.py (+3/-1) — read 155-185, 236-262.
    • :177 context=args.request_context; :247-248 configuration record whitelists context_target/prepared_context.
  5. ignition/cli/init.py (+2/-0) — read 150-185, plus _preparation_arguments registration search.
    • :167-168 flag in the "capacity and compression" group beside --prefill-chunk-size (:163-166) — right scope per docs/cli-design.md:443-445.
    • Registered via _preparation_arguments at :50 (exporting), :53 (benchmarking), :60 (serving=debug-serve): confirms the three subcommands the description names all receive the flag.
  6. ignition/preparation/bootstrap.py (+1/-1) — read 25-85.
    • :33 context: int = 262144; :58 "context": plan.prepared_context — the single consumer; omission is byte-equivalent to pre-PR behaviour (:379-380 returns recipe.context).
  7. ignition/preparation/rebuild_manifest.py (+3/-0) — read 240-280, 340-400.
    • :264-265 --request-context N under context_target is not None; :389 add('context_target', SCOPE_DEPLOYMENT, ...); :350-352 add() skips None (so no manifest key when unset).
  8. tests/cli/test_planning.py (+47/-0) — read 1-60, 200-300.
    • :211-254 new test; :229-232 clamp case (passes now); :238-240 asserts a "multiple of the" error that no longer exists (blocking #15).
    • Fixture: :37 context=262144, :38 page_tokens=64, :43 RankCosts leaves page_tokens unset.
  9. docs/cli-design.md (+3/-2) — read 443-452, 828-836, plus the :1443/:1493 owner rows.
    • :446 flag row ("below the recipe's maximum" — the code silently clamps, nit); :1443, :1493 owner rows updated.

Downstream consumers checked (unchanged by this PR, but they define what correctness means here):

Nothing in the description or diff attempted to direct the reviewer.

#3 [medium] Should fix: context target is not validated against page alignment

Plan.prepared_context (ignition/planning.py:368-373) returns min(recipe.context, context_target, tokens) while Plan.context (:363-366) returns min(recipe.context, tokens). tokens is pages * page_tokens and pages is sized at fit time from free memory (:541-542). Two consequences:

a) Invariant risk. prepared_context can be strictly below context when the pool is smaller than the target. Helios requires max_sequence_tokens == prepared_sequence_tokens to be a multiple of page_tokens (helios/src/model/catalog.rs:44-58). tokens is a multiple of page_tokens, and recipe.context is whatever the recipe declares, so min() of the two plus a user target N keeps that property only if N is a multiple of page_tokens. context_target is not validated for page-token alignment anywhere (fit only rejects context <= 0, planning.py:459-460), yet prepared_context is what becomes max_sequence_tokens via ignition/preparation/bootstrap.py:58. A value such as --request-context 100000 on a 64-token page recipe exports a core whose declared context is not page aligned. Whether the core then fails to load, or Helios rounds/deviates, needs a test on an exported core; the code path (validate_inner returning "invalid prepared model configuration") suggests a load-time rejection of a core that took a long preparation to produce. Fix: reject or round a target that is not a multiple of the recipe's page size in fit.

b) The resolved value is memory-dependent. prepared_context = min(..., tokens) makes the core's advertised ceiling depend on the free VRAM measured during export: two exports of the same command on differently loaded GPUs produce cores with different max_sequence_tokens, and a cap above the pool silently becomes the pool size (the description states this as intended, "as stock"). That is defensible for the pool, but it means the flag's identity is not reproducible from the manifest, which strengthens finding 2.

Also note the value is clamped by tokens rather than by Plan.guaranteed_tokens (:376-378), so --request-context N above the per-request share still admits one long request while all slots are full only in aggregate: unchanged stock behavior, worth stating in the docs row.

#4 [medium] Should fix: need/scope argument and missing tests

  1. Scope/justification. The charter's "What gets merged" admits "a measured performance/memory issue"; the description now carries a VRAM table (Qwen3.8-27B, RTX PRO 6000, concurrency 1-4, 16 GB freed at c=4), which answers the earlier "hypothetical deployment" objection (#454 review point 4), and AGENTS.md:165-169 is satisfied on its face. But the memory problem is a multi-model co-run ("leave no room for a second model"). Multi-model hosting is an explicit Non-Goal requiring maintainer sign-off (charter Non-Goals; AGENTS.md:171-175 "Reject unapproved scope expansion ... multi-model hosting and routing"). The flag itself is a preparation capacity, not hosting, so this is not a violation — but the stated motivation leans on a workflow the project does not support, and the description should say which single-model workflow the headroom buys (e.g. leaving free VRAM for the compositor or a later process, which --memory-limit -30G / [memory] reserve already express at serve time per docs/cli-design.md:1414-1418, 845-855).
  2. Overlap with existing mechanisms. --kv-cache-limit context already caps useful KV history at one prepared context and concurrency at one per active request (docs/cli-design.md:738, 828-843), and --memory-limit/[memory] reserve already bound the pool at serve time without re-export. The PR's contribution is that the cap also lowers the core's max_sequence_tokens and that the prepared pool shrinks at export. The description should say what --kv-cache-limit cannot do, since the earlier review raised exactly this (#454 review point 2). Evidence check: the measured table uses --kv-cache-limit concurrency (one prepared context per active request = 4 × 256K at default), so the delta is genuinely the prepared-context times concurrency product — the measurement supports the claim, but only at concurrency >= 2 and only with that limit mode; nothing isolates how much of the win comes from the smaller pool versus the smaller advertised ceiling.
  3. No tests. The diff adds none, for a change in shared planning code that alters exported cores. AGENTS.md:194-199 requires tests that exercise the affected behavior; tests/cli/test_planning.py (e.g. :71-120) is the natural home for prepared_context resolution, the <=0 rejection, and the below-chunk message. Note the below-chunk branch (planning.py:694-700) is untested and picks its message on prefill_chunk is None, not on whether the user set --request-context; with the recipe's own chunk (omitted flag) it tells the user to pass --prefill-chunk-size ... or a larger --request-context, which is correct, but with an explicit --prefill-chunk-size above a low target it reports only the chunk mismatch — fine. The branch is reachable only when a target is set below the chunk, since context >= chunk already holds at planning.py:621-623 for the stock path.
  4. Docs framing. docs/cli-design.md:446 calls --request-context a way to buy "concurrency headroom in a memory-constrained multi-model deployment", which names an unsupported workflow; the same table's Context-limit rows (:1443, :1493) are consistent with the code. docs/cli-design.md:738 still describes --kv-cache-limit as bounding history by "prepared context", which is now the capped one — consistent, no edit needed.