#1 [high] Blocking: the flag re-implements runtime --kv-cache-limit, and the stated memory payoff comes from the runtime flag
PR 533 adds --request-context N on export/debug-serve/bench, threaded derive()→plan()→fit()→Plan.context_target, plus Plan.prepared_context, used only by ignition/preparation/bootstrap.py:58.
What already exists:
flare run --kv-cache-limit concurrency|context|memorybounds the shared KV pool to one prepared context per active request / one context, applied at core load, "without another export" (docs/cli-design.md:738, :828-833; docs/model-preparation.md:396-402). Implementation:page_ceilingin helios/src/runtime_core/memory.rs:284-331.- The PR's own evidence table is produced at serve time with
--kv-cache-limit concurrency(description: "served at concurrency 1–4 (--kv-cache-limit concurrency)"). So the measured "pool = concurrency × prepared-context" VRAM scaling is the documented behaviour of the pre-existing runtime flag. No re-export is needed for it. - The maintainer's earlier review of the same change (#454, yatesdr, 2026-11-21) asked exactly for this: "start from a concrete workload that --max-concurrency and --kv-cache-limit cannot serve". The resubmission keeps the same shape and the same memory argument.
Only delta the flag adds over --kv-cache-limit: it lowers the exported max_sequence_tokens so a single request longer than N is rejected. That is one datum (ignition/preparation/bootstrap.py:58 "context": plan.prepared_context → BasePreparationConfig.context, bootstrap.py:33) and is the entire payload of the PR.
Cost of the present shape (diff +35/−15):
- ignition/cli/init.py:167-170 (4 lines: flag + 3-line help)
- ignition/cli/preparation.py:56, 68, 65 (derive signature + forward, 2 lines)
- ignition/cli/bench.py:176-177 (2)
- ignition/cli/serve.py:289 and :472 (2)
- ignition/planning.py:453, :535, :591, :674 (fit/plan palette + forward, 4), :459-460 (2, validation), :176 (1, field), :369-373 (5, property)
- ignition/preparation/bootstrap.py:58 (1, the only load-bearing line)
- docs/cli-design.md:446 (1 long table row) + :1443, :1493 (2 edits)
Smallest shape that keeps the one datum: one
Planfield, oneplan()/fit()keyword, one line in bootstrap.py, one docs row — and the error-message branch and the second property dropped (see other notes). ~15 lines of the 35 could go.
Charter/AGENTS hooks: AGENTS.md:165-169 "Every contribution must address ... a demonstrated defect, a measured performance or memory problem"; charter "Look for the smallest footprint in shared code, or a way to solve it without new code at all."
#2 [high] Should fix: prepared_context duplicates Plan.context; smaller version is one line
ignition/planning.py:368-373 (new):
@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)
Plan.context (planning.py:363-366) is min(self.recipe.context, self.tokens). So
min(recipe.context, N, tokens) == min(self.context, N) exactly. Smaller version (2 lines saved):
@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)
And the call site at planning.py:694 effective_context = min(result.context, result.prepared_context) is then redundant: with no target it is result.context, with a target it is already ≤ result.context. It can read effective_context = result.prepared_context if result.context_target is not None else result.context (same length, so no direct saving) — but with the shortened property the whole second property could be dropped and the two users (bootstrap.py:58 and planning.py:694) could read min(result.context, result.context_target or result.context); net ~4 lines.
#6 [high] Research summary
Reviewed PR #533 ("Cap the per-request context target", +35/−15 across 7 files) through the subtraction lens, against AGENTS.md, docs/design-review.md, the charter, and the maintainer's earlier review of the same change in closed PR #454.
Findings, ranked by lines saved:
-
Blocking (~15 of the 35 added lines, plus the doc prose). The flag is a re-implementation of a runtime setting the PR's own evidence is measured with.
flare run --kv-cache-limit concurrency|context|memory(docs/cli-design.md:738, :828-833; docs/model-preparation.md:396-402;page_ceiling, helios/src/runtime_core/memory.rs:284-331) already bounds the shared KV pool to one prepared context per active request, at core load, without re-export. The description's table is explicitly produced with--kv-cache-limit concurrency, so the measured pool = concurrency × prepared-context VRAM scaling is the pre-existing flag's documented behaviour. The one genuine delta is a lower exportedmax_sequence_tokens, i.e. one datum reaching one consumer (ignition/preparation/bootstrap.py:58). Maintainer yatesdr asked in #454 for "a concrete workload that --max-concurrency and --kv-cache-limit cannot serve"; this resubmission keeps the same shape and the same memory argument. -
Should fix (~6 lines). ignition/planning.py:692-701 turns the stock 3-line
--prefill-chunk-sizecheck into a 9-line branch with two messages; the generic message already names both numbers, so one message carrying the effective context replaces it. No test asserts either new string. -
Should fix (~4 lines).
Plan.prepared_context(planning.py:368-373) duplicatesPlan.context:min(recipe.context, N, tokens)is exactlymin(self.context, N), so the five-line body collapses to two, and the extramin(...)at planning.py:694 disappears. -
Should fix (~2 doc lines + half of one row). docs/cli-design.md:446 repeats what the PR's own other two doc edits (:1443, :1493) already state, and repeats the runtime KV-limit semantics; it also advertises a "memory-constrained multi-model deployment", which AGENTS.md:171-175 lists as unapproved scope.
-
Nit (~2 lines).
derive()'s newcontextparameter (ignition/cli/preparation.py:56, :68) is a pure pass-through — all three callers pass the flag or nothing. Separately,Plan.to_dict()never records the new setting, so the printed plan and bench configuration cannot show what was prepared (AGENTS.md:452-456), and no test covers any of the new behaviour.
Smallest version: a single Plan field, one plan()/fit() keyword, one line in bootstrap.py and one docs row — roughly 15 of the 35 added lines removable, and the VM point that the flag's memory argument is already served by --kv-cache-limit.
#3 [medium] Should fix: the two-message prefill-chunk branch adds 6 lines to say what the existing 3-line error says
ignition/planning.py:692-701 (PR adds the branch):
result = attempt()
if result is not None:
effective_context = min(result.context, result.prepared_context)
if chunk > effective_context:
if prefill_chunk is None:
raise UsageError(f"the {effective_context:,}-token request context is below the {chunk:,}-token "
f"default prefill chunk; pass --prefill-chunk-size (a multiple of 64) below "
f"{effective_context:,} or a larger --request-context")
raise UsageError(f"--prefill-chunk-size {chunk:,} exceeds the {effective_context:,}-token context this plan allows")
Stock (single message, 3 lines): if chunk > result.context: raise UsageError(f"--prefill-chunk-size {chunk:,} exceeds the {result.context:,}-token context this plan allows")
The PR turns 3 lines into 9 and adds a two-message branch to say the same thing: the chunk is larger than the context this plan allows. The special case exists only because a recipe default chunk (4096) can now exceed a small --request-context, and the generic message already names both numbers, which is all a user needs to pick either remedy. The branch costs 6 lines plus a second error string that no test asserts (grep for "request-context"/"positive token count" in tests/ → no matches).
Smaller: keep one message, replace result.context with the prepared context: if chunk > min(result.context, result.prepared_context): raise UsageError(f"--prefill-chunk-size {chunk:,} exceeds the {min(result.context, result.prepared_context):,}-token context this plan allows") or bind it once in a local. Saves 6 lines of the 7 the hunk adds.
Note the sibling validation at planning.py:459-460 (if context is not None and context <= 0: raise UsageError(... --request-context ...)): it is a caller-guaranteed check. fit() also validates mla_compute_mode, speculation, etc., so per-argument validation is the house style, and it costs 2 lines; it is not worth a separate finding except as part of the total. However it is the only place --request-context 0 is caught, so it must stay if the flag stays.
#4 [medium] Should fix: the docs say the same thing three times, and advertise out-of-scope multi-model hosting
docs/cli-design.md:446 row, trimmed. Present row is 1 very long line that repeats three things the document already says:
- "a request that would exceed N is rejected by the engine's standard context ceiling" — already specified at docs/cli-design.md:1443 ("Context limit | The checkpoint maximum, capped by --request-context at export") and :1493 ("Context limit | The smaller of the prepared context ceiling, capped by --request-context, ..."). Those two table rows are the PR's other two doc edits (:1443, :1493) and say the same thing a third time.
- "since the per-request cache allocation is sized from the prepared context" — already true for every core and documented at :828-833.
- "Command line only; a core's catalog is fixed at export, so changing it requires re-export" — the same trailing sentence is already carried by --mixed-prefill (:447) and by --kv-cache-limit's note that the runtime flags need no re-export (:874-876).
Smaller, one row:
| --request-context N | Cap the prepared per-request context and max_sequence_tokens at N tokens; shorter contexts need less KV per active request. Command line only; changing it requires re-export. | The recipe's maximum context |
and drop the :1443 and :1493 edits (the flag then appears once, in the flag table). ~2 doc lines + roughly half the 446 row's prose. Note the prose also contradicts the change's own rationale: it advertises "a memory-constrained multi-model deployment", which AGENTS.md:171-175 lists as unapproved scope ("multi-model hosting and routing ... require an explicit maintainer decision").
#5 [medium] Nit: the new setting is invisible in the plan report, and derive()'s new parameter is a pure pass-through
-
Plan.to_dict()(ignition/planning.py:389-442) does not includeprepared_contextorcontext_target, although every other plan setting is recorded there (context,checkpoint_context,prefill_chunk,mixed_prefill, ...). AGENTS.md:452-456 requires the plan, its printed report, and recorded measurements to describe what was prepared; the flag changesmax_sequence_tokensyet the printed plan and the benchdetails["configuration"] = plan.to_dict()(ignition/cli/bench.py:237) cannot show it. Fixing this is an addition, so as a subtraction: if the flag is kept, drop the field and derive the value at the single consumer. -
Dead/one-sided flag surface:
--request-contextis added to_preparation_arguments(ignition/cli/init.py:136-170), which serves export, bench and debug-serve — but NOTflare run(docstring of _server_options at ignition/cli/serve.py:60-72 comments "Derive native server settings independently of preparation's physical KV backing", max_body_bytes still usesrecipe.context, not the prepared context). So the docs' claim that a request beyond N "is rejected by the engine's standard context ceiling" holds only because the value reaches BasePreparationConfig.context; nothing in ignition's own debug-serve path re-reads it, and the benchmark's--contextscheck at planning.py:248 (selection.required_context > self.context) still compares against the recipe max, not the prepared context. That is a behavioural gap, but for the subtraction lens: the flag is worth nothing without the reject path, so the smaller shape is one value on the plan plus the two consumers, not a new flag family threaded through bench. -
ignition/cli/preparation.py:56addscontext: int | None = Nonetoderive()and forwards it at :68 — a pure pass-through parameter of the kind the file otherwise avoids only when one command differs (it does not here: all three callers passargs.request_contextor nothing). If the flag goes, this parameter goes entirely (2 lines). -
No test asserts any of the new behaviour: grep of tests/ for request_context/prepared_context/context_target/
--context→ no matches (tests/cli/test_commands.py:80's old--contextusage-error assertion the maintainer flagged in #454 is gone from main too). The historical #454 review asked for tests that fail without the change; the diff adds none, so as a subtraction there is nothing to trim here, but it means none of the new branches (the positive check, the two-message chunk branch) is protected.
#7 [medium] Per-file examination record: what each changed file contributes and where nothing can be cut
Diff is +35/−15 over 7 files (pr_files). Hunk inventory:
- ignition/preparation/bootstrap.py:58 (+1/−1) —
"context": plan.prepared_contextinstead ofplan.recipe.context. The only load-bearing line in the PR; it is what lowersBasePreparationConfig.context(bootstrap.py:33, default 262144) and therefore the core'smax_sequence_tokens. Nothing to subtract. - ignition/cli/init.py:167-170 (+4) — flag + 3-line help on
_preparation_arguments, so it lands on export, bench and debug-serve at once. Nothing to cut within it; it exists only to feed the line above. - ignition/cli/preparation.py:56 and :68 (+2/−1) —
derive()keyword and forward. Pure pass-through (entry 5). - ignition/cli/bench.py:176-177 (+2/−1) — same forward from
run(). Tracing further:_measure→plan.to_dict()fordetails["configuration"](bench.py:237);ignition/bench/runner.py:388checkscase.context_tokens + required > layout.contextagainst the recipe max, unchanged. So bench gains the flag but no visible consequence beyond preparation. Nothing else to cut in the file. - ignition/cli/serve.py:289 and :472 (+2/−2) — forwards from
_prepare(export path) anddebug_serve._server_options(serve.py:60-72) still sizesmax_body_bytesfromrecipe.contextand states "context is limited by the checkpoint and available cache capacity"; that inconsistency is a defect note, not a subtraction. - ignition/planning.py (+21/−7) — field :176 (+1), property :368-373 (+5, entry 2), positive check :459-460 (+2),
context_targetforward :535 (+1),fit/plankeywords :453/:591 (+2), thecontext=contextforward :674 (+1), the chunk branch :692-701 (+7/−3, entry 3). Every one of these is scaffolding for bootstrap.py:58 except the chunk branch and the property, both of which have smaller equivalents. - docs/cli-design.md (+3/−2) — :446 row and the two table-row rewords :1443/:1493 (entry 4).
Net: 34 of 35 added lines exist to carry one integer to one consumer; ~15 can go without losing the behaviour the PR claims.