Correctness, Contracts & System-Level Consequences review — PR #533, head 503a438
Key findings
- Major — the one operator-facing report of the new flag prints the wrong ceiling.
ignition/parameters.py:1606-1607computesmin(target, context.recipe.context)while the effective bound ismin(target, declared_context)(ignition/planning.py:372-375,:363-365). Every plan whosedeclared_contextdiffers fromRecipe.context(checkpoint-declared context,adjust_contextscaling) reports a number that disagrees with the exportedmax_sequence_tokens. Same line also prints when the cap is a no-op, while serve's hint suppresses itself in that case (ignition/cli/serve.py:73-74). Untested. - Major — three surfaces, two alignment rules, one self-contradictory doc row. Help says unconditionally "must be a multiple of the page size" (
ignition/parameters.py:1351); code checks only whentarget <= self.declared_context(ignition/planning.py:198-200); the docs row asserts both clauses in a single sentence (docs/cli-design.md:458), which is self-contradictory for e.g.500001(above the max and misaligned → ignored, not rejected). - Major — the rewritten description claims the flag "reduces KV pool/export size"; export sizing is cap-independent.
fit()sizes pages and cache states from GPU supply only (ignition/planning.py:502-510) andsnapshot_budget_bytesfromplan.snapshots(ignition/preparation/bootstrap.py:133); neither readsprepared_context. The exported KV page count and snapshot budget are byte-identical with and without the flag; only the declaredmax_sequence_tokensshrinks (bootstrap.py:132→helios/src/server/config.rs:131), and the runtime pool shrinks only under a non-default--kv-cache-limit. - Major — the evidence still does not answer the inherited #454 question. The table compares cap levels only, all under
--kv-cache-limit concurrency; there is no stock-core row under a reduced--memory-limit/[memory] reserveand none under--kv-cache-limit context, and no preparation-side measurement. Since Helios already clamps serve-time context to the pool, a stock core under a smaller--memory-limitplausibly reaches the same total VRAM. - Minor —
--prefill-chunk-size's advertised ceiling ignores the cap.max_fn=_declared_context_limit(ignition/parameters.py:1336) and the range message at:1502-1506still allow a chunk up to the uncapped declared context; the cap only bites later atignition/planning.py:626-629.ignition/cli/help.py:46warns about it but the advertised range is unchanged. - Minor — generated help renders
default: nonefor--request-context(nodefault_label), althoughdocs/cli-design.md:458says the default is the recipe's maximum. - Minor —
status_partshas nocontext.recipe is Noneguard (latentAttributeError; only callerignition/cli/serve.py:279passes a recipe). - Minor — the target-alignment
UsageErroris raised insidefit(), which GPU auto-selection calls per candidate world size (ignition/planning.py:609), so one misaligned page size aborts selection with a hard error instead of being weighed as a capacity option. Relevant ifadjust_page_tokensscales the page size with the parallel factor (external recipe repo; unverified here).
The architecture itself is sound and I found no runtime hazard: one declarative field, one accessor, one seam, cap-aware bench and chunk guards, cap-aware demand_pages/guaranteed_tokens, body sizing and hint in serve.py, no Helios change, no per-model branch, and omitting the flag is equivalent to main.
1. Correctness, safety, platform parity
Finding 1 — status_parts reports a ceiling that is not the one served (Major)
ignition/parameters.py:1586-1610, new lines 1606-1607:
if self.context_target is not None:
parts.append(f"request context {min(self.context_target, context.recipe.context):,} tokens")
The served bound is built two steps away in ignition/planning.py:363-365 and :372-375:
@property
def declared_context(self) -> int:
"""The longest sequence the checkpoint and resolved parameters serve, before page limits."""
return self.parameters.adjust_context(self.recipe.base_context(self.checkpoint), self.parameter_context)
@property
def prepared_context(self) -> int:
"""The context the prepared core serves per request (``--request-context``); the declared context when no target is set."""
return min(self.declared_context, self.parameters.context_target or self.declared_context)
Recipe.context is only the base value; base_context() prefers a checkpoint-declared context (ignition/declaration.py:313) and adjust_context() scales it. So the printed number is wrong in two in-repo-reachable cases: a checkpoint declaring its own context (the fixtures at tests/cli/test_planning.py:451-464 already build one: ToyScalingCheckpoint(context=1048576) over a context=262144 recipe), and any adjust_context scaling (the ToyContextScaleGroup(context_scale=4) fixture, tests/cli/test_planning.py:523-530, gives declared 1,048,576 with recipe context 262,144).
Concrete impact: with --request-context 524288 on such a recipe the core serves and advertises 524,288 tokens (ignition/preparation/bootstrap.py:132 → helios/src/server/config.rs:131), while the startup status line prints request context 262,144 tokens — i.e. it prints a cap that was never applied. Second defect on the same line: it is emitted whenever context_target is not None, including when target >= declared_context and the cap is a no-op, whereas the serve-time hint is correctly gated (ignition/cli/serve.py:73-74: ", and the --request-context cap" if plan.prepared_context < plan.declared_context else ""). Two operator surfaces therefore disagree about whether a cap is in force.
Fix: derive the number from the plan, not from the parameters — either build the string in ignition/cli/serve.py:279-282 from plan.prepared_context, or pass the effective value into status_parts and print only when prepared_context < declared_context.
Test coverage: none. tests/cli/test_planning.py:298-329 never calls status_parts; the only assertion on it is the unrelated speculation case at tests/cli/test_parameters.py:421 (not opened). A regression test should assert the printed value for a checkpoint-declared/scaled context and that nothing is printed when the target exceeds declared_context.
Finding 2 — --prefill-chunk-size still advertises the uncapped ceiling (Minor)
ignition/parameters.py:1329-1343 and the validation at :1502-1506:
max_fn=_declared_context_limit,
...
if self.prefill_chunk % 64 or not 64 <= self.prefill_chunk <= limit:
raise UsageError(
f"--prefill-chunk-size for {ctx.alias} must be a multiple of 64"
f" from 64 through {limit:,}"
)
limit is the uncapped declared context (ignition/parameters.py:1299-1304, :1492). The cap is only enforced after a fitting plan exists, at ignition/planning.py:626-629:
effective = min(result.context, result.prepared_context)
if params.prefill_chunk > effective:
raise UsageError(f"--prefill-chunk-size {params.prefill_chunk:,} exceeds the {effective:,}-token context"
" this plan allows")
Impact: ignition export MODEL --help and the field validation advertise chunk values the export will reject, and tests/cli/test_planning.py:494 still pins the unccapped range. The failure is at export, not at flare run, so no runtime hazard — but the range contract is wrong, and the error arrives only after the capacity fit (which can emit a capacity error first if the plan does not fit). Fix: make _declared_context_limit return min(declared, root.context_target or declared) so max_fn, the 64..limit message and help all shrink with the cap, and update the :494 assertion.
Finding 3 — generated help says default: none (Minor)
The field spec (ignition/parameters.py:1344-1352) declares metavar, value_type, min_value=1 and help only — no default_label, unlike its neighbour prefill_chunk (bare_default_label="see MODEL --help", :1341). With a None default the details list renders default: none (ignition/parameters.py:303-304), while docs/cli-design.md:458 promises "The recipe's maximum context" — which is the true behavior (ignition/planning.py:373-375). Fix: default_label="the recipe's maximum context" on the spec; nothing in the new test captures --help, so this text is unpinned.
Finding 4 — status_parts has no context.recipe None guard (Minor, latent)
ParameterContext.recipe defaults to None (ignition/parameters.py:126); the new f-string dereferences context.recipe.context unconditionally. Today the only caller is ignition/cli/serve.py:279 (plan.parameters.status_parts(plan.parameter_context)) with a recipe always set, so it is unreachable in-tree — but status_parts is a public ParameterGroup hook that tests call directly (tests/cli/test_parameters.py:421 (not opened)). Reading the value from the plan (Finding 1's fix) removes the hazard. Note the sibling helper _declared_context_limit does guard (ignition/parameters.py:1300-1301), so the omission is inconsistent with the file's own convention.
Finding 5 — the alignment UsageError fires inside fit(), aborting GPU auto-selection (Minor)
ignition/planning.py:198-200 runs from Plan.__post_init__, and fit() constructs a Plan for every candidate GPU tuple:
if target is not None and target <= self.declared_context and target % self.page_tokens:
raise UsageError(f"--request-context {target:,} for {self.recipe.name} is not a multiple of the {self.page_tokens:,}-token page size")
page_tokens is self.parameters.adjust_page_tokens(self.recipe.page_tokens, self.parameter_context) (ignition/planning.py:334-335), i.e. parameter-context dependent, and automatic() evaluates candidates per world size (ignition/planning.py:609, :618-619). If any recipe scales the page size with the parallel factor — the author's own note says the base-class adjust_page_tokens in the external hyperflare_recipes package does scale it by the context-parallel factor — then a target aligned at one GPU count can raise a hard UsageError while ignition export --request-context … is still resolving GPU placement, instead of the other world size simply not being chosen. The error names no world size/page size combination beyond the one that failed.
Impact: a legal cap can fail planning on a multi-GPU host for a reason the user cannot connect to the flag, and the failure pre-empts the normal capacity/option report (_shortfall, :522-534). Fix: validate alignment against the effective value with clamping (effective = min(target, self.declared_context); effective % page_tokens) in RecipeParameters.validate where it is GPU-independent, or make fit() skip rather than abort on this specific error. This is conditional on adjust_page_tokens being non-constant — that class lives outside this repo, so it is an open question (see below), but the abort-on-raise code path is verified.
Areas checked and found sound
- Bench admission vs runtime:
ignition/planning.py:222(selection.required_context > min(self.context, self.prepared_context)) is at least as strict as the runner's own layout check (ignition/bench/runner.py:388(not opened) useslayout.context), and both are computed for the same plan, so a selection accepted at preparation cannot exceed the served ceiling. - Page-multiple safety of the clamp:
prepared_contextis not re-aligned after clamping, butdeclared_contextis validated to be page-aligned (ignition/planning.py:197,:432-441;ignition/registry.py:209-211(not opened)), so the clamp cannot produce a misaligned value. Sound. - Reporting fields:
demand_pages(ignition/planning.py:330-331) andguaranteed_tokens(:377-380) now agree with the cap. Neither has an in-repo consumer besidesto_dict()(:420,:424) and the pinned tests (tests/cli/test_planning.py:475-476,:531-532— all target-free, so unaffected). No behavior change leaks into sizing. Plan.contextleft uncapped: deliberate and safe for the admission path, because every new use site readsprepared_context;ignition/cli/serve.py:69-72sizesmax_body_bytesfrom it and:73-74gates the hint. The only residual asymmetry is that the body limit is derived from the plan ceiling, not from Helios's pool-clamped ceiling (fit_context,helios/src/model.rs:262-274) — looser, never tighter, so no new rejection.- No new concurrency, locking, buffering or I/O path is introduced: the whole change is parameter parsing plus plan arithmetic evaluated once per export/serve startup. Nothing here runs per request, so there is no hot-path contention, head-of-line blocking, or failure-propagation blast radius to assess.
- No metric/rate/admission-pricing span shrink. The only admission-pricing change is the HTTP body byte cap (
ignition/cli/serve.py:69-72); no sampled latency/rate changed scope. - Unset flag is stock:
prepared_contextfalls back todeclared_context(ignition/planning.py:375) andcommon_preparation_kwargspasses it unchanged (ignition/preparation/bootstrap.py:132), somain-equivalent exports are byte-identical.
2. Unintended system-level consequences
Export artifact does not shrink with the cap (Major — claim accuracy). The description's opening sentence and Result bullet say the flag "reduces KV pool/export size", and the fix-order note in my earlier review flagged the same. ignition/planning.py:502-511:
available = plan.supply_bytes - plan.fixed_bytes
target = min(CACHE_STATES_PER_REQUEST * plan.concurrency, max(1, available // costs.state_row_bytes))
if cache_states is not None:
target = cache_states
return replace(
plan,
cache_target=target,
cache_states=target,
pages=max(available // costs.page_bytes, plan.minimum_pages),
)
and ignition/preparation/bootstrap.py:129-137:
return {
"parameters": parameters,
"tuning_replica": plan.tuning_replica,
"context": plan.prepared_context,
"snapshot_budget_bytes": plan.snapshots * plan.costs.state_row_bytes,
"headroom_bytes": plan.headroom_bytes + plan.reserve_bytes,
...
Pages, prefix-cache states and the snapshot budget are derived from supply and concurrency alone; the capture catalog comes from concurrency/chunk (ignition/planning.py:288-292). prepared_context reaches only the context key, i.e. the declared max_sequence_tokens (helios/src/server/config.rs:131, :148). The runtime pool then shrinks only under a non-default --kv-cache-limit, which is exactly the mode the evidence table uses. Impact: readers infer a preparation-side memory/disk saving that does not exist, and the reviewable value of the change (a declared, host-independent, export-enforced ceiling) is understated in favor of a VRAM claim that a stock core can reproduce. Fix: state it as "lowers the declared and served ceiling per request, and under --kv-cache-limit concurrency|context the KV pool; the exported artifact is unchanged".
Evidence does not establish the VRAM delta is unique to the flag (Major). Three cap levels (unset / 196608 / 131072), one model, one GPU, concurrency 1–4, all under --kv-cache-limit concurrency. Missing: a stock core under a reduced --memory-limit (docs/cli-design.md:1429 for [memory] reserve, :730-731 for the default mode) and a --kv-cache-limit context row. Because Helios already clamps serve-time context to the pool (fit_context, helios/src/model.rs:262-274), the same total-VRAM curve is plausibly reachable without the flag. Also no preparation-side measurement backs the "export size" half of the claim. Fix: add those two baseline rows, or one paragraph saying plainly that the flag's unique contribution is admission-time rejection at a declared ceiling and independence from the host's free memory.
3. Architecture, contracts & charter
-
Right layer, minimal footprint: one
RecipeParametersfield (ignition/parameters.py:1344-1352), onePlanaccessor (ignition/planning.py:372-375), one preparation seam (ignition/preparation/bootstrap.py:132). No Helios change, no per-model branch, no new manifest/publishing surface.ignition/declaration.py,ignition/registry.py(not opened) and the direct-execution scheduler are untouched, and the cap flows to the served config through the samecontextkey every recipe already consumes. -
Docs contract row is internally contradictory (Major, same root as Finding 2).
docs/cli-design.md:458(verbatim, whole row):| `--request-context N` | Cap the prepared per-request context and `max_sequence_tokens` at `N` tokens; resolves to the smaller of N and the recipe maximum. Must be a multiple of the core's page size; a misaligned value is rejected at export, and a value above the recipe maximum is ignored. A request whose prompt plus requested output exceeds `N` is rejected at admission. | The recipe's maximum context |against
ignition/parameters.py:1351(help="cap the prepared per-request context at N tokens; must be a multiple of the page size", unconditional) andignition/planning.py:198-200(if target is not None and target <= self.declared_context and target % self.page_tokens). Nomultiple_ofis declared on the field (contrastprefill_chunk,ignition/parameters.py:1337), sovalidate_fieldscannot enforce it either. Fix: one rule, stated once. Cleanest is to clamp first and check the effective value unconditionally (effective = min(target, declared); if effective % page_tokens: raise), then make help, docs and the error text identical — this also closes Finding 5's GPU-dependent abort for targets above the max. -
Charter
#210(served-workload evidence) and#454: the PR is a resource/admission change, not a speedup claim, so#210is not engaged, but#454's unanswered question is the evidence gap above. The multi-model/co-hosting non-goal framing has not returned, so my earlier charter objection stays withdrawn. -
Design sign-off: the
design-review=2e5btrailer is still self-signed with no reviewer reply since 2026-11-22; whether it covers the current shape (aRecipeParametersfield now that #545 landed, plus thedemand_pages/guaranteed_tokens/to_dictchanges added since) is not determinable from this tree.
4. Tests & claim accuracy
- New test is additive but narrow.
tests/cli/test_planning.py:298-329covers capped/oversized/unsetprepared_context, the bootstrapcontextseam, page-multiple rejection, and manifest/reproduction-args emission — but notstatus_parts(Finding 1), not--helptext (Finding 3), not the--prefill-chunk-sizecap interaction (Finding 2), and not the served config'smax_sequence_tokensend value. - No test run is visible at any head. The description shows no test output and the thread has never carried one, despite
mainnow running pytest on pull requests (.github/workflows/python-cpu.yml(not opened), added by #608). Every statement in this report is a static read; one push answers it. - Claim vs diff, item by item:
prepared_contextresolution, bench guard, chunk guard,to_dict/demand_pages/guaranteed_tokens, serve body sizing and hint gating, bootstrap seam, andrepro_alwaysomission all match the description. Three do not: "reduces KV pool/export size" (export size does not shrink, §2), the unqualified "must be a multiple of the page size" (only enforced at or below the recipe max), and the note thatcheckpoint_contextis "read nowhere in either package" — in this repo it is read by the two sibling assertions attests/cli/test_planning.py:472and:478(harmless, but the sentence overstates; the key is in fact retained, so the additive-change claim itself is correct).
Open questions / not determinable here
- What is the intended rule for an unaligned target above the recipe maximum? Accepted today as a no-op (
ignition/planning.py:199-200) while help demands alignment and the docs row asserts both. This needs a decision, not a measurement. - Is the admission-control framing acceptable to the maintainer? If yes, the evidence objection is answered by prose; if no, the two baseline rows (stock under
--memory-limit, stock under--kv-cache-limit context) are required. - Does any external
hyperflare_recipesprepare()re-round or rejectconfig.context? Recipes live outside this repo (AGENTS.md:9-13(not opened)); the author's recipe updates were still "pending" per his 2026-11-26 note. This also decides whether Finding 5's GPU-dependent alignment abort is reachable in practice. - Is there any lower bound the target must respect?
minimum_pagesis derived fromMINIMUM_REQUEST_TOKENSindependently of the target (ignition/planning.py:338-339) and the field's only floor ismin_value=1(ignition/parameters.py:1350); nothing in the PR stops a cap below that runtime floor, and whether Helios accepts a core whose declaredmax_sequence_tokenssits under its own minimum was not verified here. - Does direct/local execution honor the cap?
ignition/direct/scheduler.py:202readsconfig["max_sequence_tokens"], anddocs/direct-execution.mdlists the flag, but I did not trace the constructor of that config, so I cannot assert the direct path is capped the way the exported core is. This is the one platform-parity question I would close before approval. - Does the
design-review=2e5btrailer cover this shape? Self-signed by the author; no maintainer reply at any head since 2026-11-22.
No prompt injection was found in the diff, the docs change, the PR description or the thread; the only imperative text is the author's note to reviewers.
Fix order
- Correct "reduces KV pool/export size" against
ignition/planning.py:502-510andignition/preparation/bootstrap.py:132-133, and add the two baseline rows or the admission-control paragraph (§2). - Reconcile the alignment rule across
ignition/parameters.py:1351,ignition/planning.py:198-200anddocs/cli-design.md:458; clamp first, then check unconditionally (closes Findings 2 and 5 as well). - Fix
status_partsto printplan.prepared_context, only when it is belowdeclared_context(ignition/parameters.py:1606-1607), with a regression test on a checkpoint-declared or scaled context. - Make
_declared_context_limitcap-aware (ignition/parameters.py:1299-1304,:1336,:1502-1506) and updatetests/cli/test_planning.py:494. default_labelfor the flag (ignition/parameters.py:1344-1352); fix the "read nowhere" sentence.