Recommendation: Ready To Merge
Head 1b86a19 cleanly rebases PR #533 onto c146d7b and resolves the remaining status_parts() display mismatch noted in the prior Ready To Merge review (503a438) without introducing any correctness, safety, concurrency, or compatibility regressions. The feature keeps a minimal, opt-in footprint in Ignition (RecipeParameters.context_target, Plan.prepared_context, and the single common_preparation_kwargs()["context"] seam), leaves Helios untouched, and is byte-equivalent to main when --request-context is omitted. Confirm python-cpu.yml CI is green on 1b86a19 before merging.
Merge Risk
Level: Low
- Scoped entirely to Ignition CLI parameters, planning arithmetic, serve/help metadata, docs, and one isolated CPU unit test (+79/−31 across 9 files); zero changes to Helios serving hot paths, locking, scheduling, or captured-graph contracts.
- Omitting
--request-contextleavescontext_target=None(omit_none=True),prepared_context == declared_context, and manifest/reproduction_args/status_parts/context_hintoutput unchanged relative tomain. - Runtime safety invariants hold end-to-end: Helios validates preparation manifests without a key allowlist (
helios/src/runtime_core/preparation.rs:82-138), rejects misalignedmax_sequence_tokens(helios/src/model/catalog.rs:48-55) and oversizedprefill_chunk_size(helios/src/scheduler.rs:65-75) matching export-time guards, clamps served context to the physical pool (helios/src/model.rs:261-273), and rejects over-length requests before page allocation (helios/src/model/admission.rs:154-169,helios/src/server/request.rs:588-598).
Walkthrough
ignition/parameters.py: Declarescontext_target: int | None(--request-context,min_value=1,DEPLOYMENTscope) onRecipeParameters(:1344-1352), explicitly emits--request-context Ninreproduction_args()when set (:1529-1530), and appends a cap-aware fragment instatus_parts()guarded ondeclared is None or self.context_target < declared(:1606-1609).ignition/planning.py: AddsPlan.prepared_context(:371-374), validates page-size alignment on the resolvedprepared_contextinPlan.__post_init__(:198-199), updates benchmark workload (:221) and prefill-chunk (:625-628) checks to usemin(context, prepared_context), and wiresprepared_contextintodemand_pages(:330),guaranteed_tokens(:379), andPlan.to_dict()(:408).ignition/preparation/bootstrap.py: Passesplan.prepared_contextas"context"incommon_preparation_kwargs()(:132), carrying the cap into single-host export, multi-host export (ignition/cli/serve.py:188-209),ignition bench(ignition/cli/bench.py:186-267), and--directserving (ignition/direct/scheduler.py:202,561).ignition/cli/serve.py&ignition/cli/help.py: Sizesmax_body_bytesfromplan.prepared_context(serve.py:69-72), appends the--request-contextnote tocontext_hintonly whenplan.prepared_context < plan.declared_context(serve.py:73-74), and notes inmodel_epilogthat--request-contextcan lower the recipe maximum (help.py:46).docs/&tests/cli/test_planning.py: Documents--request-contextindocs/cli-design.md(:454,:1443) anddocs/direct-execution.md(:55), points universal-field prose indocs/cli-design.md(:444-446) anddocs/preparation-development.md(:17-19) toRecipeParameters, and addstest_request_context_target_prepared_context_and_manifest(tests/cli/test_planning.py:298-330).
Pre-merge Checks
- [PASS] Security / malicious screen: Pure Python parameter/planning/docs diff with no unsafe I/O, deserialization, or prompt injection in the diff or PR thread.
- [PASS] Charter & value fit: Smallest-footprint Ignition-layer change with zero runtime/per-model branching; provides an export-time per-request admission ceiling and concurrency-proportional KV sizing under
--kv-cache-limit concurrency. - [PASS] Related / duplicate / conflict check: Closes #454 (addressing prior review points); cleanly rebased onto
c146d7bwith no hunk overlap against open PR #635 (file-level rebase only if #635 merges first). - [WARN] Tests & verification evidence: All assertions in
tests/cli/test_planning.py:298-330and existing planning/help tests verify statically on1b86a19(properly isolated viamonkeypatch), and Qwen3.8-27B VRAM measurements under--kv-cache-limit concurrencyare provided, but no pytest /.github/workflows/python-cpu.yml(not opened) CI run output is attached at head1b86a19yet.
Blockers
None.
Should Fix
None.
Subtract / Simplify
ignition/planning.py:366-374,:221,:625-628— foldprepared_contextintoPlan.context(optional follow-up):Plan.contextcurrently computesmin(self.declared_context, self.tokens)even though its docstring states"The longest sequence one request may reach.", forcing both the benchmark guard (:221) and prefill-chunk guard (:625-628) to repeatmin(self.context, self.prepared_context). ChangingPlan.contexttoreturn min(self.prepared_context, self.tokens)removes the redundant local variable and both manualmin(...)intersections while makingPlan.to_dict()["context"]reflect the true reachable ceiling (with identical values whenevercontext_target is None).
Nits
ignition/parameters.py:1344-1352: Adddefault_label="recipe maximum"so generated--helpaligns withdocs/cli-design.md:454instead of renderingdefault: none(ignition/parameters.py:303-304).ignition/parameters.py:1607: Passctx(constructed at:1587withroot=self) instead of rawcontextto_declared_context_limit(self, ctx)for consistency with:1590-1601.docs/cli-design.md:454& PR description: Clarify precedence indocs/cli-design.md:454(values above the recipe maximum clamp before the page-multiple check, matchingignition/planning.py:198), and tighten the PR description's opening sentence / Result bullet 3 so they match the Evidence note — preparation sizing (ignition/planning.py:501-510) is cap-independent and KV pool savings occur at serve time under--kv-cache-limit concurrency|context(helios/src/runtime_core/memory.rs:308-322,704-708).tests/cli/test_planning.py:298-330: Optionally add cases coveringprefill_chunk > prepared_contextrejection (ignition/planning.py:625-628) andstatus_parts()suppression whencontext_target >= declared(ignition/parameters.py:1606-1609).
Dropped on verification
- Correctness F1 (Major —
max_body_bytes413s on large tool schemas / base64 images atignition/cli/serve.py:69-72): Dropped. Tool JSON schemas are rendered into prompt tokens at ~3–6 bytes/token versus_BODY_BYTES_PER_TOKEN = 32(serve.py:24), so a 256 KiB schema already far exceeds an 8,192-token context cap, and vision images already have a dedicatedplan.max_images * recipe.image_bytesterm (serve.py:71). Only extreme tiny caps (e.g.,--request-context 64 --prefill-chunk-size 64→ 2 KiB) could hit JSON envelope overhead; this hunk is also unchanged since the priorReady To Mergehead. - Correctness F2 (Major — missing post-prepare assertion that external recipes copy
config.contextintomax_sequence_tokensatignition/preparation/bootstrap.py:132): Dropped.common_preparation_kwargs()["context"]is the pre-existing Ignition-to-recipe contract established onmain(including#212'sdeclared_contextandadjust_context), with no post-prepare assertion onmain; the PR's measured per-slot VRAM deltas under--kv-cache-limit concurrencyalready confirm the cap propagates tomax_sequence_tokens. - Correctness F3 / Value Prop (Major — blocking on export-size wording and missing
--memory-limit/--kv-cache-limit contextbaseline rows): Downgraded to a PR-description wording nit above. The Evidence section already includes an explicit caveat for default--kv-cache-limit memorymode, and a host-independent admission ceiling enforced before page loading is distinct from pool-level--memory-limit/--kv-cache-limitcontrols. - Subtraction S1 large variant (
RecipeParameters.adjust_contextfold) & S3 (deleteignition/planning.py:198-199in favor ofParamSpec.multiple_oforignition/parameters.py:1497-1501): Dropped.ParamSpec.multiple_of(ignition/parameters.py:88) only accepts a staticintconstant (not a recipe-dependent page size), andignition/parameters.py:1497validates against unadjustedctx.recipe.page_tokensrather thanPlan.page_tokens(adjust_page_tokens, which scales by context-parallel width), while also losing the--request-context-specific error message and risking ordering bugs in externalRecipeParameters.adjust_contextoverrides. - Subtraction S2 (remove
"prepared_context"fromPlan.to_dict()atignition/planning.py:408): Dropped. Adding"prepared_context"was explicitly requested in Round 2 so the plan JSON distinguishes the resolved post-cap ceiling from rawcontext_target(when oversized) and pool-clampedcontext. - Subtraction S4 (revert docs de-enumeration in
docs/cli-design.md:442-449anddocs/preparation-development.md:17-19): Dropped. Replacing both closed field enumerations with a pointer toignition/parameters.pywas explicitly suggested in Round 3. - Correctness F5 part (
--prefill-chunk-sizemax_fn=_declared_context_limitatignition/parameters.py:1336): Dropped. Keepingmax_fn=_declared_context_limitpreserves recipe-levelMODEL --helpranges (asserted bytests/cli/test_planning.py:494) whileignition/planning.py:625-628rejects any chunk exceeding the effective cap at export time before GPU work begins.