Verdict: worth merging
The capability is needed, the layer is right, and the footprint is small: 8 files — ~40 lines of code plus a 43-line test, all Ignition Python plus docs (one optional field on the shared RecipeParameters base, one Plan.prepared_context accessor, one consumer line, one CLI argument that the parameter system generates). There is no Helios change, no per-model branch, and omitting the flag is a strict no-op. The two things I said last round must be fixed before merge — the unpatched source_identity() in the new test and the absence of any assertion pinning the seam that actually changes the core — are both fixed at head 448f70a7. What remains is one missing test, two sentences of docs and three reporting nits.
Why this belongs in the project (charter mapping)
- It meets the "what gets merged" bar. It converts
#454'sCHANGES_REQUESTEDreview fromyatesdrinto code, and it addresses a measured memory problem — Qwen3.8-27B on one RTX PRO 6000 Blackwell (SM120, 96 GB, one of the vision's two named hardware targets), with model, commands, revision and a VRAM table. 55.8 → 39.8 GB at concurrency 4 is 16 GB of real headroom on a workstation card, which is exactly the "squeeze the most out of workstation and compact hardware" case, not a hypothetical. - Solve the right problem in the right place (#404). The runtime genuinely cannot do this.
--kv-cache-limitand--memory-limitshape the pool;max_sequence_tokens/max_model_lenare baked into the core at export (helios/src/server/config.rs:131,:148), enforced at admission (helios/src/server/request.rs:350), advertised in/v1/models(helios/src/server/models.rs:81) and only subsequently clamped to the physical pool (helios/src/model.rs:261-273). An honest under-capacity advertisement is an export-time decision, andignition/preparation/bootstrap.py:132→BasePreparationConfig.contextis the single seam every recipe consumes. This is the smallest footprint in shared code — the exact thing the charter asks for. - No per-model special cases or flags. One field on the universal base; every recipe inherits it; zero branches on model identity; zero runtime change.
- No duplication. Nothing else lowers or honestly advertises the admission ceiling.
#454's objection 2 ("sentinel: use--kv-cache-limit") is answered by the flag's own evidence section: under the default--kv-cache-limit memorythe pool fills free VRAM regardless (helios/src/runtime_core/memory.rs:290-292), so the cap's effect there is admission control only. The alternative without new code is minting recipe variants per context, which is strictly worse. - No silently ignored API fields (#417). A request above the cap is rejected at admission rather than truncated, and
Plan.to_dict()now carriesprepared_context(planning.py:396), so the served extent is reported rather than the stock number.
What I verified at this head (fixes since my last report)
- The new test patches the environment.
tests/cli/test_planning.py:296setssource_identity, sorebuild_manifest.from_planat:329no longer hashes ignition/flashinfer/flare-heliopause or requiresfind_spec("flashinfer"). - The seam is now pinned.
tests/cli/test_planning.py:316-319assertscommon_preparation_kwargs(capped)["context"] == capped.prepared_context == 131072and!= recipe.context. Revertingbootstrap.py:132toplan.recipe.contextnow turns the test red — previously the whole test stayed green with the cap disconnected, which was the most serious remaining gap. - The printed report shows the served value, not the request.
parameters.py:1560-1561emitsrequest context {min(context_target, recipe.context):,} tokens, so--request-context 500000prints the recipe maximum. That closes my previous item 7. - The safety checks line up with the quantity that is actually served.
planning.py:186-190gates the page-multiple check ontarget <= recipe.context— precisely the set whereprepared_context == target— so it validates the served extent and leaves an oversized target a documented no-op;:212usesmin(context, prepared_context)for bench;:594-597bounds the prefill chunk bymin(result.context, result.prepared_context)so a cap below the chunk fails at export instead of after a full GPU preparation with Helios refusing the core (helios/src/scheduler.rs:66-77viamodel/catalog.rs:42);:368folds the cap intoguaranteed_tokens. checkpoint_context→prepared_contextinto_dict(planning.py:395-396) is safe: a repo-wide search finds zero readers ofcheckpoint_context(Rustflare inspectreadsdeployment["max_sequence_tokens"], which now carries the capped value through the core itself).- The description now scopes its evidence to
--kv-cache-limit concurrencyand states that under the defaultmemorymode the cap buys admission control only, and thefit_contextsentence is now accurate. With why / what changed / result / evidence in order, it satisfies the charter's four-part description requirement.
Should fix before merge (all small, none touching the design)
- The one new safety check has no test.
planning.py:594-597is untested. The fixture's chunk is 4096 (tests/cli/test_planning.py:120), so onepytest.raises(UsageError, match="prefill-chunk-size")withcontext_target=2048, beside:321-327, covers it. docs/cli-design.md:458under-documents two constraints a user will hit: the cap must be at least--prefill-chunk-size, and it also lowers the default output allowance becausemax_new_tokensdefaults tomax_sequence_tokens(helios/src/server/config.rs:210-213). One clause each.parameters.py:1318help contradicts the check: it says the value "must be a multiple of the page token count" unconditionally, whileplanning.py:187only enforces that below the recipe maximum, and the help never says the value is clamped to the recipe max. Reword to match the implemented rule.planning.py:320-321—demand_pagesstill usesrecipe.context, so the KV demand printed into the plan JSON overstates exactly the number this flag lowers. Useprepared_context(sole consumer isto_dictat:407).
Nits, not worth holding the change: status_parts (parameters.py:1560-1561) inlines the clamp where every sibling uses a status_label, and dereferences context.recipe.context without the None guard _recipe_context_limit (:1268-1269) applies — unreachable from serve.py:271, which always supplies a recipe.
The residual risk, stated plainly
BasePreparationConfig.context still defaults to 262144 (bootstrap.py:33), and nothing validates that an exported core's max_sequence_tokens equals plan.prepared_context; Helios checks only internal consistency (helios/src/model/catalog.rs:35-71). Recipe prepare() functions live outside this repository, so a recipe that builds its PreparationConfig without routing common_preparation_kwargs would silently ignore the flag. The PR's own verification (five named checkpoints, three prepared contexts, VRAM scaling ~8.2/6.3/4.3 GB per slot — the pool = concurrency × prepared context signature) is the evidence that the seam works in practice, and it is the right kind of evidence for this repo. I would not ask for a structural fix, only that the merge commit or docs row carries the note that the cap reaches the core through common_preparation_kwargs.
Bottom line
Worth merging. It is the right capability in the right layer, general and a no-op by default, with measured payoff on the project's target hardware and a four-part description that satisfies the charter. Merge after (1) one pytest.raises for the prefill-chunk bound, (2) two constraint clauses in docs/cli-design.md:458, and (3) aligning the --request-context help with the implemented clamp rule. Item 4 and the nits are optional polish.
Nothing was executed: the head has no CI checks and no pytest run happened here, so every claim above is a static read of the cited lines at 448f70a7. pytest tests/cli/test_planning.py tests/cli/test_commands.py settles item 1 and confirms items 1–2 of the "verified" list in one command.