#1 [high] PR #533 head 503a438 — diff summary of code changes
PR #533, head 503a438 (rebase onto 2147cd4c), +78/−31 in 9 files. Code sites (read at pr head):
- ignition/parameters.py:1344-1352 new field
context_target: int | Noneflag--request-context, group "capacity and compression", metavar N, value_type int, min_value=1, help "cap the prepared per-request context at N tokens; must be a multiple of the page size". No manifest_key/scope/repro_always/default_label. - ignition/parameters.py:1529-1530 reproduction_args emits
--request-context Nonly when set. - ignition/parameters.py:1606-1607 status_parts appends
request context {min(self.context_target, context.recipe.context):,} tokens(no None guard; would AttributeError if recipe None). - ignition/planning.py:198-200 alignment gate only when
target <= self.declared_contextandtarget % self.page_tokens. - ignition/planning.py:222 bench check
selection.required_context > min(self.context, self.prepared_context). - ignition/planning.py:329-331 demand_pages now
concurrency * (prepared_context // page_tokens). - ignition/planning.py:372-375 new property
prepared_context=min(self.declared_context, self.parameters.context_target or self.declared_context). - ignition/planning.py:377-380 guaranteed_tokens uses prepared_context.
- ignition/planning.py:407-409 to_dict emits context / checkpoint_context / prepared_context.
- ignition/planning.py:623-629 plan() prefill-chunk check
effective = min(result.context, result.prepared_context). - ignition/preparation/bootstrap.py:132
"context": plan.prepared_context(was declared_context). - ignition/cli/serve.py:70-73 max_body_bytes uses prepared_context; context_hint gains ", and the --request-context cap" only when prepared_context < declared_context.
- ignition/cli/help.py:46 model_epilog context line "N tokens max ... --request-context can lower this (a cap below --prefill-chunk-size is rejected)".
- docs/cli-design.md:458 new flag row, :1445 owner row, :445-452 universal-field paragraph rewritten to point at RecipeParameters; docs/direct-execution.md:54-58, docs/preparation-development.md:17-20.
- tests/cli/test_planning.py:298-329 new test (unrun locally; static read per dossier).
#2 [high] Finding A — status_parts reports the wrong effective cap (uses recipe.context, ignores checkpoint/adjust_context)
SEVERITY: Major (observability/report correctness; the only operator-facing confirmation of the new flag).
Verbatim (ignition/parameters.py:1586-1610, new lines 1606-1607):
def status_parts(self, context: ParameterContext) -> list[str]:
ctx = replace(context, root=self)
...
if self.context_target is not None:
parts.append(f"request context {min(self.context_target, context.recipe.context):,} tokens")
Why wrong: the effective ceiling is Plan.prepared_context = min(self.declared_context, target) (ignition/planning.py:372-375) where declared_context = self.parameters.adjust_context(self.recipe.base_context(self.checkpoint), ...) (ignition/planning.py:362-365). Recipe.context is only the base (ignition/declaration.py:311-323: base_context returns checkpoint.context when the checkpoint declares one, then adjust_context scales it). So the printed number disagrees with exported/served max_sequence_tokens in two in-repo-reachable cases:
- Checkpoint with its own context: fixtures
ToyScalingCheckpoint(context=1048576)in tests/cli/test_planning.py:451-464 over_recipe(... context=262144 ...)(tests/cli/test_planning.py:140). Withcontext_target=524288the plan serves 524,288 but the startup line printsmin(524288, 262144) = 262,144. adjust_contextscaling:ToyContextScaleGroup(context_scale=4)at tests/cli/test_planning.py:523-530 gives declared=1048576 with recipe.context=262144; same wrong output, and acontext_targetof e.g. 524288 is printed as a 262,144 cap that was never applied. Second defect on the same line: the build string is emitted whenevercontext_target is not None, including when the cap is a no-op (target >= declared) —ignition/cli/serve.py:73-74correctly suppresses its hint in that case (if plan.prepared_context < plan.declared_context), so serve's hint and the plan line disagree. Also a latent AttributeError:context.recipeis None in recipe-freeParameterContext(ignition/parameters.py:126) — the only caller today is ignition/cli/serve.py:279 which passesplan.parameter_context(recipe set), so latent only. Fix: take the ceiling from the plan, not the parameters:f"request context {plan.prepared_context:,} tokens"built in ignition/cli/serve.py:279-282 (or pass the effective value into status_parts), and only whenprepared_context < declared_context. No test covers this: tests/cli/test_planning.py:298-329 never callsstatus_parts; the only status_parts assertion is tests/cli/test_parameters.py:421 (speculation).
#3 [high] Finding B — help/docs/code disagree on the alignment rule; three surfaces, two rules
SEVERITY: Major (contract/doc accuracy; a user following the docs gets the opposite of the stated behaviour).
Verbatim code (ignition/planning.py:198-200):
target = self.parameters.context_target
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")
Verbatim help (ignition/parameters.py:1344-1352): help="cap the prepared per-request context at N tokens; must be a multiple of the page size" — unconditional, and no multiple_of spec (unlike prefill_chunk at :1337), so validate_fields (ignition/parameters.py:531-539) never checks it; the true rule lives in Plan.__post_init__.
Verbatim docs row (docs/cli-design.md:458): "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."
Impact: for --request-context 500001 on a 262,144-token recipe (above the max AND misaligned) the docs read as "rejected" by the first clause and "ignored" by the second; the code ignores it (gate target <= self.declared_context fails → no check → prepared_context clamps to declared). Note set(prepared_context) also is not re-aligned for the clamp path, which is safe only because declared_context is itself page-aligned (validated at ignition/planning.py:432-441).
Fix: pick one rule and state it once. Recommended: validate alignment unconditionally in the field spec (multiple_of cannot express the dynamic page size, so either add multiple_of for the common 64-token page or keep the Plan check but drop the target <= declared guard and clamp first: effective = min(target, self.declared_context); if effective % page_tokens: raise). Then make help (:1351), docs (:458) and the error text say the same thing.
#4 [low] Finding C — status_parts has no None guard for context.recipe (latent AttributeError)
SEVERITY: Minor (latent AttributeError; same line as Finding A, fixed by the same change).
Verbatim (ignition/parameters.py:1606-1607):
if self.context_target is not None:
parts.append(f"request context {min(self.context_target, context.recipe.context):,} tokens")
ParameterContext.recipe defaults to None (ignition/parameters.py:126). Today the only caller is ignition/cli/serve.py:279 (plan.parameters.status_parts(plan.parameter_context)), which always carries a recipe, so the crash is unreachable in-tree. But status_parts is a public ParameterGroup hook that tests call directly (tests/cli/test_parameters.py:421), and any recipe-less call with context_target set raises AttributeError instead of rendering. Reading the effective value from the plan (Finding A fix) removes it.
#5 [low] Finding D — generated help renders default: none for --request-context
SEVERITY: Minor (help/contract accuracy; easy fix).
Verbatim (ignition/parameters.py:1344-1352): the field declares metavar="N", value_type=int, min_value=1 and help only — no default_label, no bare_default_label, unlike its neighbour prefill_chunk (bare_default_label="see MODEL --help", ignition/parameters.py:1341).
Rendering path: with no max_fn/max_value the details list is >= 1 plus, for a None default, default: none (ignition/parameters.py:303-304). So ignition export MODEL --help shows --request-context N … (>= 1; default: none), while docs/cli-design.md:458 states the default is "The recipe's maximum context" — which is the true behaviour when the flag is omitted (prepared_context falls back to declared_context, ignition/planning.py:373-375).
Fix: add default_label="the recipe's maximum context" (optionally also bare_default_label) to the param(...) spec.
The new test (tests/cli/test_planning.py:298-329) does not capture --help, so nothing pins this text; the only help assertions in the file are the pre-existing ones at tests/cli/test_planning.py:487-495.