#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.
#9 [high] Should fix: the new test block repeats its own assertions and the manifest helper's generic behaviour (~13 of +57 lines)
tests/cli/test_planning.py:211-265 is the new test (57 added lines, the largest single hunk in the PR: pr_files shows tests/cli/test_planning.py +57/-0). Candidates that prove nothing new:
-
Clamp case duplicates the valid case. :224-227 asserts
capped.prepared_context == min(recipe.context, 131072, capped.tokens); :230-232 asserts the same expression for 500000. With the property collapsed tomin(self.context, self.context_target)there is no separate branch, so one case suffices. ~4 lines. -
context=0andcontext=-1hit one branch. planning.py:461-462 validatescontext <= 0in a single check; twopytest.raisesblocks (:235-238) exercise the same line. ~2 lines. -
d["context"] == capped.context(:247) restates :227. ~1 line. -
The "no context_target when unset" block (:259-265, 7 lines) re-proves
from_plan's generic skip. rebuild_manifest.py:350-352add()returns early onvalue is Nonefor every parameter; the generic behaviour is already covered by the sibling tests' decode loop (tests/cli/test_planning.py:92-106). Alsoreproduction_argumentsgating is the sameis not Nonepattern used by every other flag (:266-319). ~6 lines. -
Wrong field asserted. :257 asserts
by_key["context_target"].value.int64_value == 131072, but_preparation_value(rebuild_manifest.py:332-333) emits{'uint_value': value}for any non-negative int, so the oneof setsuint_valueandint64_valuereads 0. As written the assertion fails; the sibling pattern to copy is tests/preparation/test_native_publication.py:78 (uint_value=1). One line, wrong direction (a fix, not a deletion) — but it shows this block was not run.
Net: ~13 of the 57 added test lines carry no distinct behaviour. The test's own header comment (:212) and section comments (:217, :223, :229, :234, :240, :244, :249, :259) restate the assertions below them — another ~8 lines if the blocks are merged.
#11 [high] Report (updated, run at head de1b5b5) — verdict: make it smaller first; ~45 of 98 added lines removable
PR 533, head de1b5b5, base main: 9 files, +98/−18 (pr_files). That splits as +41/−18 in code and docs and +57/−0 in tests — superseding the "+35/−15 across 7 files" figure of entry #8.
Ranked findings (all previously recorded, plus the new test finding #9):
- Blocking (~28 lines) — the flag re-implements runtime
--kv-cache-limit. Drop--request-context,Plan.context_target, thecontext=keyword onplan()/fit()/derive(), the<= 0check,prepared_contextand the chunk-branch rewrite; only ignition/preparation/bootstrap.py:58 survives as a no-op change. Evidence: the PR's own table is measured with--kv-cache-limit concurrency(docs/cli-design.md:738, :828-833; page_ceiling helios/src/runtime_core/memory.rs:284-331), and #454's maintainer asked for "a concrete workload that --max-concurrency and --kv-cache-limit cannot serve". (entry #1, wiring inventory in #10) - Should fix (~13 lines) — tests/cli/test_planning.py:211-265 (+57) repeats itself: duplicate clamp case, duplicate 0/-1 rejections, a re-proved generic
add()-skips-None path, plus one assertion onint64_valuethat cannot pass. (entry #9) - Should fix (~6 lines) — planning.py:692-701 turns the stock 3-line chunk check into a 9-line two-message branch. (entry #3)
- Should fix (~4 lines) —
prepared_contextduplicatesPlan.context:min(recipe.context, N, tokens)==min(self.context, N), and the extraminat :696 goes. (entry #2) - Should fix (~3 doc lines) — docs/cli-design.md:446 repeats :1443 and :1493 (this PR's own other edits) and the KV-limit section; the removed prose also cites the multi-model hosting scope AGENTS.md:171-174 rejects. (entry #4)
- Nit (~2 lines) —
derive()'scontextparameter is a pure pass-through;to_dict()recordscontext_targetbut not the effectiveprepared_contextthe boot config actually uses (planning.py:432 vs bootstrap.py:58). (entry #5)
Total removable: ~30 code lines of the 41, ~13 of the 57 test lines, ~2-3 of the 5 doc lines — roughly 45 of the 98 added lines, 70 of them if the flag goes entirely with the runtime argument.
Left behind: ignition/cli/serve.py:68-69 (max_body_bytes from recipe.context, context_hint still "limited by the checkpoint"), ignition/cli/help.py:38 (--prefill-chunk-size: 64..{recipe.context}), ignition/bench/runner.py:388 (validates against layout.context, i.e. the pool-bound value, while the new bench path caps preparation).
File-by-file: entry #7 (unchanged; bootstrap.py:58 is the sole load-bearing hunk).
#12 [high] Research summary
Reviewed PR #533 at head de1b5b5 through the subtraction lens, against AGENTS.md, docs/design-review.md (not opened), the charter, and the maintainer's earlier review of the same change in closed PR #454.
The head moved since my last pass, so counts are corrected: 9 files, +98/−18 — +41/−18 in code and docs, +57/−0 in tests (not the "+35/−15 across 7 files" I reported before).
Findings, ranked by lines saved (all in the scratchpad, entries #1-#5, #9-#11):
- Blocking, ~28 lines — the flag re-implements runtime
--kv-cache-limit. The PR's own VRAM table is measured with--kv-cache-limit concurrency(an existing runtime flag applied at core load, docs/cli-design.md:738, :828-833;page_ceilingin helios/src/runtime_core/memory.rs:284-331), and #454's maintainer asked for a workload that flag cannot serve. The only genuine delta is one integer reaching ignition/preparation/bootstrap.py:58. - Should fix, ~13 of the 57 test lines (new this pass) — tests/cli/test_planning.py:211-265 repeats itself: the clamp case re-asserts the same
min()as the valid case,0and-1hit one<= 0branch, and the seven-line "no context_target when unset" block re-provesfrom_plan's genericadd()-skips-Nonerule. Also,:257assertsvalue.int64_valuewhile_preparation_value(rebuild_manifest.py:332-333) emitsuint_valuefor a non-negative int — that assertion cannot pass. - Should fix, ~6 lines — planning.py:692-701 turns the stock three-line prefill-chunk error into a nine-line two-message branch; one message naming the effective context suffices.
- Should fix, ~4 lines —
prepared_context(planning.py:370-375) duplicatesPlan.context:min(recipe.context, N, tokens)ismin(self.context, N), which also makes the extraminat :696 dead. - Should fix, ~3 doc lines — docs/cli-design.md:446 states what the PR's own other two edits (:1443, :1493) already state, and its prose advertises the multi-model hosting scope AGENTS.md:171-174 rejects.
- Nit, ~2 lines —
derive()'scontextkeyword is a pure pass-through, andto_dict()recordscontext_targetbut not the effectiveprepared_contextthe boot config actually uses.
Total removable: roughly 45 of the 98 added lines (about 30 of the 41 code lines, 13 of the 57 test lines, 2-3 of the 5 doc lines) — about 70 if the flag is dropped altogether and the runtime --kv-cache-limit carries the argument. Left behind: ignition/cli/serve.py:68-69 (max_body_bytes and context_hint still sized/worded from the recipe max), ignition/cli/help.py:38, and ignition/bench/runner.py:388.
#13 [high] Correction: earlier notes #5/#8 said "no test covers the new behaviour" — false at head de1b5b5
Stale claims that the final report must not repeat (the head moved from the commit I reviewed to de1b5b5):
-
"No test asserts any of the new behaviour" (entry #5, item 4; entry #6; entry #8 "Open questions"). False at de1b5b5: tests/cli/test_planning.py:211-265 adds
test_request_context_target_prepared_context_and_manifest(+57 lines) covering the no-op path, the clamp, both validations,to_dict()and the manifest keys.grep -n "prepared_context\|context_target\|request_context" tests/now returns tests/cli/test_planning.py:211-265 only. The test's own problem is the opposite one — it repeats itself (entry #9) — and :257 assertsint64_valuewhere_preparation_value(rebuild_manifest.py:332-333) emitsuint_value, so that line cannot pass. -
"+35/−15 across 7 files" (entries #1, #6, #7, #8). Actual at de1b5b5 (pr_files): 9 files, +98/−18 — docs/cli-design.md +3/−2, ignition/cli/init.py +4/−0, ignition/cli/bench.py +2/−1, ignition/cli/preparation.py +2/−2, ignition/cli/serve.py +3/−3, ignition/planning.py +23/−9, ignition/preparation/bootstrap.py +1/−1, ignition/preparation/rebuild_manifest.py +3/−0, tests/cli/test_planning.py +57/−0. Code+docs = +41/−18; tests = +57/−0.
-
Unchanged and still true:
ignition export M --ranks 2 --request-context Ndoes now forward the flag (cli/serve.py:206), so the autobot blocker "multi-host never passes context" is fixed at this head;Plan.__post_init__does now validate the page multiple (planning.py:289-290, reflecting Helios'catalog.rs:50-57requirement);to_dict()/reproduction_arguments/from_planall record the setting (planning.py:432, rebuild_manifest.py:264-265, :390). So the "left behind" list shrinks to serve.py:68-69, cli/help.py:38 and bench/runner.py:388.
#15 [high] Report of 2026-11-26, run at head 02023eba — verdict: make it smaller first; ~36 of 84 added lines removable
PR #533 "Cap the per-request context target", head 02023eba, base main. pr_files: 9 files, +84/−18 — docs/cli-design.md +3/−2, ignition/cli/init.py +2, bench.py +3/−1, preparation.py +1/−1, serve.py +5/−4, ignition/planning.py +19/−9, preparation/bootstrap.py +1/−1, rebuild_manifest.py +3, tests/cli/test_planning.py +47. Code+docs = +37/−18; tests = +47.
VERDICT: make it smaller first. ~36 of 84 added lines removable without losing behaviour; ~75 if the flag is dropped and the runtime --kv-cache-limit carries the argument.
RANKED FINDINGS (all verified by reading the code at pr/533):
-
BLOCKING (~20 code + 47 test + 3 doc lines) — the whole --request-context surface re-implements the existing runtime flag. Surface: cli/init.py:167-168 (flag + help), cli/preparation.py:55 (keyword), :69 (forward), cli/bench.py:177, cli/serve.py:207/291/476, cli/serve.py:319 (plan line), planning.py:186 (field), :260 (bench check), :377-381 (property), :438 (to_dict), :467-468 (<=0 check), :461/:549/:602/:689 (keywords+forward), :709-711 (chunk check), bootstrap.py:58, rebuild_manifest.py:264-265, :389, docs/cli-design.md:446/1443/1493. The PR's own evidence table is measured with
--kv-cache-limit concurrency(existing runtime flag: docs/cli-design.md:738 default memory, :828-833 semantics; page_ceiling helios/src/runtime_core/memory.rs:284-331). The only datum this PR adds is a lower exported max_sequence_tokens, which flows through exactly one load-bearing line: bootstrap.py:58 "context": plan.prepared_context -> BasePreparationConfig.context (bootstrap.py:33) -> helios/src/server/config.rs:131 -> limits.max_sequence_tokens (:148), narrowed to the pool at helios/src/model.rs:268-272 and validated at helios/src/model/catalog.rs:48-57. Smaller version: drop--request-contextfrom all four entry points, drop Plan.context_target and prepared_context; optionally oneBasePreparationConfig.contextinteger if a cap is wanted. Nothing the runtime flag does is lost; the only lost datum is a lower request ceiling. Cite: AGENTS.md:165-169 (need must be a demonstrated defect or measured problem), :188-193 (no configuration switches without concrete requirement), charter "smallest footprint in shared code, or a way to solve it without new code at all"; #454 maintainer review asked for "a concrete workload that --max-concurrency and --kv-cache-limit cannot serve" and the resubmission does not answer it. -
BLOCKING-ish (~2 test lines, and a description claim with no code) — two assertions in the new test cannot pass because the code they test is not in the diff. tests/cli/test_planning.py:238-240
pytest.raises(UsageError, match="multiple of the")forcontext=100: there is NO page-multiple validation at this head.grep "multiple of" ignition/planning.pyfinds only the pre-existing prefill-chunk check at :636-637, whichcontext=100does not trip (default chunk 4096 is a multiple of 64 and ≤ recipe.context). So planning.plan(...) returns normally and the assertion fails. tests/cli/test_planning.py:254by_key["context_target"].value.int64_value == 131072: _preparation_value (rebuild_manifest.py:330-333) emitsuint_valuefor a non-negative int, so int64_value reads 0. The description's "a page-multiple validation" and "distinguishes the default chunk from an explicit one" are therefore accurate about a different (earlier) head, not this one; the chunk branch at planning.py:709-711 is already the single stock-style message. Fix: delete :238-241 and either delete :254 or assert uint_value. ~4 lines. -
SHOULD FIX (~13 of the +47 test lines) — the new test block repeats itself and re-proves generic helper behaviour. tests/cli/test_planning.py:229-232 clamp case duplicates :223-227 with a larger N (~4); :242-244
to_dict()restates the field already asserted at :225 (~1 could stay, but thedtemp is one line); theint64_valueline above (~1); the manifest round-trip at :247-253 duplicates the sibling manifest test at :92-106 which already asserts scope+value through from_plan (~4). Keep: the no-op case, one capped case, one rejection, one manifest key check. -
SHOULD FIX (~6 lines) — the
<= 0validation sits infit(planning.py:467-468), whichplan()re-enters once per candidate world size and per shortfall probe (:689, :693-705); it costs a re-check on every attempt and is the only validation of a flag outsidePlan.__post_init__. SincePlanalready validates every other flag there (:266-296), and the test drives everything throughplanning.plan(...), it can move or go with finding 1. -
NIT (~1-2 lines) — prepared_context's three-line body. planning.py:377-381
if self.context_target is None: return self.recipe.context/return min(self.recipe.context, self.context_target, self.tokens)equalsreturn self.recipe.context if self.context_target is None else min(self.context, self.context_target). NOTE: thecontext_target is Noneearly return is LOAD-BEARING (it must return recipe.context, which can exceed the pool-bound self.context, or the no-op claim breaks) — do not fold it away. Themin(result.context, result.prepared_context)at :709 is also load-bearing for the no-target case. -
NIT (~2 doc lines) — docs/cli-design.md:446 states the cap three times across the PR's own rows: :446 (flag table), :1443 ("capped by --request-context at export"), :1493 ("capped by --request-context"). Keep the flag row; the two owner-table rewords restate it. Also the row's "Command line only; a core's catalog is fixed at export, so changing it requires re-export" repeats the identical clause --mixed-prefill carries at :447.
LEFTOVER (code this change supersedes but does not update; small, and moot if finding 1 is taken):
- ignition/cli/serve.py:68
max_body_bytesstill sized fromrecipe.context, :69context_hintstill says "context is limited by the checkpoint and available cache capacity" — both misdescribe a capped core. - ignition/cli/help.py:38
--prefill-chunk-size: 64..{recipe.context}advertises a range above the effective prepared context. - ignition/bench/runner.py:388 validates
case.context_tokens + required > layout.context(pool-bound), not the new cap.
VERIFIED CLEAN (do not re-raise): the seam is right — bootstrap.py:58 is the whole mechanism; omitting the flag is byte-equivalent to main; all four entry points forward the flag (serve.py:207/291/476, bench.py:177); reproduction args and the manifest record it (rebuild_manifest.py:264-265, :389); bench's required_context check now uses prepared_context (planning.py:260); Plan is frozen with a defaulted field so existing constructions work.
NOT VERIFIED HERE: nothing was executed (no CI checks on the head). Claims 2's failures are arithmetic + schema reads. docs/design-review.md was not opened.
#16 [high] Research summary
Reviewed PR #533 at head 02023eba (+84/−18 across 9 files: +37/−18 code+docs, +47 tests) through the subtraction lens, against the charter, AGENTS.md:72-112/:165-199 and the maintainer's earlier review of closed #454. Findings are in scratchpad entry #15, ranked by lines saved.
Verdict: make it smaller first — about 36 of the 84 added lines can go without losing behaviour, ~75 if the flag is dropped.
Biggest items: (1) the whole --request-context surface (planning.py field/property/checks/forwards, four CLI entry points, manifest entries, docs rows, the test) re-implements the existing runtime --kv-cache-limit, and the PR's own VRAM table is measured with that runtime flag; the sole load-bearing line is bootstrap.py:58 passing plan.prepared_context into BasePreparationConfig.context, which reaches Helios max_sequence_tokens via helios/src/server/config.rs:131 (not opened),148. (2) Two assertions in the new test cannot pass at this head: context=100 is rejected by no code (planning.py has no page-multiple check — only the pre-existing prefill-chunk one at :636), and :254 asserts int64_value where _preparation_value emits uint_value. (3) The test block repeats its own cases and re-proves generic add()-skips-None behaviour already covered by the sibling manifest test. (4) fit's <= 0 check runs on every candidate re-entry instead of in __post_init__ beside the other flag validations. Left behind: serve.py:68-69, cli/help.py:38, bench/runner.py:388 still describe the recipe maximum as the served context. I also confirmed what is load-bearing and must not be cut: the context_target is None early return and the min(result.context, result.prepared_context) at :709.
Nothing was executed (no CI checks on the head); the failing-assertion claims are arithmetic and schema reads.
#17 [high] Line-savings tally and count provenance for the final report (head 02023eba)
Counts (provenance: pr_files at head 02023eba):
- 9 files, +84 / −18. Code+docs +37 / −18; tests +47 / −0.
- Per file added/removed: docs/cli-design.md +3/−2; ignition/cli/init.py +2/−0; ignition/cli/bench.py +3/−1; ignition/cli/preparation.py +1/−1; ignition/cli/serve.py +5/−4; ignition/planning.py +19/−9; ignition/preparation/bootstrap.py +1/−1; ignition/preparation/rebuild_manifest.py +3/−0; tests/cli/test_planning.py +47/−0.
Savings tally, ranked (each verified in the code at pr/533, details in entry #15):
- Drop the whole --request-context surface: ~20 code lines (cli/init.py:167-168; cli/preparation.py:55,69; cli/bench.py:177; cli/serve.py:207,291,319,476; planning.py:186,260,377-381,438,467-468 plus the
context=keywords at :461,:549,:602,:689 and the :709-711 rewrite; rebuild_manifest.py:264-265,389) + all +47 test lines + 3 doc lines (cli-design.md:446,1443,1493). Total ≈70 of 84. This is the ceiling if the argument holds; entry #15 states the one surviving line if a cap is still wanted (bootstrap.py:58 with one BasePreparationConfig.context integer ≈ 12-15 lines total). - Remove the two unfounded test assertions (test_planning.py:238-241 page-multiple block, :254 int64_value) → ~5 lines.
- Trim the repeated test cases (test_planning.py:229-232 clamp duplicate, :242-244 to_dict restatement, :247-253 manifest round-trip duplicating tests at :92-106) → ~9-10 lines.
- Move/merge the
<= 0check out of fit (planning.py:467-468) into post_init beside :266-296, or delete with finding 1 → ~2 lines. - Collapse prepared_context body (planning.py:377-381) → ~1-2 lines; keep the None early return and keep the min at :709.
- Trim docs duplication (cli-design.md:446 vs the PR's own :1443 and :1493, plus the re-export clause copied from :447) → ~2-3 lines.
Sum without dropping the flag ≈ 36 of 84; with the flag dropped ≈ 70-75.
Do-not-cut list (verified, previously mis-claimed as dead in earlier rounds): planning.py:377-380 context_target is None -> recipe.context; planning.py:709 effective_context = min(result.context, result.prepared_context); the context= keyword on derive()/plan()/fit() as the single funnel for the four entry points.
Not executed: no CI checks on this head; every behavioural claim in the report is arithmetic or schema reading. docs/design-review.md was not opened.
#19 [high] Should fix: the new test's clamp case cannot pass — the max bound rejects targets above the recipe max — and the oversized block plus three restatements are ~11 of +37 test lines
Head 9118add, diff +69/−5 across 6 files (code+docs +32/−5, tests +37/−0).
The flag declares max_fn=_recipe_context_limit (ignition/parameters.py:1316; _recipe_context_limit at :1268 returns context.recipe.context). RecipeParameters.validate (:1440) ends in super().validate(ctx) → validate_fields (:505) which, with min_value=1 and that max, raises --request-context for <alias> must be 1 through 262,144 for any target above the recipe max (:533-545). plan() validates before sizing (ignition/planning.py:540) and fit() validates again (:456).
Consequence: tests/cli/test_planning.py:310-313
oversized_params = replace(base_params, context_target=500000)
oversized = planning.plan(..., parameters=oversized_params)
assert oversized.parameters.context_target == 500000
assert oversized.prepared_context == recipe.context
raises UsageError before the asserts (fixture: context=262144, page_tokens=64, tests/cli/test_planning.py:139-140). 4 lines dead, and they encode a clamp the code does not have.
Other removable test lines (11 total, of the +37):
- :301
assert stock_plan.parameters.context_target is None— restates the field default. - :303
assert stock_plan.context == min(recipe.context, stock_plan.tokens)— restates the pre-existingPlan.context(planning.py:353-355), which this PR does not change. - :307
assert capped.parameters.context_target == 131072— restates the input at :305. - :326-329 (4 lines: ParseDict/FromString/by_key/scope assert) — re-proves
from_plan's generic value+scope plumbing already covered at tests/cli/test_planning.py:185-196 and :392-395; andParameterScope.DEPLOYMENTisParamSpec's default (parameters.py:91). Keep :324-325, which is the new datum (flag + value inreproduction_args). Keep: :302 (no-op claim), :308 (property), :315-317 (0 → "must be a positive integer", matches "--request-context"), :319-321 (100 → page check), :324-325.
#20 [high] Nit: three of the 13 added ParamSpec lines restate defaults, and prepared_context's clamp is unreachable — ~4 code lines
ignition/parameters.py:1309-1321 (+13) declares the field. Three lines restate ParamSpec defaults declared at ignition/parameters.py:86-91:
manifest_key="context_target"(:1317) —manifest_parametersfalls back todc_field.name(:607-612), andRecipeParameters.manifest_prefixis unset (onlySpeculationParameterssets one, :734), so the emitted key is alreadycontext_target.scope=ParameterScope.DEPLOYMENT(:1318) —ParamSpec.scopedefault isParameterScope.DEPLOYMENT(:91).repro_always=True(:1319) —reproduction_argsemits a non-boolean value whenevervalue != default_value(:651), and the default isNone(andfrom_planpassesdefaults=plan.recipe.parameters), so 131072 is emitted without it. Caveat: the siblingprefill_chunk/max_concurrencyspecs also spell these out, so this is style-consistent; ~2-3 lines. Load-bearing here:min_value=1(0 would otherwise pass0 % 64 == 0),max_fn,value_type=int(default is None),metavar,group,help.
ignition/planning.py:357-363 (+4):
target = self.parameters.context_target
if target is None:
return self.recipe.context
return min(self.recipe.context, target)
Because max_fn already rejects target > recipe.context (see the test note), the min can never clamp. Smaller, 3 lines:
target = self.parameters.context_target
return self.recipe.context if target is None else target
(1 line saved; the None branch stays — it is what makes the omitted flag a no-op.)
#21 [high] Should fix: the recipe-max clamp is implemented twice (parameters.py max_fn and planning.py min) and the docs describe the dead one
Head 9118add. The clamp exists twice and only one copy is live:
ignition/parameters.py:1316max_fn=_recipe_context_limitmakesvalidate_fields(parameters.py:533-545) reject any--request-contextabovecontext.recipe.contextwith "must be 1 through 262,144".ignition/planning.py:360-363still computesmin(self.recipe.context, target), which that bound makes unreachable.
So docs/cli-design.md:468 ("resolves to the smaller of N and the recipe maximum") and the PR description's "min(recipe.context, N)" describe behaviour the code rejects. Pick one and delete the other:
- keep
max_fn→docs/cli-design.md:468grows an upper bound andplanning.py:363becomesreturn self.recipe.context if target is None else target; - or drop
max_fn→ theminat :363 becomes live and the docs row is already correct (help then loses the "…through 262,144" suffix from_format_help, :250-260).
Either way one of the two statements goes; 1 line.
Doc duplication: the flag row's trailing "a core's catalog is fixed at export, so changing it requires re-export" repeats the identical clause in the --mixed-prefill row immediately below (docs/cli-design.md:469). Drop it from the new row; 0 lines saved but it shortens the row.
docs/cli-design.md:1436 (the owner-table "Context limit" row) is the one owner row the flag now changes — it is not a duplicate of :468 (the flag table lists flags; the owner table says which surface decides). Keep.
Left behind / not updated in the same change:
ignition/cli/help.py:46printsContext: {recipe.context:,} tokensforMODEL --help; harmless (it describes the recipe), but it is where a capped user looks first — no line change needed.- Nothing else reads
recipe.contextfor a user-visible bound:ignition/cli/serve.py:67-68both moved toplan.prepared_context, and the prefill-chunk bound (parameters.py:1458) is validated against the recipe max whileplanning.pyindependently rejects a chunk above the pool — the cap does not enter either.--request-context 8192with the default chunk 4096 is fine; a chunk between the cap and the recipe max still exports (helio'svalidate_prefillat helios/src/scheduler.rs:66-77 checks chunk ≤ max_sequence_tokens only at load). So the cap is not checked against--prefill-chunk-sizeat export:ignition plan --request-context 4096(min_value 1) with default chunk 4096 is OK, but--request-context 2048 --prefill-chunk-size 4096exports a core Helios rejects. Reporting as a nit, not proposing a new check.
#22 [high] Report of 2026-11-26 (head 9118add) — verdict: near-minimal; ~16 of 69 added lines removable with the flag, ~68 without
Head 9118add, pr_files: 6 files, +69 / −5. Per file: docs/cli-design.md +2/−1; ignition/cli/serve.py +2/−2; ignition/parameters.py +13/−0; ignition/planning.py +14/−1; ignition/preparation/bootstrap.py +1/−1; tests/cli/test_planning.py +37/−0. Code+docs = +32/−5; tests = +37/−0.
(The orientation packet says 6 files +69/−5; an earlier note in my scratchpad quoted +84/−18 from a superseded head — use +69/−5.)
Removable, ranked:
- Drop the flag's whole surface if the maintainer holds that the memory argument is the runtime
--kv-cache-limit's: ≈68 of 69 lines (parameters.py:1309-1321 = 13, planning.py:186-190 + 357-363 + 212 = ~14, serve.py:67-68 = 2, bootstrap.py:132 = 1 with the −1 restored, docs 2, tests 37). The one thing lost is a lower exportedmax_sequence_tokens, i.e. serving rejecting a request longer than N — the datum #454 asked to see justified. - Tests: 11 of the 37 (4 of them cannot pass — entry #19).
- parameters.py spec: ~3 lines that restate ParamSpec defaults (entry #20).
- planning.py:363: 1 line once the max_fn/min duplication is settled (entry #21).
- docs: 1 clause + the row's re-export sentence (entry #21).
Total with the flag kept: about 16 of 69. With the flag dropped: about 68 of 69.
Verified load-bearing (do not propose cutting): bootstrap.py:132 ("context": plan.prepared_context) is the entire mechanism; planning.py:364-362's target is None → recipe.context branch is what makes the omitted flag a no-op; planning.py:212 (bench compares prepared_context); the page-multiple check at planning.py:186-190 (Helios rejects a misaligned max_sequence_tokens at load, helios/src/model/catalog.rs:48-57, and ignition has no other page-alignment guard on this value); serve.py:67-68 (the two user-visible bounds — this closes the previous round's "left behind" finding).
#23 [high] Report of 2026-11-26, run at head 9118add — the change is near-minimal; 16 of 69 lines removable
Head 9118add. PR 533, +69/−5 across 6 files (code+docs +32/−5, tests +37/−0). Verdict: near-minimal; the shape is right (one optional param field, one accessor, one seam line, one serve-side bound pair) and I would not ask for rework — the remaining cuts are ~16 of 69 lines, or ~68 if a maintainer holds that the memory argument belongs to the runtime --kv-cache-limit.
Findings, ranked by lines saved:
- ~68 of 69 (blocking-if-the-argument-fails, otherwise out of my lens to decide): the flag's whole surface. The PR's own VRAM table is measured under
--kv-cache-limit concurrency(docs/cli-design.md:740,flare-cli/src/cli.rs:890-903), a runtime flag that already bounds the pool without a re-export; the only genuinely new datum is a lower exportedmax_sequence_tokens(bootstrap.py:132→helios/src/server/config.rs:131,148), which makes serving reject a request longer than N (helios/src/server/request.rs:350). #454 asked for exactly that workload statement. Cite AGENTS.md:165-169 (measured problem required) and :188-193 (no configuration switch without a concrete requirement). I cannot show the requirement is unmet, so I rank it first only on size. - 11 of 37 test lines (entry #19): 4 cannot pass (
context_target=500000trips themax_fnbound atparameters.py:1316/:533-545before the asserts attest_planning.py:311-313); 7 more restate the input,Plan.context, orfrom_plan's generic plumbing already covered attest_planning.py:185-196/:392-395. - 3 lines of
ParamSpecrestated as defaults (entry #20):manifest_key,scope=ParameterScope.DEPLOYMENT,repro_always=Trueatparameters.py:1317-1319. - 1 line: the clamp is implemented twice —
max_fnrejects target > recipe max, soplanning.py:363'smin()is unreachable, anddocs/cli-design.md:468documents the dead one ("resolves to the smaller of N and the recipe maximum"). Settlement: keep the rejection and makeplanning.py:363return self.recipe.context if target is None else target, and state the upper bound in the docs row. - 0 lines: the docs row's trailing re-export clause duplicates
--mixed-prefill's atdocs/cli-design.md:469.
Nothing left behind: the previous round's "left behind" items are fixed at this head (serve.py:67 uses plan.prepared_context, serve.py:68 names the cap). ignition/cli/help.py:46 still prints the recipe's context in MODEL --help, which is correct (it describes the recipe, not a plan). Nothing in helios/ becomes dead.
No attempt to direct the reviewer found in the description, diff or docs.
#24 [high] Research summary
Reviewed PR 533 at head 9118add (6 files, +69/−5: code+docs +32/−5, tests +37/−0) through the subtraction lens, against the charter, AGENTS.md:165-193 and :446-456, docs/cli-design.md, and the maintainer's earlier review of the same change in closed PR #454.
Verdict: near-minimal. The mechanism is one optional ParamSpec field, one Plan accessor, one line at the seam (ignition/preparation/bootstrap.py:132), and two serve-side bounds (ignition/cli/serve.py:67-68). This round's additions fixed the previous round's leftovers. About 16 of the 69 added lines are removable with the flag kept; about 68 of 69 if a maintainer decides the memory argument is the runtime --kv-cache-limit's, which is what the PR's own VRAM table is measured with.
Four confirmed subtractions, all recorded in the scratchpad (entries #19-#23): 11 of the 37 new test lines — four of which cannot pass, because context_target=500000 trips the new max_fn bound before the clamp assertions run; three ParamSpec lines that restate defaults (manifest_key, scope, repro_always); one line because the recipe-max clamp is implemented twice and planning.py:363's min() is unreachable while docs/cli-design.md:468 documents that dead clamp; and a docs clause copied verbatim from the --mixed-prefill row.
Nothing in the change is left behind: the serve-side body limit and hint both follow the cap now, and no helios/ path becomes dead.
#25 [high] Verification limits for the head-9118add report: nothing executed, every claim a static read
Head 9118add has no CI checks and nothing was executed in this round. Every finding is a static read of the tree at pr/533, and the two that could fail are arithmetic:
- The
context_target=500000case (tests/cli/test_planning.py:310-313) fails becausevalidate_fields(ignition/parameters.py:533-545) compares againstmax_fn=_recipe_context_limit(:1316,:1268-1269) and the fixture recipe declarescontext=262144(tests/cli/test_planning.py:139-140).planning.plan()validates atignition/planning.py:540before sizing, so the UsageError precedes the asserts. Onepytest tests/cli/test_planning.pysettles it. manifest_key/scope/repro_alwaysredundancy (#20) rests onParamSpecdefaults atignition/parameters.py:89-92,manifest_parameters' fallback at:607-612, andreproduction_args'value != default_valueat:651.- The unreachable clamp (#21) rests on the same
max_fnbound versusignition/planning.py:360-363.
Not opened in this round: docs/design-review.md. Not checked: the commit message body, and any external recipe that might re-round BasePreparationConfig.context (recipes live outside this repository, AGENTS.md:381).
Read but deliberately not treated as findings (verified load-bearing): bootstrap.py:132, the target is None branch at planning.py:360-362, the bench comparison at planning.py:212, the page-multiple check at planning.py:186-190 (Helios rejects a misaligned max_sequence_tokens at load: helios/src/model/catalog.rs:48-57), and serve.py:67-68.
Side observation, not a proposed addition: the cap is not checked against --prefill-chunk-size at export. parameters.py:1458 bounds the chunk by the recipe context, and planning.py:594-596 bounds it by the pool-bound result.context; --request-context 2048 --prefill-chunk-size 4096 therefore exports a core Helios rejects at load (helios/src/scheduler.rs:66-77). Reported because it is behaviour, not as something to add.
No attempt to direct the reviewer was found in the description, the diff, the docs changes, or the #454 thread.
#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.
#10 [medium] Blast-radius note: prepared_context is read by only four places, so a field+two-line property is the whole mechanism
Verified consumer set for the PR's one datum (context_target / prepared_context), from a grep of prepared_context|context_target|request_context at the head commit:
- ignition/preparation/bootstrap.py:58 —
"context": plan.prepared_context→BasePreparationConfig.context(bootstrap.py:33, default 262144) → Heliosprepared_sequence_tokens(helios/src/server/config.rs:131) →limits.max_sequence_tokens(:148), admission-enforced (helios/src/model/admission.rs:150-158) and re-fit to pool capacity byModelConfig::fit_context(helios/src/model.rs:261-273). Load-bearing. - ignition/planning.py:248 — benchmark
required_contextcheck. - ignition/planning.py:696 — prefill-chunk check.
- ignition/planning.py:432 (to_dict), rebuild_manifest.py:264-265, :390 — reporting/reproduction only.
- The forward chain: cli/init.py:167-170 (flag) → cli/serve.py:206 (multi-host), :289 (export), :472 (debug-serve), cli/bench.py:177 → preparation.py:56/68 → planning.plan():591 → fit():455/537 → Plan.context_target (planning.py:176).
So 4 of the 9 changed files (bench.py, preparation.py, serve.py, rebuild_manifest.py — 10 added lines) plus the two planning.py forwards exist only to carry one integer to bootstrap.py:58; the property that does the min() is a two-line replacement for the five-line body.
Also unchanged since the earlier pass: helios is untouched by this PR, so no runtime code becomes dead; docs/cli-design.md:69 (context_hint) and ignition/cli/serve.py:68-69 (max_body_bytes from recipe.context, hint text "limited by the checkpoint") still describe the pre-cap world, and ignition/cli/help.py:38 still advertises --prefill-chunk-size: 64..{recipe.context}.