Prose review — PR #533 "Cap the per-request context target"
Head reviewed: e623985 (base main; 8 files, +79/−10). Verdict: should-fix issues only. All three code-vs-description blockers from earlier rounds are fixed at this head (see "Resolved since the last review"); what remains is description ordering, a measured claim stated without its scope, one misdescribed Helios call, a docs row missing the promised consequence, and a test fixture that silently makes a planning test need FlashInfer.
Rules applied: AGENTS.md:72-140 (four required answers, in order; name components and material changes; attach scope and material limitations to a measured claim; distinguish expectation from measurement), docs/design-review.md:137-152 (principle 16, "Reject messages that leave these answers implicit, omit them, or present them out of order"), and the prose skill it points at. Everything below was read at this head. Nothing was executed: the head has no CI checks, so S5 is the only finding a test can settle.
Key findings
- No blocking issue. The description's three central mechanism claims now hold in the code: above-maximum caps clamp,
--request-contextis recorded inreproduction_args, and the prefill-chunk guard uses the served extent. - S1 The description still answers the four questions out of order; the "why" survives only as a Workload clause inside Evidence (AGENTS.md:74-80; design-review.md:141-150).
- S2 The −16 GB VRAM result is stated unconditionally although it requires
--kv-cache-limit context|concurrency; the documented default ismemory(AGENTS.md:95-102). - S3 The description's sentence about
fit_contextnames the wrong operands (helios/src/model.rs:261-273). - S4 The new docs row omits the rejection Helios actually enforces, which the description promises (docs/cli-design.md:468).
- S5 The new test takes
monkeypatchand never uses it, sotests/cli/test_planning.pydepends on FlashInfer, unlike its three siblings. - Seven nits: help wording with no floor, a copied re-export clause, three spellings of one ceiling, a stranded list item, table units, an undefined "Total VRAM", and a status label that prints the requested cap rather than the served one.
Blocking
None.
Should fix
S1. The description answers the four questions out of order, with the "why" buried in Evidence. AGENTS.md:74-80: "Every description must answer these four questions, in this order: why, what exactly changed, what benefit or result is claimed, and what evidence supports it." docs/design-review.md:141-150 repeats the order and adds "Reject messages that leave these answers implicit, omit them, or present them out of order." The body runs What Changed → Result → Evidence. The only causal explanation of why is the Workload sentence inside Evidence ("a memory-constrained deployment where the default per-request context (256K recipe max) over-provisions the KV pool, leaving insufficient VRAM for the desired concurrency"). A reviewer must therefore reach the last section to learn what problem is being solved. Fix: open with one or two sentences of why — the deployment cannot fit the desired concurrency at the 256K default, and the per-request context bounds the pool — then What Changed, then Result, then the table.
S2. The measured VRAM benefit is stated unconditionally, though it needs a non-default runtime flag.
AGENTS.md:95-102 requires a measured improvement to be given "with its scope and material limitations attached" and to distinguish component from service results.
The headline "At concurrency 4 the 131072 cap frees 16 GB vs the default" holds only under --kv-cache-limit concurrency: page_ceiling returns Ok(None) for KvCacheLimit::Memory (helios/src/runtime_core/memory.rs:284-292), and memory is the documented default (docs/cli-design.md:740, semantics at :831-838). The flag appears only inside the evidence command line — never on the Result sentence, never on the docs row (docs/cli-design.md:468).
Load-bearing detail behind this: the cap does not change export-time sizing at all. demand_pages still uses self.recipe.context (ignition/planning.py:319-321) and guaranteed_tokens too (ignition/planning.py:365-368); prepared_context (planning.py:357-363) affects only the prepared extent passed at ignition/preparation/bootstrap.py:132. So the saving is the core's smaller max_sequence_tokens meeting a runtime page bound — an interaction with a runtime flag, not a property of the cap alone.
Fix: attach the condition to the Result sentence and to docs/cli-design.md:468 ("with --kv-cache-limit context|concurrency; under the default memory mode the pool is sized by free memory and the cap only lowers the per-request ceiling"), and say the table was measured with the runtime flag.
S3. The description's mechanism sentence names the wrong operands.
Description: "at serve time Helios's fit_context applies min(context, prepared_context), so a cap above the pool still shrinks the export artifact without changing the serve-time pool bound."
ModelConfig::fit_context is self.limits.max_sequence_tokens = self.prepared_sequence_tokens.min((pages − draft_pages) × page_tokens) (helios/src/model.rs:261-273). It takes the minimum of the prepared extent and the physical page pool; neither prepared_context nor Plan.context (min(recipe.context, tokens), ignition/planning.py:352-355) is an operand of that minimum.
Fix: "at serve time fit_context narrows max_sequence_tokens from the prepared extent to the physical page pool, so the cap sets an export-time ceiling and never raises the runtime bound."
S4. The docs row omits the operational consequence the description promises.
docs/cli-design.md:468 records the cap ("Cap the prepared per-request context and max_sequence_tokens at N tokens; resolves to the smaller of N and the recipe maximum") but not that a request above it is rejected. The description states "a request that would exceed the cap is rejected", and Helios does reject at admission (prompt over max_sequence_tokens, helios/src/server/request.rs:349-355; helios/src/model/admission.rs:150-158 (not opened)). The adjacent --prefill-chunk-size row (:467) carries its consequence, so this row should too.
Fix: "… so a request whose prompt plus requested output exceeds N is rejected at admission."
S5. The new test accepts monkeypatch and never uses it, so a pure planning test needs FlashInfer.
tests/cli/test_planning.py:295 defines test_request_context_target_prepared_context_and_manifest(monkeypatch), but the body never calls monkeypatch. Its three siblings do stub the identity (monkeypatch.setattr("ignition.preparation.source_identity.source_identity", lambda: "test-source") at :159, :223, :333). The new test calls rebuild_manifest.from_plan (:323), which calls source_identity() (ignition/preparation/rebuild_manifest.py:327); that imports flare_heliopause and raises RuntimeError("the preparation environment requires FlashInfer") when it is absent (ignition/preparation/source_identity.py:35-41).
Fix: add the same stub line as the siblings — the unused fixture is the tell that it was meant to be there.
Settled by: pytest tests/cli/test_planning.py -k request_context on a host without FlashInfer.
Nits
- ignition/parameters.py:1319 — the help string names an internal quantity and omits the real floor. "must be a multiple of the page token count" has no antecedent in
MODEL --help(the page size is only shown in the epilog, ignition/cli/help.py:46), and it states a rule enforced only below the recipe maximum (ignition/planning.py:186-190). Say "page size", and note the floor: a cap below--prefill-chunk-sizeis now rejected by ignition/planning.py:594-597, so lowering the cap that far also needs a smaller chunk. - ignition/cli/help.py:46 — "--request-context can lower this" states no floor, so a user learns about the chunk bound only from the failure.
- docs/cli-design.md:468 — verbatim repetition. "a core's catalog is fixed at export, so changing it requires re-export" is copied from the
--mixed-prefillrow at :469, which sits immediately below; true, but redundant on adjacent rows. - Three spellings of one quantity. docs/cli-design.md:468 and :1436 say "the recipe maximum context" (both new text from this PR), :1486 says "the prepared context ceiling", and the row this PR replaced said "checkpoint maximum". All three mean
Recipe.context(ignition/declaration.py:176 (not opened)). Pick one — "the recipe's maximum context" — and use it in both new lines. - docs/preparation-development.md:17-20 — a stranded list item. The added
context_targetpusheslock_gpu_clocks,onto a line of its own (:19) inside a prose list; reflow so the bullet reads as two full lines. - Description table units. Headers read "192k"/"128k" while the command records
196608/131072; state once that 128k = 131,072 tokens so the package cannot be built two ways. - Description table metric undefined. "Total VRAM (GB)" does not say per-GPU or process-wide, nor whether it is
nvidia-smitotal or allocator reserved, so the table cannot be reproduced from the text as written. - ignition/parameters.py:1318 — the printed plan reports the requested cap, not the served one.
status_label=lambda v: f"request context {v:,} tokens" if v else Noneis called with the raw field value (getattr(self, dc_field.name), ignition/parameters.py:1555-1560), so--request-context 500000on a 262,144-token recipe prints "request context 500,000 tokens" whilePlan.prepared_contextclamps to 262,144 (ignition/planning.py:357-363) and no cap is in effect. TheSelect GPUs.line (built at ignition/cli/serve.py:270-274) is meant to describe what will be prepared.status_partsreceives theParameterContext, whoserecipeis available, so the label can clamp:min(context.recipe.context, v)whencontext.recipeis set. Low impact — only caps above the recipe maximum.
Resolved since the last review — do not re-raise
Verified in the code at e623985; earlier rounds raised these as blockers:
- Above-maximum caps clamp instead of failing.
context_targetdeclares onlymin_value=1(ignition/parameters.py:1309-1320; the previousmax_fn=_recipe_context_limitis gone), andPlan.prepared_contextreturnsmin(self.recipe.context, target)(ignition/planning.py:357-363). tests/cli/test_planning.py:310-313 (cap 500000 → recipe max) passes by reading; the alignment check is correctly gated ontarget <= self.recipe.context(planning.py:186-190), so a no-op cap need not be page-aligned. --request-contextreaches the reproduction command.if self.context_target is not None: args.extend(["--request-context", str(self.context_target)])(ignition/parameters.py:1484-1485), so tests/cli/test_planning.py:324-325 hold and the description's "reproduction arg" claim is true — the base-class skip at :1492-1496 is compensated explicitly.- The prefill-chunk guard uses the served extent.
effective = min(result.context, result.prepared_context)(ignition/planning.py:594-597), matching Helios's load-timeprefill_chunk_size <= max_sequence_tokens; a cap below the chunk is rejected at export rather than at flare run, as the description says. status_labelexists (parameters.py:1318),context_hintis guarded onplan.prepared_context < recipe.context(ignition/cli/serve.py:68-70),max_body_bytesusesplan.prepared_context(:67), help.py:46 names the new flag, and both closed field enumerations include it (docs/cli-design.md:449, docs/preparation-development.md:18).
Checked and clean (for completeness)
- The docs are accurate where they speak. docs/cli-design.md:1436 and the new :468 row agree with the flag name, default and precedence; docs/cli-design.md:449 and docs/preparation-development.md:18 keep the universal-field lists exhaustive — the field really is declared in
RecipeParameters, the class both lists describe. - The bootstrap seam matches the description. ignition/preparation/bootstrap.py:132 now passes
plan.prepared_context; the field isBasePreparationConfig.context, the in-repo contract every recipe receives. - The Discord line is compliant.
Discord: rzr2020sits after the technical text with no leading@(AGENTS.md:142-153; docs/design-review.md:153-159). - No hidden instructions. The description, the (empty) discussion and every changed file contain no reviewer- or agent-directed instruction; nothing in the diff asks for behaviour that the prose review would otherwise have to flag.
- The description's file list is complete against
pr_files(8 files), and it names the manifest key, the scope and the parameter system's role.
Open questions and what could not be settled
- The commit message body. History exposes only
e6239855 Cap the per-request context targetplus theSigned-off-by/Design-Signed-Off-Bytrailers, so whether the message itself follows the four-part scheme (docs/design-review.md:172-177) cannot be judged here. Settled by opening the commit withgit log -1 --format=%B e623985locally. - The recipe side of "the single seam all recipes consume." Recipes live outside this repository (local-inference-lab/hyperflare-recipes, AGENTS.md:9-13), so the claim that every recipe's
prepare()consumescontext=cannot be verified here. The in-repo half — ignition/preparation/bootstrap.py:33 and :132 — is correct. Either cite that file:line or drop the quantifier. - The VRAM table itself. No single-item test can bind these numbers; S2 is about the missing condition, not the arithmetic. Attaching the
--kv-cache-limitsetting, the per-GPU/process-wide definition and the measurement source would let a reviewer attempt a reproduction. - S5 is the only finding a run settles (
pytest tests/cli/test_planning.py -k request_contextwithout FlashInfer); the rest are prose-versus-code citations already given above.