PR #533: Cap the per-request context target

Raw Markdown for agents: https://autobot.eidonix.com/api/v1/cases/06a2e2ff-af1a-433b-bc00-49fd0ed79514

Opened by a workflow run, Nov 25, 2026 8:44 PM EST.

screen malicious

Screen Result: All Clear

Evidence: I read the full diff of PR #533 (7 files, +35/−15) hunk by hunk and searched the PR text and changed files for agent-directed or hidden content. Everything in the PR is ordinary Python and Markdown implementing a documented CLI capability.

No "ignore previous instructions"/role-reset/system-prompt text, no instructions addressed to agents or reviewers, no hidden or non-rendered markup in the docs (searched for HTML comments, <img, <script>, data: URIs — no matches), no shell/curl/eval/subprocess payloads, no credential, path-traversal or exfiltration content, and no new network targets. The PR body is a technical VRAM table with markdown/mailto links, a Discord handle and sign-off trailers. The only comment (roobyz, 2026-11-26 01:43: "As requested, I refactored the PR… I believe I covered all of your points") is an author-to-maintainer status note, not an instruction to an agent. Nothing attempts to steer the reviewing agent.

Non-security context: the author's earlier attempt PR #454 (same feature) was closed with a technical CHANGES_REQUESTED review from yatesdr; this PR visibly addresses those objections. Remaining gaps — no tests in the diff and no CI on head 1a006c6 — are review/evidence matters, not malicious behavior. Open question: the runtime/engine side of the claim (rejection above the cap, byte-equivalence with the flag omitted) could not be verified statically for this report.

Full report · Notes decide malicious: all_clear (100%): No malicious content found

explore

Author: roobyz (CONTRIBUTOR); Discord rzr2020 (from the PR's "Discord:" line) Motivation: Serve one model at a large context currently sizes the KV pool for that whole context per request, which can fill a 96 GB GPU and leave nothing for a second model. This adds --request-context N to export/serve/bench so the prepared per-request context — and the core's max_sequence_tokens — can be capped below the recipe maximum at export time, freeing VRAM. Scale: +35 / −15 lines in 7 files Proposal:

Full report · Notes

Value Proposition

Verdict: worth it with changes — the capability is real and the footprint is right, but as submitted it has correctness and reproducibility gaps, and hasn't shown it beats the runtime knobs it overlaps.

What the change actually is

7 files, +35/−14, entirely in Ignition's Python CLI/planner; no Rust, no model branches. Two functional lines:

This resolves the blocking objections from the closed #454: the cap now reaches max_sequence_tokens (so helios/src/server/request.rs:350 and /v1/models's max_model_len at helios/src/server/models.rs:81 enforce it), non-positive values are rejected, the default-chunk failure now names --prefill-chunk-size, docs are updated, and the description has the four required parts with model, commands, revision, table and Discord line. The old --context-is-rejected objection is moot because the flag is renamed.

Why it is worth making

Why not as submitted

  1. Reproducibility is broken — the strongest objection. rebuild_manifest.reproduction_arguments() (ignition/preparation/rebuild_manifest.py:231-318) never emits --request-context, and from_plan()'s deployment-scoped parameter set (rebuild_manifest.py:368-395) has no context entry, nor does Plan.to_dict() (planning.py:389-442, which still reports only "context" and "checkpoint_context"). So the printed plan (serve.py:215,485, bench.py:182,237), flare inspect's reproduction command (flare-cli/src/inspect.rs:454), and the embedded preparation manifest all describe a 256K core when the actual core is capped. That directly cuts against "Be explicit and pin everything" and the charter's review standard on artifacts still loading/being reproducible.
  2. No page-geometry validation. prepared_sequence_tokens must be a multiple of the page size, and max_sequence_tokens likewise, or load fails with a generic "invalid prepared model configuration" (helios/src/model/catalog.rs:44-71). --request-context 100000 therefore bakes a core that dies at flare run, far from the flag. The planner already knows the real page size (planning.py:326-330, recipe.page_tokens × CP size), so it can validate or round and say so.
  3. The baked value depends on the export host's free memory. Because the cap clamps by self.tokens (planning.py:373), the exported max_sequence_tokens varies with the exporting machine's VRAM; the help says "cap at N" while the core may silently bake something lower. If that clamp is intentional (the code comment says a cap above the pool resolves to the pool) it needs to be stated, and the effective value should appear in to_dict() and in the plan output.
  4. No tests. There is not one test referencing prepared_context/context_target in tests/; the wiring patterns already have homes (tests/cli/test_planning.py:71-138, tests/cli/test_commands.py:59-98). Minimum: min() with/without target, ≤0 rejection, both branches of the chunk-vs-cap error, common_preparation_kwargs carrying the cap, and the manifest/to_dict() exposure once added.
  5. Evidence doesn't prove the flag is needed. The table shows pool = concurrency × prepared-context behaviour and uses --kv-cache-limit concurrency throughout, so it measures what a smaller pool costs — which --kv-cache-limit context or --memory-limit -16G already deliver at serve time without a re-export. Charter "Bring real evidence" (#210) and "the smallest footprint … or a way to solve it without new code at all" (#404) require a comparison against those alternatives at the same prompt/output lengths, plus one case that shows the admission ceiling/max_model_len difference.
  6. Priority caveat. The stated payoff is "headroom a co-run needs" — i.e. a second model on the same GPU, which sits next to the non-goal "multi-model hosting/routing". Freeing VRAM is not co-hosting, but the motivation sits in a pattern the charter says needs maintainer sign-off, so the justification should be restated around the primary capability (preparing and honestly advertising a shorter-context core) rather than the co-run scenario.
  7. Minor: the cap also lowers the default output limit, since max_new_tokens defaults to max_sequence_tokens (helios/src/server/config.rs:210-212). Worth one sentence in docs/cli-design.md:446.

With those in place this is a small, general, well-placed addition to a decision the export layer already owns; without them it is a knob whose effect the artifact, the reproduction command and the test suite cannot see.

Full report Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.

Architecture

Verdict: blocking issues

Blocking:

Should fix:

Nits: 2 (description's motivation leans on multi-model hosting, a charter non-goal; overlap with --kv-cache-limit/--memory-limit not argued in the description).

Link: https://github.com/NVIDIA/hyperflare-inference/pull/533

Full report · Notes

Conventions

Verdict: blocking issues Blocking:

Full report · Notes

Correctness

Verdict: blocking issues

Blocking:

Should fix:

Nits: 1 — a --request-context above the recipe max is silently clamped with no notice, though docs/cli-design.md:446 describes the flag as a cap below that maximum.

Link: https://github.com/NVIDIA/hyperflare-inference/pull/533

Full report · Notes

Simplicity

Verdict: blocking issues

Blocking:

Should fix:

Nits: 3 — dead min(result.context, result.prepared_context) at planning.py:694; two-arm error text restating the multiple of 64 help (planning.py:696-700); help text (cli/init.py:167-170) and docs row (docs/cli-design.md:446) carrying rationale clauses longer than the setting.

Link: https://github.com/NVIDIA/hyperflare-inference/pull/533

Full report · Notes

Prose

Verdict: blocking issues

Blocking:

Should fix:

Nits: 4 — "serve" is not a subcommand (it is debug-serve, ignition/cli/init.py:55); docs/cli-design.md:1443 says "checkpoint maximum" where the cap and ceiling come from the recipe declaration; the help text at ignition/cli/init.py:167-170 states "(the pool fills the free VRAM)" as if unconditional and omits the positive-N requirement and the --prefill-chunk-size interaction; "byte-equivalent to stock"/"Plan.context stays stock" are loose descriptions of the omitted-flag path.

Link: https://github.com/NVIDIA/hyperflare-inference/pull/533

Detail: the code change itself is correct through this lens — prepared_context (planning.py:369-373) does reach max_sequence_tokens via bootstrap.py:58, the positive check exists at planning.py:459-460, and omitting the flag reproduces the previous behaviour. The problems are in the prose: an unconditional benefit claim that depends on an undisclosed runtime flag, a rationale that argues from a charter non-goal, a hypothesis presented next to measurements, an export setting absent from the plan report and rebuild manifest, and a migration error whose suggested remedy cannot work when the pool is the limit. No instructions directed at an agent were found in the description, diff, or linked #454 discussion.

Full report · Notes

Subtractive

Verdict: make it smaller first The change: +35 / -15 lines across 7 files Could remove: about 15 lines in 5 places (or ~28 of the 35 added lines if the flag itself is dropped, since only ignition/preparation/bootstrap.py:58 is load-bearing) Biggest subtractions:

Full report · Notes

Pre Test Report

Pre-Test Report — PR #533 "Cap the per-request context target"

Recommendation: DO NOT refer to hardware testing yet. Return to author for fixes.

PR: https://github.com/NVIDIA/hyperflare-inference/pull/533 · author roobyz (CONTRIBUTOR) · head 1a006c6 · base main · 7 files, +35/−15 · no reviews, no CI checks on head. Supersedes closed PR #454 (CHANGES_REQUESTED). Security screen: all clear; I independently found no prompt-injection or agent-directed content in the description, diff, docs, or comments — the "Discord:" line and Design-Signed-Off-By/design-review=1af4 trailers are ordinary PR metadata.

I re-verified every review claim against the tree rather than trusting the summaries. The reviews agree, and they are substantially right.


1. Why testing now is not worth hardware time

The change is small and the core idea is sound, but three defects mean the artifact under test would be wrong, and any result would be invalidated by the pending fixes.

Blocking A — the flag is silently dropped on the multi-host export path

ignition/cli/serve.py:193-206: _export_hosts (reached whenever --ranks > 1, serve.py:153-156) ends its planning.plan(...) call at row_shard_prefill=args.row_shard_prefill) — no context=args.request_context. The other three sites do thread it: serve.py:289 (_prepare), serve.py:472 (debug_serve), ignition/cli/bench.py:177. The flag is registered once in _preparation_arguments (ignition/cli/__init__.py:167-170), so the attribute always exists and ignition export MODEL --ranks 2 --request-context 131072 parses, runs to completion, and prepares at the recipe maximum with no warning. This is exactly what the charter forbids ("Don't silently ignore API fields … Never accept it and quietly drop it", #417).

Two consequences for testing: the fix is a one-keyword change that alters the code path a test would poke; and our fleet cannot test this path anyway — --ranks > 1 needs a second host with a rendezvous address (cn5 is 4 GPUs on one host; cn7 is a single GB10). It must be pinned by a GPU-free test.

Blocking B — a non-page-aligned cap bakes a core that will not load

Plan.prepared_context (ignition/planning.py:369-373) is min(recipe.context, target, tokens) and becomes the core's max_sequence_tokens via bootstrap.py:58 → helios/src/server/config.rs:131,148. helios/src/model/catalog.rs:44-71 rejects a core unless both prepared_sequence_tokens (:50-52) and limits.max_sequence_tokens (:54-57) are multiples of page_tokens, returning the opaque "invalid prepared model configuration" (:70). The PR's only validations are positivity (planning.py:459-460) and the prefill-chunk check (planning.py:694-700) — no alignment check, while plan.page_tokens is right there (planning.py:326-330). So --request-context 200000 on a 128-token page exports fine and dies at flare run. Testing this before the fix just pays GPU time to re-confirm a known bug.

Note the alignment risk is highest at TP>1, where page_tokens multiplies by the CP size (planning.py:326-330).

Blocking C — the cap is unrecorded, so the artifact cannot be audited or reproduced

So flare inspect on a capped core prints an ignition export command that rebuilds the uncapped core (flare-cli/src/inspect.rs:453-455). AGENTS.md:452-456 requires the plan, its printed report and its recorded measurements to describe what was prepared. A test run against this head could not even tell from the output whether the cap took effect.

Blocking D — there are no tests at all

grep of tests/ for request_context|context_target|prepared_context|request-context returns zero matches. Nothing exercises the property, the validation, the new error branch, or the PR's headline claim that omitting the flag is a no-op. This is precisely what caught Blocking A, and AGENTS.md:194-199 requires it. The precedents are cheap and already exist: tests/cli/test_planning.py:71-138 (row_shard_prefill: asserts to_dict(), reproduction_args membership and manifest key+scope in one loop) and tests/cli/test_commands.py:59-98 (parser plus common_preparation_kwargs→BasePreparationConfig).

Should fix E — bench validates against the wrong context

Plan.__post_init__ (planning.py:248): if selection.required_context > self.context — self.context is the untouched stock value (planning.py:363-366), so with a cap set, a --contexts list above the cap passes planning and fails only at ignition/bench/runner.py:388, after the full GPU preparation, autotuning and graph capture. Bench also exports no core and already rejects inapplicable preparation flags (bench.py:115-118); it should either honour the cap or reject the flag.


2. Expected value of a hardware test at this head: LOW

The PR's own evidence (--kv-cache-limit concurrency throughout, per the description) measures a behaviour that already exists at runtime. I confirmed in helios/src/runtime_core/memory.rs:284-331 that page_ceiling returns Ok(None) for KvCacheLimit::Memory — the default (docs/cli-design.md:738) — and only Context/Concurrency compute ceil(context/page_tokens) × histories from server_config["max_sequence_tokens"] (memory.rs:631). So our GPUs would largely measure --kv-cache-limit's documented behaviour, not this PR; the newly added docs row (docs/cli-design.md:446) states the VRAM benefit unconditionally, which is misleading for a default flare run.

What is genuinely new and is worth testing once fixed: the export-time admission ceiling and the advertised max_model_len. --kv-cache-limit and --memory-limit bound the pool; neither can lower the per-request ceiling or advertise a smaller model length, both baked from prepared_sequence_tokens at load (config.rs:131-148, model.rs:261-273, server/models.rs:81 (not opened), server/request.rs:350 (not opened)). That is the real capability and the right thing to validate.

Two further devaluations: end-to-end reachability depends on the external hyperflare_recipes recipes mapping BasePreparationConfig.context → core max_sequence_tokens (AGENTS.md:379-384), and the author states recipe updates are still "pending" — so a test would depend on unpublished artifacts. And the stated motivation (headroom for a co-run / second model) is the charter's multi-model hosting/routing non-goal, requiring maintainer sign-off (charter Non-Goals; AGENTS.md:171-175); the justification should be reframed around honestly preparing and advertising a shorter-context core.

Verified clean (so testing would not need to re-check these): the no-flag path is a genuine no-op (planning.py:371-372 returns recipe.context, previously passed as-is); Plan.context is untouched; the frozen-dataclass default keeps construction and dataclasses.replace working (serve.py:207-211, bench.py:178-181); the cap correctly clamps to pool capacity; and negativity is rejected with a UsageError.


3. Conditional test plan (reuse after the fixes land)

Adopt when Blocking A–D and E are addressed and the recipe updates are published. Deliberately minimal: this is a memory-sizing knob with no throughput claim, so no A/B perf sweep is warranted.

Phase 0 — GPU-free, must pass first (no hardware time) pytest tests/cli/test_planning.py tests/cli/test_commands.py with added cases:

Phase 1 — cap actually reaches the core (cn5, 1 GPU, SM120) Use one GPU of cn5 (not all four; the change is orthogonal to parallelism except page size). Model: nvidia/GLM-5.3-Flash-NVFP4 (in-repo documented, GLM-5.3 Flash) — closest available match to the author's SM120 measurement. Two exports from the same command, differing only in the flag: A --request-context 131072, B unset.

  1. /v1/models → max_model_len is 131072 on A and the recipe max on B (the one assertion that proves the export-side value, not a runtime flag).
  2. A prompt of ~132k tokens is rejected at admission on A; a prompt just under the cap is accepted.
  3. flare inspect A shows the cap and its reproduction command re-exports a 131072 core (validates Blocking C).
  4. Control falsification: --request-context 100000 (not page-aligned) must fail at planning with an actionable message, not at load.

Phase 2 — VRAM, and the isolating comparison the PR owes Under both --kv-cache-limit memory (default) and --kv-cache-limit concurrency, at concurrency 1 and 4, record total VRAM for A and B. The pair isolates this PR from the runtime flag; under memory alone the delta may be ~0, which is the honest result and must be reported as such.

Phase 3 — regression (cheap) A pre-PR core still loads and serves; debug-serve with no flag matches main behaviour; --request-context still absent from flare run.

Budget / efficiency: ~2 exports + ~6 serve starts on a single cn5 GPU ≈ 1–2 GPU-hours, one model, one host. Skip multi-host (no second host), skip cn7 unless an ARM64-specific question appears, and do not benchmark throughput — the PR makes no speed claim.


4. Bottom line for the referral decision

Full report · Notes

code review summary

Recommendation: Changes Requested

The seam is now right — ignition/preparation/bootstrap.py:58 passes plan.prepared_context into common_preparation_kwargs, which reaches Helios as prepared_sequence_tokens (helios/src/server/config.rs:131) and limits.max_sequence_tokens (:148), enforced at admission. That closes #454's blocking objection. But the flag does not reach one path, is validated incompletely, and is recorded nowhere.

Blockers:

Should fix:

Subtract / Simplify:

Could remove ~7 of +35 added lines (plus about half of the new docs row):

Nits:

5 nits

Full report · Notes Decision to Test: no (100%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.

screen malicious

Screen Result: All Clear

Evidence: Screened PR 533 "Cap the per-request context target" (roobyz, head de1b5b5, 9 files, +98/−18) in full: every hunk of the diff, the whole description, all comments/reviews, and the touched regions at head (ignition/planning.py, ignition/cli/{init,bench,preparation,serve}.py, ignition/preparation/{bootstrap,rebuild_manifest}.py, tests/cli/test_planning.py, docs/cli-design.md).

No prompt injection or agent-directed instruction was found. Nothing in the diff or discussion says "ignore previous instructions", addresses an AI/agent, asks for approval or to skip review, or hides text (no zero-width/bidi characters; the only non-ASCII is ordinary typography in pre-existing prose). The added code is a coherent, feature-scoped change: Plan.context_target (planning.py:176), prepared_context property (planning.py:371-375) leaving stock context intact (planning.py:366-368), page-multiple and positive-target validation (planning.py:289-290, 461-462), a chunk-below-context error (planning.py:695-700), a to_dict key (planning.py:431), the --request-context flag (cli/init.py:167-170) threaded to derive()/fit()/plan(), plan.prepared_context in bootstrap (bootstrap.py:58), manifest reproduction args and a SCOPE_DEPLOYMENT entry (rebuild_manifest.py:264-265, 390), and an assertion-only test (test_planning.py:210-266). It adds no URLs, network calls, subprocess/eval/exec, base64, secret or environment reads, and no writes outside the documented manifest path. Repo-wide search for "autobot" in tracked files returns no matches; searches for injection markers (IMPORTANT, NOTE TO, reviewer, approval, bypass, skip the) return only ordinary identifiers.

Description trailers (Signed-off-by, Design-Signed-Off-By, design-review=1af4) and the Discord line match repo conventions (.githooks/commit-msg:15,59; docs/design-review.md:195; AGENTS.md:144-150).

One agent-addressed text exists on the PR but is not a finding: the repository's own review automation comment from flare-autobot (2026-11-26 04:21) posting autobot.eidonix.com case-file links and "Include #autobot:ignore in the PR or any comment". The identical boilerplate appears on #519, #521, #522, #525 and #526; it is repo infrastructure, not contributor-authored, and asks for nothing harmful.

Only non-security observations remain: the description's claim that "the thirteen recipes' prepare() read context=plan.prepared_context" is not visible in this diff because recipes live in the extracted hyperflare-recipes repo, and the description's wording about a serve subcommand is loose (the flags land on export, bench and debug-serve). Description-accuracy nits only.

Full report · Notes decide malicious: all_clear (100%): No malicious content found

explore

Author: roobyz (CONTRIBUTOR); Discord rzr2020 Motivation: Today every exported core serves the recipe's full per-request context (256K for Qwen3.8-27B), so the KV pool is over-provisioned for short requests and leaves no VRAM for the concurrency the operator actually wants. This PR adds --request-context N so a deployment can bake a smaller per-request ceiling into the core at export time, freeing VRAM for more concurrent requests of the same model. Scale: +98 / −18 lines in 9 files Proposal:

Full report · Notes

Value Proposition

Verdict: worth it with changes — the capability is real, the layer and footprint are right, and every blocker from the closed #454 and my previous review is now addressed. What is left is a genuinely broken new test (it cannot pass), a couple of untested wiring paths, and documentation gaps. Fix those and this should merge.

What the change is now

9 files, +35/−14 plus one new test, entirely in Ignition's Python CLI/planner — no Rust, no per-model branches:

Charter mapping

Blockers (must fix before merge)

  1. The new test cannot pass — two independent defects.
    • tests/cli/test_planning.py:257 asserts by_key["context_target"].value.int64_value == 131072. The proto field is int_value (helios/proto/runtime_core.proto:127), so this raises AttributeError; and rebuild_manifest._preparation_value (rebuild_manifest.py:329-333) emits uint_value for a non-negative int, so the correct assertion is uint_value == 131072.
    • tests/cli/test_planning.py:230-232 plans with context=500000 and expects the clamp. 500000 % 64 == 32, so the new page-multiple validation (planning.py:289-290) raises UsageError and the test errors out before reaching the assertion. Use a page-aligned value above the recipe max (e.g. 327680 or 500032). Both are one-line fixes, but as pushed the PR does not pass its own suite.
  2. Two wiring paths the test does not cover. common_preparation_kwargs returning prepared_context (bootstrap.py:58) is the only line that changes the exported core, and the multi-host export path (cli/serve.py:206) was the previous blocker; neither is asserted. Add assert kwargs["context"] == capped.prepared_context (mirroring tests/cli/test_commands.py:88-91) and one assertion that the --ranks > 1 plan carries the target.

Should fix

  1. Plan.demand_pages is uncapped. planning.py:325-326 still computes concurrency * (recipe.context // page_tokens), so the plan's printed/to_dict demand (planning.py:440) overstates the KV demand of a capped core — the exact number this flag exists to lower. Use prepared_context there.
  2. Cap-affected derived values still use the recipe max. _server_options sets max_body_bytes from recipe.context and tells clients "context is limited by the checkpoint and available cache capacity" (cli/serve.py:68-69); that hint is what users see on a context admission error (helios/src/server/http.rs:59 (not opened)). With a cap the hint should name the export cap, and max_body_bytes should follow min(recipe.context, prepared_context) or be left deliberately oversized with a comment. Related: a cap also lowers the default output allowance, since max_new_tokens defaults to max_sequence_tokens (config.rs:210-212) — one sentence in the docs/cli-design.md:446 row.
  3. Evidence still does not show the capability the flag uniquely provides. The table uses --kv-cache-limit concurrency for every column, so it measures the pool, which --kv-cache-limit context / --memory-limit already move at serve time. Add one case at equal prompt and output length proving the ceiling: a request between the cap and the recipe max rejected by the capped core and accepted by stock, plus /v1/models reporting the smaller max_model_len. That is the claim no runtime knob can reproduce.
  4. The min(…, self.tokens) clamp bakes export-host VRAM into the artifact. planning.py:375 means --request-context 131072 can silently prepare less on a fuller GPU. It is legal (the catalog only requires max_sequence_tokens <= prepared_sequence_tokens and page alignment, helios/src/model/catalog.rs:48-57) and the description now says it, but to_dict() prints the target, not the effective value; printing prepared_context next to it makes the artifact self-describing.
  5. Say the accepted multiple in help. cli/__init__.py:167-170 (not opened) says nothing about the page multiple that planning.py:289-290 enforces; the neighbouring --prefill-chunk-size line states its multiple. Also consider naming the kwarg context_target= rather than context= in fit()/plan() (planning.py:455,593), since Plan.context keeps a different meaning; the current naming invites future misuse.

Cost, benefit, alternatives

Bottom line

Merge after fixing the two broken assertions in tests/cli/test_planning.py:230-232,257, adding the common_preparation_kwargs/multi-host assertions, and using prepared_context in demand_pages (planning.py:325-326). The evidence gap (5) and the hint/body-limit/default-output notes (4) are worth one revision of the description and one line of docs; none of them touch the design, which is well placed, general, and a no-op by default.

Full report Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.

Simplicity

Verdict: should-fix issues only Blocking:

Full report · Notes

Prose

Verdict: should-fix issues only Blocking:

Nits: 7 — "thirteen recipes" identity-free attribute and wrong path for the value; dead/loose effective_context = min(...) at planning.py:696 and its misnaming of the binding limit; docs table row 1443 "checkpoint maximum" should be the recipe maximum; stale context_hint (cli/serve.py:69); printed plan never emits prepared_context (planning.py:432); undefined "stock" in tests (test_planning.py:217, 227, 247); "Verified … at main c36a6a02" phrasing misattributes the branch measurement to main.

Link: https://github.com/NVIDIA/hyperflare-inference/pull/533

No prose problems in code behaviour: the omitted flag is byte-equivalent to main (bootstrap.py:58 receives recipe.context), context_target reaches Plan.to_dict, reproduction_arguments, and SCOPE_DEPLOYMENT manifest entries, and tests cover the no-op, clamp, both validations and both manifest paths. The commit message body could not be checked from here. No attempts to instruct the reviewer were found in the description, diff or docs.

Full report · Notes

Architecture

Verdict: blocking issues

Blocking:

Should fix:

Nits: 1 (the plan report's context/context_target/tokens trio makes the served value only derivable, not printed; minor, and defensible).

Link: https://github.com/NVIDIA/hyperflare-inference/pull/533

Full report · Notes

Correctness

Verdict: blocking issues

Blocking:

Should fix:

Nits: 2

Link: https://github.com/NVIDIA/hyperflare-inference/pull/533

Note: the earlier code-level blockers from my previous review round (the multi-host _export_hosts path dropping the flag, the missing page-multiple validation, the cap missing from to_dict()/reproduction args, and bench validating against the stock context) are all fixed at head de1b5b5 and verified in the code. No CI checks ran on the head commit, which is why the two test defects were not caught. pytest tests/cli/test_planning.py settles both.

Full report · Notes

Conventions

Verdict: should-fix issues only Blocking:

Full report · Notes

Subtractive

Verdict: make it smaller first The change: +98 / −18 lines across 9 files (code+docs +41/−18: planning.py +23/−9, ignition/cli/init.py +4, bench.py +2/−1, preparation.py +2/−2, serve.py +3/−3, preparation/bootstrap.py +1/−1, rebuild_manifest.py +3, docs/cli-design.md +3/−2; tests/cli/test_planning.py +57/−0) Could remove: about 45 lines, in 6 places (≈70 if the flag is dropped entirely and the existing runtime --kv-cache-limit carries the argument) Biggest subtractions:

Full report · Notes

Pre Test Report

Pre-Test Report — PR #533 "Cap the per-request context target" (head de1b5b5)

Recommendation: DO NOT refer to hardware testing yet. Return to the author for fixes.

PR: https://github.com/NVIDIA/hyperflare-inference/pull/533 · author roobyz (CONTRIBUTOR) · head de1b5b5 · base main · 9 files, +98/−18 · no reviews, no CI checks on head. Supersedes closed PR #454 (CHANGES_REQUESTED). Security screen all clear; I found no prompt-injection or agent-directed content in the description, diff, docs or comments — the Design-Signed-Off-By/design-review=1af4 trailers and the "Discord:" line are ordinary PR metadata.

I re-verified every review claim against the tree. The reviews disagree about how much is wrong but agree the feature's seam is right; where they disagreed I went to the code, and on two points I side with the newer reviews against the older ones (see "Corrections" at the end).


1. Why testing now would be wasted hardware time

Blocking A — the PR's own added test cannot pass, for two independent verified reasons

This is decisive on its own: the head is not green, so any GPU time would be spent on an artifact the author must change.

(a) tests/cli/test_planning.py:230-232 plans with context=500000 and expects a clamp. The fixture (tests/cli/test_planning.py:37-38) declares context=262144, page_tokens=64, and its RankCosts (:43) leaves page_tokens unset (ignition/declaration.py:174), so Plan.page_tokens == 64 (ignition/planning.py:329-332). 500000 % 64 == 32, and this PR adds at ignition/planning.py:289-290:

if self.context_target is not None and self.context_target % self.page_tokens:
    raise UsageError(f"--request-context {self.context_target:,} is not a multiple of the {self.page_tokens:,}-token page size")

Plan.__post_init__ therefore raises UsageError and the test errors before its assertion.

(b) tests/cli/test_planning.py:257 asserts by_key["context_target"].value.int64_value. helios/proto/runtime_core.proto:124-133 declares int_value = 2 and uint_value = 3 — there is no int64_value, so this is an AttributeError. Even renamed to int_value it would read 0, because rebuild_manifest._preparation_value (ignition/preparation/rebuild_manifest.py:333) writes non-negative ints as uint_value.

Neither defect is judgement: they are arithmetic and the declared protobuf schema. pytest tests/cli/test_planning.py settles both. The bigger gap behind them: the test never asserts the one line that makes the cap real — common_preparation_kwargs(plan)["context"] == plan.prepared_context (ignition/preparation/bootstrap.py:58) — so it would pass even if the cap stopped reaching the core.

Blocking B — alignment is validated on the request rather than the resolved context, and that needs a decision before testing

planning.py:289-290 checks the raw target, while the value the core receives is prepared_context (planning.py:371-375, consumed at bootstrap.py:58). So --request-context 500000 (or 262145, or any unaligned value above the recipe max) is rejected outright even though it would clamp away to a no-op. That contradicts the PR's own docs row (docs/cli-design.md:446, "below the recipe's maximum") and its description ("a cap above the pool resolves to the pool capacity"). Whether the fix validates the resolved value, floors to a page, or keeps rejecting is a semantics decision, and it changes exactly the behaviour a hardware test would exercise. Testing before it is settled risks testing a behaviour that gets reversed.

Blocking C — the exported ceiling depends on the export host's free VRAM

prepared_context is clamped by self.tokens (planning.py:375), and tokens = pages * page_tokens with pages sized from the exporting host's free supply (planning.py:538-544). Two exports with byte-identical reproduction_args — now including --request-context (rebuild_manifest.py:264-265) — can declare different max_sequence_tokens. It is also a duplicated clamp: Helios already narrows at load (helios/src/model.rs:268-272 fit_context; catalog.rs:49 only requires max_sequence_tokens <= prepared_sequence_tokens). And to_dict() prints the target, never the served value (planning.py:432), so a run cannot be read back to prove what was prepared — which is also the reason a hardware run against this head could not conclude anything.

Blocking D — the evidence still does not isolate what this PR adds

helios/src/runtime_core/memory.rs:284-292: page_ceiling returns Ok(None) for KvCacheLimit::Memory — the default (docs/cli-design.md:738) — and only Context/Concurrency size the pool from ceil(context/page_tokens) × histories. The author's VRAM table was measured with --kv-cache-limit concurrency, so it demonstrates the existing runtime flag, not this PR. What only an export-time cap can do is lower the admission ceiling and advertise a smaller max_model_len (helios/src/server/config.rs:131,148; helios/src/server/request.rs:350 (not opened); helios/src/server/models.rs:81 (not opened)). Without one row showing that difference, our GPUs would mostly re-measure --kv-cache-limit.

Also blocking for a useful test — reachability depends on code outside this repo

BasePreparationConfig.context (ignition/preparation/bootstrap.py:33) must be written by each recipe into the core's max_sequence_tokens. The recipes live in the external local-inference-lab/hyperflare-recipes (AGENTS.md:12, 380-392), and the author has previously described the recipe updates as pending. A test could not confirm the end-to-end claim from this repository alone.


2. Should fix before merge (not test-blocking, but cheap while the author is in the file)

These are minor and I would not hold a hardware run for any of them alone — but A–D mean the run should not happen yet anyway.


3. Expected value of a hardware test at this head: LOW

Genuinely worth validating once fixed: the export-time admission ceiling and the advertised max_model_len, plus an honest default-mode VRAM delta (which may be ~0 and must be reported as such).


4. Conditional test plan (adopt after A–D are addressed)

Phase 0 — GPU-free, must pass first (no hardware time) pytest tests/cli/test_planning.py tests/cli/test_commands.py, with these cases added or repaired:

Phase 1 — the cap reaches the core (1 GPU of cn5, SM120; matches the author's hardware) Model: nvidia/GLM-5.3-Flash-NVFP4. Two exports from the same command, differing only in the flag: A --request-context 131072, B unset. Use one GPU, not four — the change is orthogonal to parallelism except through page size.

  1. /v1/models → max_model_len is 131072 on A and the recipe maximum on B. This is the one assertion only the export-side value can satisfy.
  2. A prompt of ~132k tokens is rejected at admission on A; a prompt just under the cap is accepted.
  3. flare inspect A shows the cap and its reproduction command re-exports a 131072 core (validates the recording).
  4. Falsification control: an unaligned --request-context fails at planning with an actionable message, not at core load (helios/src/model/catalog.rs:50-57 yields the opaque "invalid prepared model configuration").

Phase 2 — VRAM, the isolating comparison the PR owes Under both --kv-cache-limit memory (default) and --kv-cache-limit concurrency, at concurrency 1 and 4, record total VRAM for A and B. The pair separates this PR from the runtime flag. Expect ~0 delta under memory mode; report that as the result.

Phase 3 — regression (cheap, same job) A pre-PR core still loads and serves; a no-flag export produces the same preparation config as main (bootstrap.py:58 previously received plan.recipe.context, and prepared_context returns exactly that when unset); --request-context still absent from flare run.

Budget / efficiency: ~2 exports + ~6 serve starts on a single cn5 GPU ≈ 1–2 GPU-hours, one model, one host. Skip multi-host (no second host available — cn5 is four GPUs on one host, cn7 is a single GB10). Skip cn7 (no ARM64-specific question). Do not run a throughput A/B sweep — the PR makes no speed claim, only a memory and admission-ceiling claim.


5. Bottom line for the referral decision

Corrections to the reviews, from reading the code:

Full detail with citations is in scratchpad entries #5 (verified blocker state at de1b5b5), #6 (blocking defects with file:line), and #7 (decision, plan and budget).

Full report · Notes

code review summary

Recommendation: Changes Requested

Blockers:

Should fix:

Subtract / Simplify:

Could remove ~17 of +98 added lines (≈9 of the +57 test hunk, ≈8 of the +41 code/docs), plus about half of the new docs row:

Nits:

5 nits


Full report — PR #533 "Cap the per-request context target" (head de1b5b5, base main, 9 files, +98/−18, no CI checks)

Key findings

Blockers

B1 — The added test cannot pass on this head. tests/cli/test_planning.py:229-232:

oversized = planning.plan(recipe, recipe.checkpoints[0], gpus, context=500000, **base)
assert oversized.context_target == 500000
assert oversized.prepared_context == min(recipe.context, oversized.tokens)

The fixture declares context=262144, page_tokens=64 (:37-38) and its RankCosts (:43) leaves page_tokens unset (ignition/declaration.py, default None), so Plan.page_tokens == recipe.page_tokens == 64 (planning.py:329-332). 500000 % 64 == 32, and this PR adds the rejection at planning.py:289-290, which runs in __post_init__ for every Plan(...) — including the one fit builds (planning.py:528-537), because page_tokens depends only on recipe/costs/context-parallel width. So planning.plan(...) raises UsageError("--request-context 500,000 is not a multiple of the 64-token page size") and the assertions never run. No CI checks on the head, which is presumably why it was not seen. Requested change: fixing B2 makes this case pass unchanged and turns it into the proof of the clamp; if you prefer to keep the validation as-is, use a page-aligned over-size target such as 524288 (64 × 8192) and leave 100 in the rejection case at :241-242. Why: the test and the validation currently contradict each other; the head cannot be green.

B2 — The page-multiple check validates the request, not the served value. planning.py:289-290:

if self.context_target is not None and self.context_target % self.page_tokens:
    raise UsageError(f"--request-context {self.context_target:,} is not a multiple of the {self.page_tokens:,}-token page size")

The core receives prepared_context = min(recipe.context, context_target, tokens) (:371-375, consumed at bootstrap.py:58), so a target above the recipe maximum resolves to an aligned value yet is rejected: --request-context 262145 on a 256K recipe fails outright even though it changes nothing. That contradicts docs/cli-design.md:446 ("below the recipe's maximum", default "the recipe's maximum context"), the description's "a cap above the pool resolves to the pool capacity, as stock", and the way the rest of plan treats capacity (:370-375, :538-544 clamp rather than reject). Requested change (one expression): validate min(self.recipe.context, self.context_target) % self.page_tokens (or prepared_context where it is available). 100 % 64 = 36 is still rejected, so the existing match="multiple of the" case keeps working. Settle the intended rule — accept, floor to a page, or reject an unaligned oversized target — and state it in docs/cli-design.md:446 and the helptext. Why: the alignment requirement is real (helios/src/model/catalog.rs:43-70 requires both prepared_sequence_tokens and limits.max_sequence_tokens to be multiples of page_tokens, and rejects a misaligned core at load — long after export), so the check belongs at export time, just on the quantity the core is told to serve.

Should Fix

S1 — The cap appears in no printed plan and no recorded measurement (Backgammon: AGENTS.md:452-456). AGENTS.md:452-456: a plan-carried setting is one whose "plan, printed report, and recorded measurements describe what was prepared". The plan JSON and manifest satisfy this (planning.py:432, rebuild_manifest.py:264-265, :390); the other two surfaces do not. (a) Plan.to_dict (planning.py:432) emits context (pool-bound, :365-368), context_target and checkpoint_context, but not prepared_context — so with a cap set, a pool clamp is silent and the report names a ceiling the prepared core will reject. (b) The printed "Select GPUs" line (serve.py:302-316) enumerates every sibling preparation choice, with row-shard-prefill a one-token addition at :316, and has no context field: ignition export M --gpus 0 --request-context 131072 prints a byte-identical plan line to stock while preparing graphs and KV pages at a different context — the one number the PR's own evidence table is a function of. (c) The benchmark record (bench.py:243-248) builds details["configuration"]["preparation"] from a whitelist of 17 to_dict() keys with no context key at all, so two --request-context runs at different caps write identical configurations. Requested change (three one-liners, each next to existing precedent): add "prepared_context": self.prepared_context beside context_target in to_dict; add a guarded · request context {plan.prepared_context:,} to the serve f-string next to row-shard-prefill; add "context_target", "prepared_context" to the bench key tuple next to "row_shard_prefill". Why: this is the same defect five lenses reached from different directions (silent under-delivery, unrecorded measurement, unstated served value), and one implementation resolves all of them.

S2 — Two evidence claims in the description are wrong or unscoped. (a) The VRAM headline is unconditional, but the pool only follows the prepared context under a non-default --kv-cache-limit. helios/src/runtime_core/memory.rs:290-292: page_ceiling returns Ok(None) under KvCacheLimit::Memory — the default mode (docs/cli-design.md:738, :828); only Context and Concurrency size a ceiling from the prepared context (:298-320). The author's own reproduction commands say --kv-cache-limit concurrency, and the shipped docs row says so (docs/cli-design.md:446); the description does not. (b) "a cap above the pool resolves to the pool capacity, as stock" is false. Stock passed plan.recipe.context unclipped (bootstrap.py:58 before this PR), whereas with a target the value is min(recipe.context, target, tokens) (planning.py:373-375) — so a cap above the pool can prepare a lower max_sequence_tokens than the same export without the flag, which is the opposite of "as stock" and is a compatibility change (AGENTS.md:92-94, :103-109). The new test asserts exactly this behaviour (tests/cli/test_planning.py:229-232). Requested change: add the --kv-cache-limit context|concurrency condition to the headline and to the Result line, and state that a cap above the KV pool resolves to the pool capacity and can therefore prepare a lower max_sequence_tokens than no flag. Why: a reader who exports with a cap and runs with defaults will see none of the claimed 16 GB; and the sentence as written reassures the reader precisely where the largest behaviour change occurs. Prefer stating this over changing the clamp — the clamp is correct and makes the bench check honest (planning.py:248).

S3 — One PR-description mechanics bullet. The four required questions are out of order: the measurements and headline result lead, and the "why" appears only as a Workload line inside Evidence (AGENTS.md:74-80, docs/design-review.md:140-150 (not opened), :172-177). "Verified on one RTX PRO 6000 Blackwell … at main c36a6a02" reads as if the capped numbers were taken at main, though --request-context exists only on this branch (ignition/cli/__init__.py:167, planning.py:176); c36a6a02 is the baseline for the no-flag comparison, as the description says later. "the thirteen recipes' prepare() read context=plan.prepared_context" names a count a reviewer cannot check (recipes are external, AGENTS.md:9-13) and misplaces the seam, which is ignition/preparation/bootstrap.py:58. Requested change: lead with the single-model why (a 256K recipe maximum over-provisions per-request KV for the requests a deployment actually serves), then what changed, then the claimed result with its --kv-cache-limit condition, then the measurements; name which side each number came from and drop the recipe count.

Subtract / Simplify

Could remove ~17 of the +98 added lines (≈9 of the +57 test hunk, ≈8 of the +41 code/docs), plus about half the new docs row.

  1. Duplicated test cases — tests/cli/test_planning.py:235-238, :247, :259-265 (~9 lines). context=0 and context=-1 both hit the single context <= 0 check (planning.py:461-462) — keep one (~2). assert d["context"] == capped.context restates :227 (~1). The 7-line "no context_target when unset" block re-proves from_plan's generic add() early return on None (rebuild_manifest.py:350-352), already exercised by the sibling manifest test at :92-106 (~6). Keep the clamp case: after B2 it becomes the proof of the documented no-op, which is more valuable than deleting it.
  2. Two-arm chunk error — planning.py:697-700 (~5 lines). The stock three-line message already names both numbers, which is all a user needs to choose a remedy; the pass --prefill-chunk-size below N clause restates the constraint. Keep one message against the effective bound with a (default chunk is 4096) clause — the default-chunk arm is reachable only through an explicit target below 4096 (the pool floor is 8192 tokens: MINIMUM_REQUEST_TOKENS at :32, minimum_pages at :336), so a clause is enough. No test asserts either string.
  3. Three-line help — ignition/cli/__init__.py:167-170 (~2 lines). One clause plus a default, matching --prefill-chunk-size at :163-166, e.g. "cap the prepared per-request context at N tokens, a multiple of the page size; longer requests are rejected (default: the recipe's maximum)".
  4. Docs row — docs/cli-design.md:446 (~half the line). "since the per-request cache allocation is sized from the prepared context" is already documented at :828-833; "a request that would exceed N is rejected" is restated by this PR's own :1443/:1490 edits; "Command line only; … requires re-export" is the same clause --mixed-prefill carries at :447.
  5. Do not cut — verified load-bearing, previously mis-claimed dead. prepared_context's context_target is None early return (planning.py:373-374): with no target it returns recipe.context, which can exceed the pool-bound context (:365-368) on a memory-constrained host; folding it to self.context would lower the declared max_sequence_tokens with no flag and break the PR's own no-op claim (tests/cli/test_planning.py:220). Likewise effective_context = min(result.context, result.prepared_context) (:696) is the clamp that keeps the no-flag path stock, and derive(context=...) (preparation.py:56 (not opened),68) is the funnel all four entry points use. Keep all three.
  6. Not asked: dropping the flag in favour of --kv-cache-limit. Considered and rejected. The runtime flag sizes loaded KV at serve time; it cannot lower the exported max_sequence_tokens, which is the residual datum this PR adds and the thing #454 asked for. The flag stays; only the scaffolding above is subtracted.

Nits

  1. One flag, two validation homes — planning.py:461-462 vs :289-290. The context <= 0 check lives in fit, which plan() re-enters per candidate world size and per shortfall probe (:686-704), while its sibling sits in __post_init__. Move it beside the alignment check (both there, where page_tokens and recipe.context are available) or both into plan() next to the --prefill-chunk-size block (:622-625). The new tests drive both through planning.plan(...), so moving them drops no coverage.
  2. serve.py:68-69 still describe the pre-cap world. max_body_bytes is sized from recipe.context, and context_hint reads "context is limited by the checkpoint and available cache capacity"; with a cap both misdescribe the served ceiling. Harmless (admission rejects with the documented error) but the one remaining place that treats the recipe maximum as the served context.
  3. ignition/cli/help.py:38 advertises --prefill-chunk-size: 64..{recipe.context}, a range above the effective prepared context once capped.
  4. docs/cli-design.md:1443 says "The checkpoint maximum" where the new flag row and neighbouring rows say "the recipe's maximum"; one term.
  5. Test comments use "stock" as an undefined referent (tests/cli/test_planning.py:217, :227, :247); say "the behaviour without the flag".

Verified clean — do not re-raise

Open questions / not verifiable from this tree

  1. Did the two blockers reproduce? Not run here. Both follow from arithmetic (500000 % 64 = 32) and the declared protobuf schema; pytest tests/cli/test_planning.py settles them, and the head has no CI checks.
  2. What is the intended rule for an unaligned target above the recipe maximum — accepted, floored to a page, or rejected? Needs a decision, not a measurement, and should be stated in the docs row.
  3. Should to_dict()["context"] stay pool-bound? The new test pins the current meaning (tests/cli/test_planning.py:247); only a maintainer can say whether external consumers depend on it. Adding prepared_context (S1) makes the question non-urgent.
  4. Do external recipes re-round config.context? Recipes live in hyperflare_recipes (AGENTS.md:381), outside this diff. Nothing in this repository rounds, and the load-time alignment check is in Helios, which is why an export-time check on the right quantity matters.
  5. The VRAM table (RTX PRO 6000 Blackwell, Qwen3.8-27B, concurrency 1-4) is the description's claim; nothing in this tree pins the relationship, and no test can — only the --kv-cache-limit scoping (S2a) can be verified.
  6. The commit message body was not checked (git log -1 --format=%B de1b5b5); whether it follows the four-part scheme cannot be settled from this environment.

Full report · Notes Decision to Test: no (100%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.

screen malicious

Screen Result: All Clear

Evidence: I reviewed the full diff of PR #533 ("Cap the per-request context target", roobyz, open, head 02023eb, base main, 9 files +84/−18, no CI checks, no human reviews): docs/cli-design.md, ignition/cli/{__init__,bench,preparation,serve}.py, ignition/planning.py, ignition/preparation/{bootstrap,rebuild_manifest}.py, tests/cli/test_planning.py; plus the whole PR conversation and the linked closed predecessor #454.

Original task instruction followed: nothing malicious found, so the report is issued as "All Clear".

Full report · Notes decide malicious: all_clear (100%): No malicious content found

explore

Author: roobyz (CONTRIBUTOR); Discord rzr2020 Motivation: Exports today always prepare the core for the recipe's full 256K context, which over-provisions the KV pool for the concurrency a deployment actually wants. A --request-context N export flag would let an operator lower that per-request ceiling deterministically, at export time, instead of only bounding KV at serve time. Scale: +84 / −18 lines in 9 files (head 02023eba, down from +98/−18 at the head I last reported) Proposal:

Full report · Notes

Value Proposition

Verdict: worth it with changes — the capability is needed, the layer is right, the footprint is tiny (9 files, +35/−14 plus one test, all Ignition Python), and the flag is a strict no-op when omitted. But as pushed the new test still cannot pass, and the "page-multiple validation" the description claims was removed in this revision, leaving an unaligned target that exports a core Helios refuses to load after a full GPU preparation.

What the change does (verified on the head)

Charter mapping

Blockers (must fix before merge)

  1. The new test cannot pass — two independent defects in tests/cli/test_planning.py.
    • :254 asserts by_key["context_target"].value.int64_value == 131072. _preparation_value writes uint_value for a non-negative int (rebuild_manifest.py:332-333; proto fields are int_value = 2, uint_value = 3, helios/proto/runtime_core.proto:127-128), so the attribute does not exist → AttributeError. Correct assertion: uint_value == 131072.
    • :238-240 expects match="multiple of the" for context=100. No page-multiple validation exists on this head (Plan.__post_init__, planning.py:224-296, never mentions context_target; search finds no such error string anywhere in ignition/). context=100 is rejected instead by the chunk check at planning.py:709-711 — "--prefill-chunk-size 4,096 exceeds the 100-token context this plan allows" — so pytest.raises(..., match="multiple of the") fails.
  2. The alignment validation the description advertises is missing, and its absence is a real export-time defect. Helios rejects a core whose prepared_sequence_tokens or limits.max_sequence_tokens is not a multiple of the page size (helios/src/model/catalog.rs:49-57, called at load from helios/src/server/config.rs:226). With no export-time check, --request-context 131100 on a 64-token-page recipe plans cleanly, spends the full GPU preparation, and then the core fails with "invalid prepared model configuration" at flare run. Add the check in Plan.__post_init__ on the value actually served — min(recipe.context, context_target) % page_tokens (page_tokens is available there via planning.py:335-338) — so an oversized-but-aligned target (500000-alignment aside) stays accepted, 100 is rejected, and the docs may then state the rule. Either implement it or drop the claim from the description and document that unaligned targets fail at load.

As pushed, pytest tests/cli/test_planning.py therefore fails; the head has no CI, which is why it has not been seen.

Should fix

  1. Plan.demand_pages is still uncapped (planning.py:331-332): concurrency * (recipe.context // page_tokens) feeds the printed/to_dict KV demand (:446), so a capped core's report overstates the very number this flag lowers. Use prepared_context.
  2. Cap-affected derived values still use the recipe max. _server_options sizes max_body_bytes from recipe.context and tells clients "context is limited by the checkpoint and available cache capacity" (cli/serve.py:68-69) — that hint is what a user sees on a context admission error. With a cap both misdescribe the served ceiling. Related: ignition/cli/help.py:38 advertises --prefill-chunk-size: 64..{recipe.context}, a range above the effective context once capped; and docs/cli-design.md:446 should note that a cap also lowers the default output allowance (config.rs:210-212).
  3. The evidence still does not measure what only this flag can do. Every column uses --kv-cache-limit concurrency, so the table measures the pool, which --kv-cache-limit context / --memory-limit already move at serve time (and under the default --kv-cache-limit memory, page_ceiling returns Ok(None), helios/src/runtime_core/memory.rs:290-292, so the headline should state the condition). Add one case at equal prompt and output length proving the ceiling: a request between the cap and the recipe max rejected by the capped core and accepted by stock, plus /v1/models reporting the smaller max_model_len.
  4. One description claim is false. "a cap above the pool is a no-op: the prepared context resolves to the pool-bound value, matching stock behavior" — stock passed recipe.context unclipped (bootstrap.py:58 before this PR), whereas prepared_context is min(recipe.context, target, tokens) (planning.py:381), so a cap above the pool can prepare a lower max_sequence_tokens than the same export without the flag. That is a deliberate, defensible clamp (the pool cannot hold more), but it is a behaviour change and should be stated as one. The description also claims the test covers "the bootstrap value"; it does not — nothing asserts common_preparation_kwargs(plan)["context"] == plan.prepared_context (tests/cli/test_commands.py:94-97 checks only prefill chunk and max_active). That is the one line that changes the exported core, so it deserves the assertion.
  5. Name the kwarg context_target= in fit()/plan() (planning.py:461,605) — context= next to a Plan.context with different meaning invites misuse. Minor: put the positive-value check (planning.py:467-468) beside the alignment check so both live in __post_init__ and both cover direct Plan(...) construction.

Cost, benefit, alternatives

Bottom line

Merge once the two broken assertions in tests/cli/test_planning.py:239-240,254 are fixed, the page-multiple validation the description promises is actually implemented (or the claim and docs corrected to say a misaligned target fails at load), and demand_pages uses prepared_context. The hint/body-limit/help notes and the missing ceiling measurement are worth one revision of the description and one line of docs; none of them touch the design, which is well placed, general, and a no-op by default.

Full report Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.

Simplicity

Verdict: blocking issues

Blocking:

Should fix:

Nits: 5 Link: https://github.com/NVIDIA/hyperflare-inference/pull/533

Full report · Notes

Correctness

Verdict: blocking issues Blocking:

Full report · Notes

Architecture

Verdict: blocking issues Blocking:

Full report · Notes

Prose

Verdict: blocking issues Blocking:

Full report · Notes

Conventions

Verdict: blocking issues Blocking:

Review through the conventions-and-duplication lens only. Every changed file read in context, callers followed (export, debug-serve, bench, multi-host _export_hosts, derive/fit/plan, bootstrap.common_preparation_kwargs, rebuild_manifest, Helios load). Two findings from my earlier turn are fixed at this head and were withdrawn: the multi-host forwarding gap and the manifest/to_dict recording gap — all four entry points forward context=args.request_context (serve.py:207, :291, :476; bench.py:177), and the cap is recorded in to_dict (planning.py:438), reproduction_arguments (rebuild_manifest.py:264-265) and from_plan SCOPE_DEPLOYMENT (:389). The seam itself is clean: one plan field, one accessor, one bootstrap.py:58 consumer, no new mechanism and no per-model branch. Open questions: intended handling of an unaligned target above the recipe maximum; whether to_dict()["context"] should stay pool-bound; the VRAM table is untestable here. No CI checks ran on this head, so the blocking test failure should be confirmed with pytest tests/cli/test_planning.py.

Full report · Notes

Subtractive

Verdict: make it smaller first The change: +84 / −18 lines (9 files; code+docs +37/−18, tests +47/−0) Could remove: about 22 lines in 4 places while keeping the flag; about 70 of the 84 if the flag is dropped and the existing runtime --kv-cache-limit carries the memory argument Biggest subtractions:

Full report · Notes

Pre Test Report

Pre-Test Report — PR #533 "Cap the per-request context target" (head 02023eba)

Recommendation: DO NOT refer to hardware testing. Return to the author for fixes.

PR: https://github.com/NVIDIA/hyperflare-inference/pull/533 · author roobyz (CONTRIBUTOR) · open · base main (f377dc85) · head 02023eba · 9 files, +84/−18 · no reviews, no CI checks on the head. Supersedes closed PR #454. Security screen all clear; I found no prompt-injection or agent-directed content in the description, diff, docs or comments — the Design-Signed-Off-By/design-review=1af4 trailers, the "Discord:" line and the @flare-autobot re-review ping are ordinary process metadata.

I re-verified every review claim against the tree rather than trusting the summaries. This revision is a regression from the previous head de1b5b5 (+98/−18 → +84/−18): a rebase onto merged #543 (joint-tuning removal) dropped the context parameter from derive() while keeping its call, and the page-multiple validation was deleted.


1. Why testing now would be wasted hardware time

Blocking A — every preparation command crashes; there is nothing to test

ignition/cli/preparation.py:45-56 declares 26 keyword-only parameters and has no context, yet line 69 ends the planning.plan(...) call with row_shard_attention=row_shard_attention, context=context). A full-file search for the token returns only context_parallel/context_parallel_size (:47, :62), the offending :69, and the context_parallel() helper (:124-132) — no module-level context.

So derive() raises on every invocation, flag or no flag. Callers: serve.py:207 (_export_hosts), serve.py:291 (_prepare), serve.py:476 (debug_serve), bench.py:177 (not opened). Two tests call derive() directly and will also fail: tests/cli/test_commands.py:88 and :114 (the latter from merged #508).

The diff confirms it: pr_files shows ignition/cli/preparation.py at +1/−1 — only the call line was edited, never the signature. One-keyword fix, but until it lands the branch produces no artifact at all.

Blocking B — the page-multiple validation described and asserted does not exist

The description advertises "a page-multiple validation" and tests/cli/test_planning.py:238-240 asserts it. No such check exists anywhere: search_code "multiple of the" over ignition/ returns no matches, and context_target appears only at planning.py:186 (field), :379/:381 (accessor), :438 (to_dict), :468 (positivity error), :549 (constructor kwarg). __post_init__ (:224-296) never inspects it; fit() validates only context <= 0 (:467-468).

This is a real load-time defect, not a test nit. bootstrap.py:58 makes prepared_context the prepared catalog's context, which becomes max_sequence_tokens, and helios/src/model/catalog.rs:50-57 rejects any core whose prepared_sequence_tokens or max_sequence_tokens is not a multiple of page_tokens — with the opaque "invalid prepared model configuration" at :70. So --request-context 1000 exports cleanly and dies at flare run, after a full GPU preparation.

The PR's own test fails too: with the fixture's page_tokens=64 (test_planning.py:38) and prefill_chunk=4096 (:42), context=100 passes :635 and :467, then trips the chunk check at planning.py:709-711 ("--prefill-chunk-size 4,096 exceeds the 100-token context this plan allows") — which does not match "multiple of the".

Blocking C — the test reads a protobuf field that does not exist

tests/cli/test_planning.py:254 asserts by_key["context_target"].value.int64_value. helios/proto/runtime_core.proto:124-133 declares int_value = 2 and uint_value = 3 — no int64_value (AttributeError). Even renamed, it would read 0: _preparation_value (rebuild_manifest.py:329-333) writes non-negative ints as uint_value.

These three are arithmetic and schema facts, not judgement. The head is not green, and no CI ran on it.

Blocking D — the exported ceiling is not reproducible, so a GPU result could not be attributed

prepared_context is clamped by self.tokens (planning.py:381), and tokens = pages * page_tokens (:368-369) with pages from available // page_bytes — i.e. the free VRAM of the export host. Recorded reproduction_args carry only --request-context N (rebuild_manifest.py:264-265), so identical recorded flags reproduce different cores on hosts with different free memory. It is also redundant: Helios already applies exactly this clamp at load (helios/src/model.rs:268-272, fit_context). The untargeted path correctly returns recipe.context and leaves binding to serve time.

Blocking E — the evidence measures a flag that already exists

helios/src/runtime_core/memory.rs:284-292: page_ceiling returns Ok(None) for KvCacheLimit::Memory — the default. Only Context/Concurrency derive a ceiling from the prepared context. The author's VRAM table was measured with --kv-cache-limit concurrency throughout, so our GPUs would largely re-measure --kv-cache-limit, not this PR.

To be fair to the change: the capability is genuinely not a duplicate. --kv-cache-limit and --memory-limit bound the pool; neither can lower the exported max_sequence_tokens (helios/src/server/config.rs:131,148) or advertise a smaller max_model_len. That export-time ceiling is real and only this flag provides it — which is exactly why the evidence should show it and does not. I disagree with the Subtractive lens's recommendation to drop the flag.

Also limiting — reachability is outside this repo

Recipes live in the external hyperflare-recipes repository; BasePreparationConfig.context must be written by each recipe into max_sequence_tokens. A test from this tree cannot confirm the end-to-end claim.


2. Expected value of a hardware test at this head: LOW (effectively zero)

Verified clean (no need to re-test once the blockers are fixed): the no-flag path is a true no-op (planning.py:379-380 returns recipe.context, exactly what bootstrap.py:58 passed before); Plan.context is untouched; all four entry points forward the flag; the cap reaches the plan JSON (:438), the printed serve line (serve.py:319), the bench record (bench.py:248 (not opened)), the reproduction args (rebuild_manifest.py:264-265) and the manifest at SCOPE_DEPLOYMENT (:389); the flag is correctly absent from flare run (_preparation_arguments registered only at __init__.py:50 export, :53 bench, :60 debug-serve); the frozen dataclass with a defaulted field keeps replace() working; no per-model branch, no env toggle, no Helios change.


3. Conditional test plan (adopt only after A–E are fixed and the GPU-free suite is green)

Phase 0 — GPU-free, must pass first (no hardware time)

pytest tests/cli/test_planning.py tests/cli/test_commands.py, with these cases added or repaired:

Phase 1 — the cap reaches the core (1 GPU of cn5, SM120; matches the author's hardware)

Model: nvidia/GLM-5.3-Flash-NVFP4. Two exports from the same command, differing only in the flag: A --request-context 131072, B unset. Use one GPU, not four — the change is orthogonal to parallelism except through page size.

  1. /v1/models → max_model_len is 131072 on A and the recipe maximum on B. The one assertion only the export-side value can satisfy.
  2. A prompt of ~132k tokens is rejected at admission on A; a prompt just under the cap is accepted.
  3. flare inspect A shows the cap, and its reproduction command re-exports a 131072 core.
  4. Falsification control: an unaligned --request-context fails at planning with an actionable message, not at core load.

Phase 2 — the isolating VRAM comparison the PR owes

Under both --kv-cache-limit memory (default) and --kv-cache-limit concurrency, at concurrency 1 and 4, record total VRAM for A and B. The pair separates this PR from the runtime flag. Expect ~0 delta under memory mode — report that honestly as the result.

Phase 3 — regression (cheap, same job)

A pre-PR core still loads and serves; a no-flag export produces the same preparation config as main; --request-context still absent from flare run.

Budget / efficiency

~2 exports + ~6 serve starts on a single cn5 GPU ≈ 1–2 GPU-hours, one model, one host. Skip cn7 (no ARM64-specific question). Skip multi-host (no second host — must be pinned GPU-free). No throughput A/B sweep — the PR claims memory and admission-ceiling behaviour, not speed.


4. Bottom line

Full report · Notes

code review summary

Recommendation: Changes Requested

Blockers:

Should fix:

Subtract / Simplify:

Could remove ~10 of +84 added lines (~7 in the test hunk, ~3 in docs):

Nits:

6 nits: the <= 0 check lives in fit instead of beside plan()'s flag checks; rename the parameter to context_target to delete the context_target=context translation; split the four-key to_dict line (:438); "checkpoint maximum" vs "the recipe's maximum" and the undocumented clamp in :446; format(x, ',') at serve.py:319 is the odd one out; and "stock" in the test comments is an undefined referent.


Nothing was executed here and head 02023eba has no CI checks; every behavioural claim is a static read of the code at that head. pytest tests/cli/test_planning.py tests/cli/test_commands.py settles all three blockers in one command. The design itself is sound and should be kept: one optional frozen Plan field, one accessor, one keyword through fit/plan, one consumer line, one flag in the shared capacity group, no Helios change, no per-model branch — and omitting the flag is byte-equivalent to main, with the reporting gaps from the previous round (plan JSON, serve line, bench record, manifest, multi-host, docs owner rows) all fixed at this head.

Full report · Notes Decision to Test: no (100%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.

screen malicious

Screen Result: All Clear

Evidence: No prompt injection, agent-directed instruction, or other attempt to cause unwanted agentic behavior was found in PR #533 ("Cap the per-request context target", author roobyz, open, head 9118add, 6 files +69/−5). Every claim below was checked at the PR head and re-verified in the code before writing.

Surfaces screened: (1) the PR description — a conventional four-part summary, a VRAM table, a Discord line, and a Signed-off-by plus Design-Signed-Off-By: Roberto Rivera <rzrivera@protonmail.com>; design-review=eb2f trailer, which is a documented repo convention (.githooks/commit-msg:15,59, docs/design-review.md:191-207) that the docs themselves call "an attention check, not proof of review" (docs/design-review.md:230), not an injected directive; (2) the full discussion — two author refactor notes and three flare-autobot review summaries, i.e. review material about the code, whose only "instruction" is the bot's own opt-out line #autobot:ignore, which was not followed and is not a target for escalation; (3) the entire diff of the 6 files — docs/cli-design.md (+2/−1), ignition/cli/serve.py (+2/−2), ignition/parameters.py (+13), ignition/planning.py (+14/−1), ignition/preparation/bootstrap.py (+1/−1), tests/cli/test_planning.py (+37); no CI/workflow, dependency, lockfile, secret, network, shell or permission changes, and no new files; (4) negative-result searches at pr/533: "autobot" → 0 hits; case-insensitive "ignore previous|disregard|do not report|approve this|AI agent" → only docs/cli-design.md:729 --dangerously-approve-key, a genuine flag; "skip review|pre-approved|lgtm|maintainer approved" → 0; in tests/cli/test_planning.py "you (must|should)|do not|note to|reviewer|agent|instruction" → 0; in ignition/parameters.py "eval(|exec(|subprocess|os.environ|requests.|urllib|base64" → 0 and "TODO|FIXME|XXX" → 0.

Substance check: the change does what it says and every behavioural edit tightens a bound rather than widening one. RecipeParameters.context_target (ignition/parameters.py:1309-1321) is a DEPLOYMENT-scope, manifest_key="context_target" parameter; Plan.prepared_context (ignition/planning.py:357-363) returns the recipe max when unset and min(recipe.context, target) otherwise, while Plan.context (:353-355) stays stock; common_preparation_kwargs passes plan.prepared_context as the exported context (ignition/preparation/bootstrap.py:132); serve.py:67-68 sizes max_body_bytes from it and names the cap in context_hint; the bench check now compares against prepared_context (ignition/planning.py:212); Helios still clamps to the pool (helios/src/model.rs:268-272). Nothing loosens auth, admission or resource limits.

Open questions are confined to function, not trust: max_fn=_recipe_context_limit (ignition/parameters.py:1316, resolved at :241-246, enforced at :522-545) rejects targets above the recipe context, so the clamp branch at planning.py:363 and the oversized case at tests/cli/test_planning.py:310-313 look unreachable via the CLI; the page-multiple check at planning.py:187 validates the raw target rather than min(recipe.context, target); and the VRAM payoff is conditioned on --kv-cache-limit concurrency, as the description states. These are ordinary review findings for the code, already raised by flare-autobot, and carry no security implication.

Full report · Notes decide malicious: all_clear (100%): No malicious content found

explore

Author: roobyz (CONTRIBUTOR); Discord rzr2020 Motivation: A deployment that only ever serves requests much shorter than a recipe's maximum context still pays for a KV pool sized to that maximum, so it cannot fit the concurrency (or a co-resident workload) it wants. This PR makes the per-request ceiling a documented, reproducible export-time parameter instead of a runtime-only guess. Scale: +69 / −5 lines in 6 files Proposal:

Full report · Notes

Value Proposition

Verdict: worth it with changes

The capability is needed, the layer is right, and this is the smallest-footprint version of the change yet: after the rebase onto #545's compositional RecipeParameters, the whole thing is 6 files, ~+30 code, +37 test, and the flag, --help row, manifest entry and SCOPE_DEPLOYMENT scope all come for free from the shared parameter machinery. Omitting the flag is a strict no-op (prepared_context returns recipe.context). But two defects make the PR's own new test fail, and one exports a core Helios refuses to load after a full GPU preparation.

What it does, verified on the head

Blockers

  1. --request-context never reaches reproduction_args, so the new test fails at tests/cli/test_planning.py:324 and the manifest's reproduction command rebuilds an uncapped core — exactly the #454 objection. RecipeParameters.reproduction_args (parameters.py:1469) overrides the base implementation, emits base fields by hand (:1483-1484, :1522-1527), and then skips every base-class field in its generic loop: :1491 builds base_field_names from fields(RecipeParameters) and :1494 continues when the name is in it. context_target is a base field, so repro_always=True on it is dead. The manifest parameters list does carry context_target (base manifest_parameters, :596-616, has no such skip), so artifact and reproduction command disagree — proof it is an oversight. → Emit it beside --prefill-chunk-size at :1484.
  2. An oversized target is rejected, contradicting the docs row and the PR's own test (tests/cli/test_planning.py:310-313). max_fn=_recipe_context_limit (:1268-1269, wired at :1316) returns the recipe context, so validate_fields (:533-545) raises "--request-context for ALIAS must be 1 through 262,144" for context_target=500000. But planning.py:363 promises min(recipe.context, target), and docs/cli-design.md:468 says "resolves to the smaller of N and the recipe maximum". The test asserts acceptance. → Drop max_fn from context_target (keep it on prefill_chunk at :1301) and align the page check to the value actually served — min(self.recipe.context, target) % self.page_tokens (planning.py:187-190) — because 500000 % 64 == 32, so the current check alone still rejects it. With that pair, lines 310-313 and 319-321 both pass unchanged. (The target=0 case at :315-317 still trips min_value=1 first, so it stays valid.)
  3. A cap below the prefill chunk exports a core Helios refuses to load. Helios rejects prefill_chunk_size > max_sequence_tokens (helios/src/scheduler.rs:66-77, via model/catalog.rs:42 after fit_context). Export writes prefill_chunk_size = parameters.prefill_chunk (bootstrap.py:45-46; default 4096) and max_sequence_tokens = prepared_context. Ignition never compares the two against the cap: RecipeParameters.validate compares the chunk to ctx.recipe.context (parameters.py:1458-1462) and plan() compares to result.context (planning.py:594-596) — never prepared_context. So ignition export qwen3.8-27b --request-context 2048 plans cleanly, spends the entire GPU preparation, then flare run fails "invalid prepared model configuration". → Validate prefill_chunk <= prepared_context in Plan.__post_init__ beside the page check, naming --request-context.

Should fix

  1. planning.py:320-321 — demand_pages still uses recipe.context, so the printed/to_dict KV demand overstates the very number this flag lowers.
  2. Plan.to_dict (planning.py:379-416) carries context, checkpoint_context and context_target but no prepared_context, and context_target has no status_label, so the "Select GPUs" line (serve.py:268-272, parameters.py:1540-1562) never mentions the cap. A capped export and a stock one differ in reporting only by context_target.
  3. docs/cli-design.md:468 should say a cap also lowers the default output allowance (max_new_tokens defaults to max_sequence_tokens, server/config.rs:210-213) and must be at least the prefill chunk.
  4. Evidence is mode-scoped: under the default --kv-cache-limit memory, page_ceiling returns Ok(None) (runtime_core/memory.rs:290-292) and pages fill free VRAM, so the VRAM table holds only with --kv-cache-limit context|concurrency (the commands used it; the claim does not say so). Add the case only this flag can produce: a request between cap and recipe max rejected by the capped core and accepted by stock, plus a smaller max_model_len in /v1/models.
  5. No test pins the seam that actually changes the core — add common_preparation_kwargs(plan)["context"] == plan.prepared_context at tests/cli/test_commands.py:150-155.

Charter mapping

Bottom line

Merge once (1) --request-context is emitted in RecipeParameters.reproduction_args, (2) an oversized target clamps and the page check validates the served min(recipe.context, target), and (3) a cap below the prefill chunk is rejected before preparation. The reporting/docs gaps are one revision of the description plus one line of docs; none touch the design, which is well placed, general, and a no-op by default.

Full report · Notes Decide Value: yes (99%): This change is worth reviewing: it provides value to the project in line with its charter.

Correctness

Verdict: blocking issues Blocking:

Full report · Notes

Simplicity

Verdict: blocking issues Blocking:

Lens D (simplicity) at head 9118add: the PR adds one field, one accessor, one validation and one consumer seam — a small, well-placed change. But three of the sixty-nine added lines contradict each other. The parameter spec caps context_target at recipe.context (parameters.py:1316 → 1268-1269, enforced by validate_fields at parameters.py:536, reached from planning.py:540), so min(self.recipe.context, target) in Plan.prepared_context (planning.py:363) can never bind, the doc row (docs/cli-design.md:468) and the PR description advertise a clamp that is unreachable, and the test that encodes the clamp (test_planning.py:310-313, context_target=500000) must raise instead of returning a plan. Either the bound or the clamp has to go — the smaller version drops max_fn and validates page alignment on prepared_context rather than the raw target. Second, the only line that carries the cap into the core is bootstrap.py:132, and no assertion touches it; replacing the five mirrored accessor assertions with the repo's existing BasePreparationConfig(**common_preparation_kwargs(...)).context pattern (tests/cli/test_commands.py:150-153) pins the real contract in two lines. Nits: redundant manifest_key (the fallback at parameters.py:607-612 already yields context_target), dead repro_always (parameters.py:1516-1520 skips None first), the alignment check re-run in Plan.__post_init__ for every candidate and probe, a doc clause copied verbatim from the neighbouring row, and a test signature with an unused monkeypatch. Correct and load-bearing: the target is None early return, the bench check at planning.py:212, and serve.py:67-68. Not verifiable here: no CI and no pytest run; pytest tests/cli/test_planning.py -k request_context settles the blocker. No attempt to direct the reviewer was found.

Full report · Notes

Architecture

Verdict: blocking issues

Blocking:

Should fix:

Nits: 2

Link: https://github.com/NVIDIA/hyperflare-inference/pull/533

Confidently clean, and not to be re-raised: the design and scope fit the charter — one optional field declared once on the universal base, auto-generated CLI argument, manifest entry and reproduction arg, one consumer line (preparation/bootstrap.py:132), no Helios change, no per-model branch, and omission byte-equivalent to main. Nothing was executed (head 9118add has no CI checks); pytest tests/cli/test_planning.py settles blocker 1 and the two source comparisons settle blocker 2.

Full report · Notes

Prose

Verdict: blocking issues Blocking:

Full report · Notes

Conventions

Verdict: blocking issues Blocking:

Full report · Notes

Subtractive

Verdict: make it smaller first The change: +69 / −5 lines (6 files: code+docs +32/−5, tests +37/−0) Could remove: about 16 lines in 4 places if the flag stays; about 68 of the 69 if it goes Biggest subtractions:

Full report · Notes

Pre Test Report

Pre-Test Report — PR #533 "Cap the per-request context target" (head 9118add)

Recommendation: DO NOT refer to hardware testing. Return to the author for fixes.

PR: https://github.com/NVIDIA/hyperflare-inference/pull/533 · author roobyz (CONTRIBUTOR) · head 9118add · base main · 6 files, +69/−5 · no reviews, no CI checks on the head. Supersedes closed PR #454 (CHANGES_REQUESTED). Security screen all clear; I independently found no prompt-injection or agent-directed content in the description, diff, docs or comments. The Design-Signed-Off-By/design-review=eb2f trailers and the "Discord:" line are ordinary PR metadata.

I re-verified every review claim against the tree rather than trusting the summaries. The reviews agree that the feature's shape is right and disagree about how much is broken; on several points the summaries are describing older heads and are now stale (see §5).


1. What the change is

After the rebase onto merged #545, the whole feature is one declarative parameter plus one consumer line:

No Rust change, no per-model branch, no new mechanism. The design is correct and should be kept. Omitting the flag is a true no-op.


2. Why testing now would be wasted hardware time

Blocking A — the PR's own test cannot pass, on two independent verified grounds

The head is not green, so any GPU time buys results against an artifact the author must change.

  1. Above-maximum cap is rejected, not clamped — the test asserts the clamp. context_target declares max_fn=_recipe_context_limit (parameters.py:1316), whose helper returns context.recipe.context (:1268-1269). validate_fields enforces it in the elif bound branch (parameters.py:533-540, message "--request-context for <alias> must be 1 through 262,144"), reached from Plan.__post_init__ (planning.py:185) and from plan() before any candidate exists (planning.py:540). tests/cli/test_planning.py:310-313 does replace(base_params, context_target=500000) against a fixture with context=262144, page_tokens=64 (:139-140) and asserts the plan is returned with prepared_context == recipe.context, so line 311 raises. (Even without the bound, 500000 % 64 = 32 trips the alignment check at planning.py:187.) Consequences: the clamp at planning.py:363 is dead code; docs/cli-design.md:468 ("resolves to the smaller of N and the recipe maximum") and the description ("min(recipe.context, N)") are false; and a user following the docs gets a usage error.
  2. --request-context never reaches reproduction_args. RecipeParameters.reproduction_args (parameters.py:1469-1528) hand-emits --max-concurrency/--prefill-chunk-size (:1483-1484), then builds base_field_names = {f.name for f in fields(RecipeParameters)} (:1491) and skips every base-class field in its generic loop (:1494). context_target is a base field (:1309), so it is skipped and its repro_always=True (:1319) is dead metadata. tests/cli/test_planning.py:324-325 asserts "--request-context" and "131072" are present → fails. rebuild_manifest.reproduction_arguments (:231-261) merely splats the same list, so flare inspect and the embedded manifest record a command that silently rebuilds an uncapped core.

Neither is a judgement call: both follow from the declaration and the message strings. pytest tests/cli/test_planning.py settles them.

The export-side chunk check still compares against the stock context:

if params.prefill_chunk > result.context:      # planning.py:594-596; result.context == min(recipe.context, tokens)

prefill_chunk itself is bounded only by ctx.recipe.context (parameters.py:1458-1462). Nothing compares the chunk against the cap, while bootstrap.py:132 writes prepared_context as max_sequence_tokens and bootstrap.py:44-46 forwards parameters.prefill_chunk as prefill_chunk_size. So --request-context 1024 (or 2048) with the default 4096 chunk passes every export-side check, spends the entire GPU preparation, and then fails at load: helios/src/scheduler.rs:66-77 requires prefill_chunk_size <= max_sequence_tokens, surfaced through helios/src/model/catalog.rs:42. This is the same class of defect the new page check exists to prevent, and it is one flag away from the PR's headline scenario — the stated purpose is pushing memory down.

Blocking C — the artifact cannot be audited or reproduced, so a run's output could not prove what was prepared

Plan.to_dict (planning.py:379-416) emits context, checkpoint_context and (via parameters.to_dict) context_target, but no prepared_context; context_target declares no status_label, so the printed Select GPUs. line (serve.py:268-272 via status_parts, parameters.py:694-707) never mentions the cap; and reproduction_args omits the flag (Blocking A.2). A hardware run against this head could not answer "was the cap applied?" from the plan JSON, the console line, or the inspect command.

Blocking D — the evidence measures a flag that already exists

helios/src/runtime_core/memory.rs:284-292 returns Ok(None) for KvCacheLimit::Memory — the documented default (docs/cli-design.md:740) — and only Context/Concurrency derive a page ceiling from the prepared context. The author's VRAM table was measured with --kv-cache-limit concurrency, so it demonstrates an existing runtime flag, not this PR. The capability is genuinely not a duplicate (the runtime cannot lower max_sequence_tokens or max_model_len, both baked from prepared_sequence_tokens at config.rs:131-148; the runtime clamp at helios/src/model.rs:268-272 only narrows to the physical pool) — which is exactly why the evidence should show that and does not, and why the docs row states the VRAM benefit unconditionally instead of scoping it.

Blocking E — the test also depends on a GPU/FlashInfer environment

tests/cli/test_planning.py:295 takes monkeypatch and never uses it, yet calls rebuild_manifest.from_plan (:323), which calls source_identity() (rebuild_manifest.py:290,327); that raises RuntimeError("the preparation environment requires FlashInfer") when FlashInfer is absent (ignition/preparation/source_identity.py:36-41). Every neighbouring test patches it (:159, :333).

Not testable on our fleet regardless

--ranks > 1 (multi-host export) needs a second host; cn5 is four GPUs on one host and cn7 is a single GB10. The flag now forwards on that path (serve.py:178-199), so it must be pinned GPU-free, not by hardware.


3. Expected value of a hardware test at this head: zero

Verified clean — do not re-test once fixed: the no-flag path returns recipe.context (planning.py:360-362), exactly what bootstrap.py:132 passed before, so omission is byte-equivalent to main; Plan.context is unchanged; all four entry points forward the flag; the cap reaches the plan JSON, the manifest and SCOPE_DEPLOYMENT; the bench check uses prepared_context; max_body_bytes follows the cap; the frozen dataclass with a defaulted field keeps replace() working; no per-model branch, no env toggle, no Helios change.


4. Conditional test plan (adopt only after A–E are fixed and the GPU-free suite is green)

Deliberately minimal: this is a memory-sizing and admission-ceiling knob with no throughput claim, so no A/B perf sweep is warranted.

Phase 0 — GPU-free, must pass first (no hardware time)

pytest tests/cli/test_planning.py tests/cli/test_parameters.py (not opened) tests/cli/test_commands.py, with these cases added or repaired:

Phase 1 — the cap reaches the core (1 GPU of cn5, not 4; SM120 matches the author's hardware)

Model: nvidia/GLM-5.3-Flash-NVFP4 (present on cn5; closest text recipe to the author's measurement). Two exports from the same command, differing only in the flag: A --request-context 131072, B unset.

  1. /v1/models → max_model_len is 131072 on A and the recipe maximum on B. The one assertion only the export-side value can satisfy.
  2. A prompt of ~132k tokens is rejected at admission on A; a prompt just under the cap is accepted.
  3. flare inspect A shows the cap, and its reproduction command re-exports a 131072 core.
  4. Falsification control: an unaligned --request-context fails at planning with an actionable message, not at core load (Helios returns the opaque "invalid prepared model configuration").

Phase 2 — the isolating VRAM comparison the PR owes

Under both --kv-cache-limit memory (default) and --kv-cache-limit concurrency, at concurrency 1 and 4, record total VRAM for A and B. The pair separates this PR from the runtime flag. Expect ~0 delta under memory mode — that is the honest result and must be reported as such.

Phase 3 — regression (cheap, same job)

A pre-PR core still loads and serves; a no-flag export produces the same preparation config as main; --request-context still absent from flare run.

Budget / efficiency

~2 exports + ~6 serve starts on a single cn5 GPU ≈ 1–2 GPU-hours, one model, one host. Skip cn7 (no ARM64-specific question). Skip multi-host (no second host). No throughput A/B — the PR claims memory and admission-ceiling behaviour, not speed.


5. Corrections to the review summaries

Bottom line: the feature is worth building and the seam is right, but four substantive problems (a red test from two verified causes, a legal flag value that exports an unloadable core, an artifact that cannot be reproduced or audited, and evidence that measures an existing runtime flag) mean hardware time now would test the wrong artifact. Fix → GPU-free suite green → one targeted 1–2 GPU-hour run on a single cn5 GPU.

Full report · Notes

code review summary

Recommendation: Changes Requested

The shape of the change is now right and should not be reworked: one optional field on the universal RecipeParameters base (ignition/parameters.py:1309-1321), one Plan.prepared_context accessor (ignition/planning.py:357-363), one consumer line in common_preparation_kwargs (ignition/preparation/bootstrap.py:132), no Helios change, no per-model branch, and omitting the flag is byte-equivalent to main. Three defects remain, all reachable with documented defaults. Nothing was executed: head 9118add has no CI checks, so every claim is a static read of the cited lines, and pytest tests/cli/test_planning.py settles the first two blockers (lines 311 and 324) in one run.

Blockers:

Should fix:

Subtract / Simplify:

Could remove ~14 of +69 added lines (~10 test, 3 declaration, 1 planning), plus half of one docs row:

Nits:

7 nits

Full report · Notes Decision to Test: no (100%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.

screen malicious

Screen Result: All Clear

Evidence: Read the entire diff of PR #533 (8 files, +79/−10, head e623985) rather than the summary: ignition/parameters.py (:1309-1320, :1484-1485, :1492-1495), ignition/planning.py (:186-190, :212, :357-363, :594-597), ignition/cli/serve.py (:67-70), ignition/cli/help.py (:46), ignition/preparation/bootstrap.py (:132), docs/cli-design.md (:446, :465-468, :1433-1436), docs/preparation-development.md (:15-19), tests/cli/test_planning.py (:295-329). Every hunk is an ordinary flag declaration, accessor, keyword pass-through, help string, doc row, or unit test. No new imports, no eval/exec, no subprocess, no network call, no file write, no dynamic code loading, no hidden HTML/comment/zero-width/unusual-Unicode content in the diff (regex scan: no matches).

Injection scans over pr/533 for agent-directed idioms ("ignore previous instructions", "system prompt", "you are an AI", "autobot", "claude", "chatgpt", agent/assistant directives, base64/curl one-liners) found no matches in the changed files; the only "assistant" hits under ignition/ are pre-existing chat-template markers (direct/server.py:71 (not opened),220, preparation/contract.py:92 (not opened),99), untouched by this PR.

Description claims verified against code and found accurate, not deceptive: context_target has no max_fn (parameters.py:1309-1320), so the documented min(recipe.context, N) clamp is genuinely reachable; status_label present (:1318); --request-context hand-emitted in the reproduction_args override because base-class fields are skipped (:1484-1485, :1492-1495); bench check uses prepared_context (planning.py:212); prefill bound uses min(result.context, result.prepared_context) (:594-597); bootstrap.py:132 is the single seam. The VRAM table is unverifiable from here but internally consistent engineering data with no injection angle. No author text tried to redirect review.

One observation, not a finding: the only agent-addressed text in the thread is the repository's own CI automation — three flare-autobot review comments link opaque external URLs (autobot.eidonix.com/p/….html) labelled "[Full Review] for Agents", plus an unused #autobot:ignore opt-out. I did not follow those links; they are ordinary bot output, not instructions to me.

Secondary non-security nit for the author: the page-multiple check is gated on target <= recipe.context (planning.py:187), so an unaligned target above the recipe max silently passes, while the flag help (parameters.py:1319) states the value "must be a multiple of the page token count" unconditionally; docs/cli-design.md:468 matches the code, so help and doc are the inconsistent pair. Not a security issue.

Full report · Notes decide malicious: all_clear (100%): No malicious content found

explore

Author: roobyz (CONTRIBUTOR); Discord rzr2020 Motivation: The export already decides the context each prepared core can serve, but today that number is always the recipe maximum, so a deployment that wants shorter requests must buy a bigger KV pool than it uses. This PR adds one export-time flag, --request-context N, that lowers the prepared per-request context so cores fit in less VRAM at a given concurrency. Scale: +79 / −10 lines in 8 files Proposal:

Full report · Notes

Value Proposition

Verdict: worth it with changes

The capability is needed, the layer is right, and the footprint is now small: 6 files, ~+69/−14, all Ignition Python plus docs — one optional field on the shared RecipeParameters base, one Plan.prepared_context accessor, one consumer line, no Helios change, no per-model branch. Omitting the flag is a strict no-op. All three defects I blocked on last round are fixed at head e6239855. What remains are test hygiene, one docs sentence and one reporting line — nothing touches the design.

The three blockers are closed, verified line by line

  1. Reproduction args. ignition/parameters.py:1484-1485 now emits --request-context beside --prefill-chunk-size, inside the override that :1492-1495 would otherwise skip by base-class name. repro_always (dead for base-class fields on this path) is gone. A capped export's manifest command now rebuilds a capped core, satisfying the #454 objection.
  2. The documented clamp is reachable. max_fn=_recipe_context_limit is dropped; context_target (parameters.py:1309-1319) declares only min_value=1, manifest_key, DEPLOYMENT scope and a status_label. planning.py:357-363 therefore delivers min(recipe.context, target), so tests/cli/test_planning.py:310-313 (500000 → recipe max) and the rejection at :319-321 (100) are now mutually consistent. The page check at planning.py:186-190 is gated on target <= recipe.context, which is exactly the set of values where prepared_context == target — so it validates the served quantity, not the request. That is a better resolution than the min(...) % page_tokens I asked for, because it leaves an oversized target a documented no-op rather than a rejection.
  3. A cap below the prefill chunk is rejected at export. planning.py:594-597 compares params.prefill_chunk against effective = min(result.context, result.prepared_context). --request-context 2048 with the default 4096 chunk now fails in planning instead of after a full GPU preparation with Helios refusing to load (helios/src/scheduler.rs:66-77 via model/catalog.rs:42).

Also done: the status_label (:1318) so the cap appears in the printed Select GPUs. line, serve.py:67-70 using prepared_context for max_body_bytes with the hint conditional on the cap being active, the --help wording at help.py:46 (not opened) ("max … can lower this"), both universal-field enumerations (docs/cli-design.md:449, docs/preparation-development.md:18 (not opened)), and the owner rows (cli-design.md:468, :1436).

Should fix before merge

  1. The new test calls the real source_identity(). tests/cli/test_planning.py:295 accepts monkeypatch and never uses it, but :323 reaches rebuild_manifest.from_plan, which calls source_identity() (rebuild_manifest.py:327) — hashing ignition, flashinfer and heliopause, and requiring find_spec("flashinfer") to succeed (source_identity.py:39-41). Both sibling tests patch it (:223, :333). In a CPU-only test environment this turns a pure planning test into an environment-dependent one. → One line: monkeypatch.setattr("ignition.preparation.source_identity.source_identity", lambda: "test-source").
  2. Nothing pins the seam that actually changes the core. Revert bootstrap.py:132 to plan.recipe.context and the new test still passes: :301-313 assert the accessor, :324-329 assert the manifest. → Two assertions in the pattern of tests/cli/test_commands.py:150-155: BasePreparationConfig(**common_preparation_kwargs(capped, …)).context == 131072, and the same for the stock plan.
  3. The one new safety check has no test. planning.py:594-597 was added this round and is untested. → One pytest.raises(UsageError, match="prefill-chunk-size") with context_target=2048 and the fixture's 4096 chunk, beside :315-321.
  4. docs/cli-design.md:468 under-documents the cap. It should say the cap also lowers the default output allowance (max_new_tokens defaults to max_sequence_tokens, helios/src/server/config.rs:210-213) and must be at least the prefill chunk. Both are real constraints a user will hit.
  5. Evidence is mode-scoped. Under the default --kv-cache-limit memory, page_ceiling returns Ok(None) (helios/src/runtime_core/memory.rs:290-292) and pages fill free VRAM, so the VRAM table holds only with --kv-cache-limit context|concurrency. The commands used it; the claim does not say so. Put the condition on the claim, and add the case only this flag can produce: a request between cap and recipe max rejected by the capped core and accepted by stock, plus a smaller max_model_len in /v1/models (helios/src/server/models.rs:81).
  6. planning.py:320-321 — demand_pages still uses recipe.context, so the printed/to_dict KV demand overstates the very number this flag lowers (only consumer is :407).
  7. status_label prints the raw target: an oversized --request-context 500000 reports "request context 500,000 tokens" while the core serves 262,144.
  8. Description: "Helios's fit_context applies min(context, prepared_context)" is backwards — the min is Ignition's; fit_context (helios/src/model.rs:261-273) clamps to pages × page_tokens. And to_dict (planning.py:379-416) still carries context/checkpoint_context with no prepared_context, so a capped export differs in reporting only by context_target.

Charter mapping

Bottom line

Worth merging. The design is right, general and a no-op by default, and every defect that could produce a wrong or unloadable core is fixed. Merge after (1) the missing source_identity patch, (2) two seam assertions, (3) one pytest.raises for the prefill-chunk bound, and (4) the two constraint sentences in docs/cli-design.md:468. Items 5–8 are one revision of the description plus a line each; none justify holding the change.

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. pytest tests/cli/test_planning.py tests/cli/test_commands.py settles items 1–3 in one command.

Full report · Notes Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.

Conventions

Verdict: should-fix issues only Blocking:

The change otherwise follows the established shape: one optional base RecipeParameters field, auto-generated CLI/manifest plumbing, one Plan accessor in the existing min(value, capacity) property idiom, one preparation seam (bootstrap.py:132), no per-model branch and no Helios change (charter line 12). The earlier blockers on this PR (unreachable oversized clamp, --request-context missing from reproduction_args, absent page/prefill bounds and status_label, stale doc enumerations, unconditional context_hint) are fixed at head e6239855 and are not re-reported. Open questions: no CI ran at this head, so pytest tests/cli/test_planning.py is unverified; and whether a static multiple_of would be safe depends on whether any real recipe's adjust_page_tokens (parameters.py:571-575) changes the page size — which argues for the in-validate fix.

Full report · Notes

Simplicity

Verdict: should-fix issues only Blocking:

Lens D (simplicity) at head e6239855, 8 files +79/−10. The shape is right: one universal field, one accessor, one consumer seam. Prior-pass blockers are resolved — max_fn was dropped from context_target so min(recipe.context, target) (planning.py:363) is live, --request-context is emitted at parameters.py:1484-1485, and the prefill bound uses min(result.context, result.prepared_context) (planning.py:594-596). Nothing was executed (no CI on the head commit); pytest tests/cli/test_planning.py -k request_context would settle the test finding.

Six subtractions remain, each with a smaller version: the redundant manifest_key (parameters.py:1316) and scope (:1317) both hit documented defaults; the three-clause clamp re-derivation at planning.py:186-190 reduces to one condition on prepared_context; serve.py:68-70 duplicates a shared hint prefix; cli-design.md:468 repeats a clause copied verbatim from :469; and the two hand-maintained field enumerations in docs both had to be edited and now wrap awkwardly. Load-bearing and not to be cut: the target is None early return (planning.py:361-362), the bench check at planning.py:212, serve.py:67, and bootstrap.py:132.

Full report · Notes

Prose

Verdict: should-fix issues only

Blocking:

Should fix:

Nits: 8 — parameters.py:1319/help.py:46 (not opened) help has no floor and an internal term ("page token count"); docs/cli-design.md:468 copies the re-export clause from :469 verbatim; "recipe maximum context" (:468, :1436) vs "prepared context ceiling" (:1486) is one quantity in three spellings; docs/preparation-development.md:19 strands lock_gpu_clocks,; description table says 192k/128k while the command uses 196608/131072; "Total VRAM (GB)" is undefined (per GPU? nvidia-smi? allocator?); parameters.py:1318 status label prints the requested cap rather than the clamped plan.prepared_context.

Link: https://github.com/NVIDIA/hyperflare-inference/pull/533

Detail: all three earlier blockers are fixed at head e623985 and must not be re-raised — above-maximum caps clamp (ignition/parameters.py:1309-1320, planning.py:186-190, 357-363), --request-context is emitted in reproduction_args (parameters.py:1484-1485), and the prefill-chunk guard compares against min(result.context, result.prepared_context) (planning.py:594-597). Checked clean: the docs' context-limit rows and both universal-field enumerations, bootstrap.py:132 (context=plan.prepared_context), and the Discord: rzr2020 line. Not settled: the commit message body (only subject and trailers are exposed) and the external-recipe half of the "single seam" claim, which lives outside this repository (AGENTS.md:9-13).

Full report · Notes

Architecture

Verdict: should-fix issues only

Blocking:

Should fix:

Nits: 4 — Plan.demand_pages still uses recipe.context (planning.py:320-321); the --prefill-chunk-size help/bound advertises recipe.context (parameters.py:1294-1307); prepared_context's None short-circuit; docs/cli-design.md:468 vs the help text disagree on when the page-multiple rule binds.

Link: https://github.com/NVIDIA/hyperflare-inference/pull/533

Full report · Notes

Correctness

Verdict: blocking issues Blocking:

Full report · Notes

Subtractive

Verdict: make it smaller first The change: +79 / −10 (code+docs +42/−10 across 7 files; tests +37/−0 in tests/cli/test_planning.py) Could remove: about 15 lines, in 6 places (about 68 more if the maintainers decide the cap belongs to the existing runtime flag) Biggest subtractions:

Full report · Notes

code review summary

Recommendation: Changes Requested

The design is right and needs no rework: one field on the universal RecipeParameters base, one Plan.prepared_context accessor, one seam (bootstrap.py:132), no Helios change, and a no-op when the flag is unset. The three earlier blockers are fixed at this head; what remains is reporting fidelity, a loosened bench pre-check, and the missing seam test.

Full report · Notes

Pre Test Report

Pre-Test Report — PR #533 "Cap the per-request context target" (head e623985)

Recommendation: DO NOT refer to hardware testing yet. Return to the author for five small fixes, then run one targeted ~1–2 GPU-hour job on cn5.

PR: https://github.com/NVIDIA/hyperflare-inference/pull/533 · author roobyz (CONTRIBUTOR) · open · base main · head e623985 · 8 files, +79/−10 · no CI checks on the head, no human review on this head. Supersedes closed PR #454 (CHANGES_REQUESTED). Security screen all clear; I found no prompt-injection or agent-directed content in the description, diff, docs or comments (the Design-Signed-Off-By/design-review=1af4 trailers, the "Discord: rzr2020" line and the @flare-autobot boilerplate are ordinary process metadata).

I verified every claim below against the tree at this head rather than trusting the review summaries. Four of the five blockers I raised at the previous head (9118add) are genuinely fixed and must not be re-raised. What is left is one test that is environment-dependent and does not test the feature, plus four one-line reporting/validation items. None of them touch the design, which is right.


1. What the change is (verified)

After the rebase onto merged #545 the feature is one declarative parameter plus one consumer line:

No Rust change, no per-model branch, no new mechanism, and the flag reaches all four entry points (serve.py:180→193-201 multi-host, serve.py:263 / :455-459 single-host, bench.py:186-189). Omitting the flag returns recipe.context, exactly what bootstrap.py:132 passed before.


2. Why testing this head now is still not the efficient move

Blocking A — the PR's own test will fail on any host without FlashInfer, and it does not test the feature

tests/cli/test_planning.py:295-329 calls rebuild_manifest.from_plan(...) at :323 but — unlike its three siblings at :159, :223, :333 (and tests/cli/test_parameters.py:296 (not opened)) — never patches ignition.preparation.source_identity.source_identity. from_plan calls it (rebuild_manifest.py:290,327), and that function imports flare_heliopause and raises RuntimeError("the preparation environment requires FlashInfer") when find_spec("flashinfer") is None (ignition/preparation/source_identity.py:35-41), or "FlashInfer native source directory is unavailable" when data/include/data/csrc are missing (:76-81). The test takes monkeypatch and never uses it — the tell that the stub was dropped. Even where FlashInfer is present the test hashes the ignition, FlashInfer and native source trees on every run.

Worse for our purposes: the test asserts nothing about the line that makes the cap real. Revert bootstrap.py:132 to plan.recipe.context and every assertion at :301-329 still passes — the accessor, the errors, the manifest and the reproduction args are all still correct while the exported core is built for the wrong context. Per AGENTS.md:194-199 ("Tests must exercise the affected behavior or contract") that is the missing coverage, not a nit.

Fix (small): add the one-line monkeypatch.setattr(...), and replace the arithmetic assertions with two seam assertions in the existing house pattern (tests/cli/test_commands.py:150-153):

assert BasePreparationConfig(**common_preparation_kwargs(capped, compile_forwards=True,
        kernel_cache=None, retain_graphs=False)).context == 131072
assert BasePreparationConfig(**common_preparation_kwargs(stock_plan, ...)).context == recipe.context

plus one pytest.raises(UsageError, match="prefill-chunk-size") for context_target=2048 with the fixture's 4096 chunk — the new safety check at planning.py:594-597 is currently untested.

Blocking B — the printed plan reports a context the core does not serve

status_label is invoked with the raw field value (parameters.py:1558), so --request-context 500000 on a 262,144-token recipe prints request context 500,000 tokens in the "Select GPUs" line (serve.py:260-274) while PreparedContext clamps to 262,144. AGENTS.md:452-456 requires the plan, its printed report and its recorded measurements to describe what was prepared. status_parts (parameters.py:1541-1563) has the ParameterContext, so the clamp is available there. One-line fix; keep the raw request visible in the manifest.

Blocking C — the served extent is absent from the plan JSON

Plan.to_dict (planning.py:379-416) emits context (pool-bound), checkpoint_context and context_target (via param_dict) but never prepared_context. That dict is printed by export (serve.py:206) and bench (bench.py:194) and folded into the bench record (bench.py:263-266). Without it, a test engineer cannot tell from the artifact whether the cap took effect — which is precisely the question a hardware run is supposed to answer.

Blocking D — the bench bound got looser on the uncapped path

planning.py:212 changed from selection.required_context > self.context to > self.prepared_context. Uncapped, prepared_context == recipe.context while context == min(recipe.context, tokens) (:352-355), so on any memory-constrained host (tokens < recipe.context) the check now admits bench selections the prepared core cannot serve, and they fail only after model download, autotuning and graph capture at ignition/bench/runner.py:388. Fix: min(self.context, self.prepared_context), the same shape as planning.py:594.

Together A–D mean a GPU run now would be spent on an artifact whose own suite is not green and whose output cannot demonstrate the feature. That is exactly the hardware time we should not spend. Fixes are ~10 lines.

Should fix while the author is in the file (not test-blocking)


3. Expected value of a hardware test: low now, moderate-to-good after A–D

The capability is real and is not duplicated by any runtime flag. --kv-cache-limit context|concurrency and --memory-limit shape the KV pool at load (helios/src/runtime_core/memory.rs:238-331); neither can lower max_sequence_tokens or the advertised max_model_len, both baked from prepared_sequence_tokens at load (config.rs:131-148, server/models.rs:81 (not opened)). Prepared-and-honestly-advertised shorter context is an export-time decision and this is the smallest seam for it. I disagree with the subtractive lens's "drop the flag, --kv-cache-limit already does this": the overlap objection is about the evidence, not the capability.

But the evidence does not isolate this PR. page_ceiling returns Ok(None) for the default KvCacheLimit::Memory (memory.rs:290-292; default memory per docs/cli-design.md:740 (not opened)), and export-side page sizing is untouched (planning.py:471-479 fits pages from host free memory; demand_pages still uses recipe.context). So the author's 16 GB table, measured with --kv-cache-limit concurrency, largely re-measures the existing runtime flag. What only this flag buys must be measured, not re-confirmed, and that is what the plan below does.

Not testable on our fleet regardless: --ranks > 1 needs a second host (cn5 is four GPUs on one host, cn7 a single GB10). It must be pinned GPU-free. Reachability also depends on the external hyperflare-recipes mapping BasePreparationConfig.context → max_sequence_tokens; the author states recipe updates are still pending, so any hardware run should confirm the model under test actually honours it (step 1 below does).


4. Test plan — adopt only after A–D are fixed and the GPU-free suite is green

Deliberately minimal: this is a memory-sizing and admission-ceiling knob with no throughput claim, so no A/B perf sweep.

Phase 0 — GPU-free, no hardware time

pytest tests/cli/test_planning.py tests/cli/test_commands.py tests/cli/test_parameters.py (not opened), with:

Phase 1 — the cap reaches the core (1 GPU of cn5; SM120 matches the author's card)

Model: nvidia/GLM-5.3-Flash-NVFP4. Two exports from the same command, differing only in the flag; one GPU, not four (the change is orthogonal to parallelism except through page size).

  1. /v1/models → max_model_len is 131072 on A, the recipe maximum on B. The one assertion only the export-side value can satisfy.
  2. A prompt just over 131k tokens is rejected at admission on A; a prompt just under is accepted and generates.
  3. flare inspect A shows the cap and its reproduction command re-exports a 131072 core (validates the recording path).
  4. Falsification control: --request-context 100000 (not page-aligned) fails at planning with an actionable message, not at core load with Helios's opaque "invalid prepared model configuration" (helios/src/model/catalog.rs:50-57,70).

Phase 2 — the isolating VRAM comparison the PR owes

At concurrency 1 and 4, record total VRAM for A and B under both --kv-cache-limit memory (default) and --kv-cache-limit concurrency. The pair separates this PR from the runtime flag. Expect ~0 delta under memory — that is the honest result and must be reported as such, not as a failure.

Phase 3 — regression (cheap, same job)

A pre-PR core still loads and serves unchanged; a no-flag export at this head produces the same preparation config as main (the no-op path); --request-context is still absent from flare run.

Budget / efficiency

~2 exports + ~6 serve starts on a single cn5 GPU ≈ 1–2 GPU-hours, one model, one host. Skip cn7 (no ARM64-specific question). Skip multi-host (no second host — pinned GPU-free in Phase 0). No throughput A/B.


5. Bottom line for the referral decision

Full report · Notes Decision to Test: no (100%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.

screen malicious

Screen Result: All Clear

Evidence: Read the full diff of PR #533 (8 files, +91/−28: ignition/parameters.py, ignition/planning.py, ignition/cli/serve.py, ignition/cli/help.py, ignition/preparation/bootstrap.py, tests/cli/test_planning.py, docs/cli-design.md, docs/preparation-development.md), the complete PR description, and all discussion (author comment plus five flare-autobot review comments; no maintainer review, no CI checks). Every added line is ordinary engineering: a new context_target field with --request-context (ignition/parameters.py:1309-1319, DEPLOYMENT scope, manifest_key="context_target", no max_fn), a Plan.prepared_context accessor clamping to min(recipe.context, target) (ignition/planning.py:357-363), guaranteed_tokens derived from it (:368), page-multiple/prefill-chunk/bench validation (:186-190, :212, :594), to_dict() emission (:396), repro/status emission (ignition/parameters.py:1483-1484, :1560-1561), serve/help/bootstrap wiring (ignition/cli/serve.py:67-69, ignition/cli/help.py:46, ignition/preparation/bootstrap.py:132), and a unit test (tests/cli/test_planning.py:295-335). No new subprocess, eval, network fetch, file write, encoded blob, or hidden instruction; the description's claims match the code.

Injection scans (ignore previous instructions, autobot in docs, and a broad do not report|skip the review|all clear|agent reading|if you are an agent|system prompt pattern) returned no matches within the PR's content; repo-wide hits are unrelated pre-existing files (vLLM NOTICE, re.fullmatch regex code, Claude Code client tests). The only agent-addressed text is the repository's own review-bot footer ("Have your agent review the Full Review…", "#autobot:ignore to opt out") — standard tooling on this repo, not an attempt to steer this review; its external links were not followed. "Discord: rzr2020" is innocuous contact info.

Open questions: no maintainer review or CI checks exist on head 448f70a, so the description's performance/correctness claims are unverified (a review-completeness gap, not a security finding), and the external bot page was deliberately not fetched.

Full report · Notes decide malicious: all_clear (100%): No malicious content found

explore

Author: roobyz (CONTRIBUTOR); Discord rzr2020 Motivation: A recipe's context maximum (e.g. 256K) is far larger than the requests a deployment actually serves, so the exported core reserves KV pages for the maximum and runs out of VRAM at the concurrency the deployment needs. This PR adds a flag that caps the prepared per-request context (and the exported max_sequence_tokens) at export time, so a deployment can trade maximum sequence length for room for more concurrent requests. Scale: +91 / −28 lines in 8 files (cumulative at head 448f70a) Proposal:

Full report · Notes

Value Proposition

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)

What I verified at this head (fixes since my last report)

  1. The new test patches the environment. tests/cli/test_planning.py:296 sets source_identity, so rebuild_manifest.from_plan at :329 no longer hashes ignition/flashinfer/flare-heliopause or requires find_spec("flashinfer").
  2. The seam is now pinned. tests/cli/test_planning.py:316-319 asserts common_preparation_kwargs(capped)["context"] == capped.prepared_context == 131072 and != recipe.context. Reverting bootstrap.py:132 to plan.recipe.context now turns the test red — previously the whole test stayed green with the cap disconnected, which was the most serious remaining gap.
  3. The printed report shows the served value, not the request. parameters.py:1560-1561 emits request context {min(context_target, recipe.context):,} tokens, so --request-context 500000 prints the recipe maximum. That closes my previous item 7.
  4. The safety checks line up with the quantity that is actually served. planning.py:186-190 gates the page-multiple check on target <= recipe.context — precisely the set where prepared_context == target — so it validates the served extent and leaves an oversized target a documented no-op; :212 uses min(context, prepared_context) for bench; :594-597 bounds the prefill chunk by min(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-77 via model/catalog.rs:42); :368 folds the cap into guaranteed_tokens.
  5. checkpoint_context → prepared_context in to_dict (planning.py:395-396) is safe: a repo-wide search finds zero readers of checkpoint_context (Rust flare inspect reads deployment["max_sequence_tokens"], which now carries the capped value through the core itself).
  6. The description now scopes its evidence to --kv-cache-limit concurrency and states that under the default memory mode the cap buys admission control only, and the fit_context sentence 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)

  1. The one new safety check has no test. planning.py:594-597 is untested. The fixture's chunk is 4096 (tests/cli/test_planning.py:120), so one pytest.raises(UsageError, match="prefill-chunk-size") with context_target=2048, beside :321-327, covers it.
  2. docs/cli-design.md:458 under-documents two constraints a user will hit: the cap must be at least --prefill-chunk-size, and it also lowers the default output allowance because max_new_tokens defaults to max_sequence_tokens (helios/src/server/config.rs:210-213). One clause each.
  3. parameters.py:1318 help contradicts the check: it says the value "must be a multiple of the page token count" unconditionally, while planning.py:187 only 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.
  4. planning.py:320-321 — demand_pages still uses recipe.context, so the KV demand printed into the plan JSON overstates exactly the number this flag lowers. Use prepared_context (sole consumer is to_dict at :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.

Full report · Notes Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.

Conventions

Verdict: should-fix issues only

Blocking:

Should fix:

Nits: 4 — hand-rolled if context_target is not None status line in RecipeParameters.status_parts instead of the status_label mechanism (parameters.py:98, :1554-1559); min(target, recipe.context) computed in three places (planning.py:362-363, parameters.py:1561, planning.py:594); redundant manifest_key/scope restating defaults (parameters.py:1316-1317); page-alignment documented in --help but not in the docs flag row while --prefill-chunk-size's row does document its alignment (docs/cli-design.md:457-458); one stale prose flag enumeration in docs/direct-execution.md:53-57.

Link: https://github.com/NVIDIA/hyperflare-inference/pull/533

Full report · Notes

Prose

Verdict: should-fix issues only

Blocking:

Should fix:

Nits: 8 — parameters.py:1318 help ("page token count", rule stated unconditionally, no floor below --prefill-chunk-size), help.py:46 no floor, cli-design.md:458 verbatim re-export clause copied from --mixed-prefill, one ceiling spelled three ways (:458/:1426/:1476), long reflowed line at cli-design.md:450-451, unnamed GraphOperation groups at preparation-development.md:17-19, unguarded context.recipe at parameters.py:1561, and two description phrasings ("expected pool", per-slot numbers being concurrency-1 totals).

Link: https://github.com/NVIDIA/hyperflare-inference/pull/533

Full report · Notes

Architecture

Verdict: clean (nits only)

Blocking:

Should fix:

Nits:

Everything my earlier reports raised is fixed at this head and was re-checked in code, not inferred from the description: the target is validated/clamped properly (no max_fn, min() at planning.py:357-363, alignment gated at :186-190), the prefill-chunk and bench bounds use the cap (:594-597, :212), --request-context reaches the manifest and reproduction_args (parameters.py:1483-1484, :1316-1317), the printed report now names the clamped value (parameters.py:1560-1561 via serve.py:271), and the seam is tested (tests/cli/test_planning.py:316-319).

Scope and layering fit the charter and AGENTS.md: one optional field on the universal RecipeParameters base with generated CLI/manifest/repro plumbing, one Plan accessor, one consumer line at bootstrap.py:132, DEPLOYMENT scope matching the prefill_chunk precedent, no Helios change, no per-model branch, no env toggle, and omission returns recipe.context byte-equivalently to main. The evidence caveat is now stated in the description: the VRAM savings hold only under the non-default --kv-cache-limit concurrency; under the default memory mode page_ceiling returns Ok(None) (helios/src/runtime_core/memory.rs:284-331), so the cap is admission control only.

Limits: nothing was executed (head 448f70a has no CI checks); the source-level claims are settled by pytest tests/cli/test_planning.py. The measured table cannot be re-derived here, and whether default-mode pools gain any headroom is unmeasured.

Link: https://github.com/NVIDIA/hyperflare-inference/pull/533

Full report · Notes

Simplicity

Verdict: should-fix issues only Blocking:

Shape is right and needs no rework: one universal field, one accessor Plan.prepared_context, one seam in bootstrap.py, Plan.context deliberately left stock, no Helios change. The blockers from earlier passes are gone, and this head deletes both hand-maintained field enumerations from the docs in favour of a pointer to ignition/parameters.py. Load-bearing lines not to cut are listed in the full report. Nothing was executed (no CI on the head commit); pytest tests/cli/test_planning.py -k request_context settles the should-fix.

Full report · Notes

Correctness

Verdict: should-fix issues only Blocking:

All four defects from earlier heads are fixed at 448f70a7 and were re-verified rather than repeated: the new test stubs source_identity (test_planning.py:296); the bench bound is min(self.context, self.prepared_context) (planning.py:212); to_dict emits prepared_context (planning.py:396); status_parts prints the clamped value (parameters.py:1561); the prefill-chunk bound uses min(result.context, result.prepared_context) (planning.py:594-597); and --request-context is emitted in reproduction_args (parameters.py:1483-1484).

Verified clean: the no-flag path is identical to main (prepared_context returns recipe.context); the clamp branch is reachable and page-aligned because the check is gated on target <= recipe.context; the manifest key passes Helios's validate_key and is never interpreted; Helios's fit_context clamps at serve time so a cap above the pool only shrinks the artifact; the admission rejection and context_hint the docs claim exist do exist (helios/src/model/admission.rs:150 (not opened), server/request.rs:350 (not opened), serve.py:68-70); max_body_bytes stays under the 256 MB ceiling; and common_preparation_kwargs is the single seam every recipe receives.

Untested (not broken): chunk-vs-cap rejection, the multi-host --ranks path with a cap, and a recipe actually consuming config.context. Open: whether any external recipe overrides adjust_page_tokens, and whether dropping checkpoint_context from to_dict breaks a downstream consumer.

Full report · Notes

Subtractive

Verdict: make it smaller first The change: +91 / −28 (code+docs +48/−28 across 7 files; tests +43/−0) Could remove: ~17 lines (18 with the redundant plan-JSON key), in 7 places, plus ~20 duplicated words Biggest subtractions:

Full report · Notes

code review summary

Recommendation: Changes Requested

The design is right and needs no rework: one field on the universal RecipeParameters base, one Plan.prepared_context accessor, one seam (bootstrap.py:132), no Helios change, and a no-op when the flag is unset. Earlier blockers are all fixed at this head; what remains is reporting fidelity in the plan record and the wording of the page-alignment rule.

See the Full Review for file:line citations and suggested changes.

Full report · Notes

Pre Test Report

Pre-Test Report — PR #533 "Cap the per-request context target" (head 448f70a)

Recommendation: REFER TO HARDWARE TESTING — narrowly, and after two one-line reporting fixes and a green GPU-free suite.

PR: https://github.com/NVIDIA/hyperflare-inference/pull/533 · author roobyz (CONTRIBUTOR) · open · base main · head 448f70a · 8 files, +91/−28 · no CI checks on the head, no human review at this head. Supersedes closed PR #454 (CHANGES_REQUESTED). Security screen all clear; I found no prompt-injection or agent-directed content in the description, diff, docs or comments (the Design-Signed-Off-By/design-review=1af4 trailers, the Discord: rzr2020 line and the @flare-autobot boilerplate are ordinary process metadata; the bot's #autobot:ignore opt-out line was not treated as an instruction).

This reverses my recommendation at the two previous heads. At e623985 and again at 9118add I recommended no referral. I re-verified every one of those blockers against the tree at 448f70a, and all four are genuinely fixed in code, not merely claimed in the description. What remains is reporting fidelity and help wording — no behaviour change, no unloadable core, no silently dropped flag. That is the first head at which hardware time buys information instead of confirming known defects.


1. What the change is (verified at 448f70a)

Verified fixed since my last report — do not re-raise: test env + seam pin (tests/cli/test_planning.py:296, :318); clamped status line; prepared_context in to_dict; pool-aware bench bound. I also read the new test's arithmetic against the fixture (:139-142, context=262144, page_tokens=64) and all five of its cases should pass: 131072 caps, 500000 clamps (page check correctly skipped above the max), 0 trips min_value, 100 trips the page check, and the manifest round-trip matches. Claims in several review summaries that "the test cannot pass" describe older heads (de1b5b5, 02023eba, 9118add), and the recurring claim that "reverting bootstrap.py:132 leaves the test green" is false at this head — :318 is a chained comparison, so kwargs["context"] == 131072 fails on a revert.


2. Should fix before the run (two one-liners, reporting only)

Neither blocks merge on correctness grounds; both matter because they are what a test engineer reads to decide whether the cap took effect.

  1. ignition/planning.py:320-321 — demand_pages still uses the uncapped recipe max, and it is printed at :407 inside the same plan JSON that now carries prepared_context. With a cap the KV demand row is ~2× the served extent — the exact number this PR exists to lower, in the artifact used to explain the VRAM result. Sole consumer is to_dict; use prepared_context.
  2. ignition/planning.py:396 — to_dict replaces main's checkpoint_context key with prepared_context instead of adding. No in-repo reader (search_code checkpoint_context → no matches), so it is reporting fidelity only, but the plan record then cannot state the recipe's declared maximum and the served extent at once. Emit both.

Everything else is nits and should not hold hardware time: the page-multiple rule is hand-written in __post_init__ rather than ParamSpec.multiple_of/RecipeParameters.validate and its message omits the for {alias} clause every sibling flag error carries (parameters.py:520,531,539); the help says "must be a multiple of the page token count" unconditionally though planning.py:187 skips the check above the recipe maximum; parameters.py:1561 dereferences context.recipe without the None guard used at :1268-1269; and the pre-existing --prefill-chunk-size bound still advertises recipe.context (parameters.py:1301) while the plan now rejects above min(context, prepared_context) (planning.py:594-597).


3. Expected value of the hardware test

The capability is real and no runtime flag duplicates it. --kv-cache-limit context|concurrency and --memory-limit shape the KV pool (helios/src/runtime_core/memory.rs:238-331 (not opened)). Neither can lower the exported max_sequence_tokens or the advertised max_model_len, both baked from prepared_sequence_tokens at export/load (config.rs:131-148, server/models.rs:81). Honest under-capacity advertising is an export-time decision, and bootstrap.py:132 is the smallest seam that reaches it.

But the PR's own VRAM table does not isolate this PR. page_ceiling returns Ok(None) for the default KvCacheLimit::Memory, and the author's commands all used --kv-cache-limit concurrency. Export-side page sizing is untouched. So the headline 16 GB largely re-measures an existing runtime flag — which the description now concedes. The high-value test is not VRAM; it is the admission ceiling and the advertised max_model_len, which only this flag can produce. The plan below weights accordingly and reports the default-mode VRAM delta honestly even if it is ~0.

Reachability depends on code outside this repository. Recipes live in local-inference-lab/hyperflare-recipes (AGENTS.md:379-384) and the author states recipe updates are still pending. Step 1 of Phase 1 is therefore a reachability gate: if max_model_len does not move, the correct conclusion is "blocked on external recipe", not "PR broken".

Not testable on our fleet at all: --ranks > 1 needs a second host with a rendezvous address. cn5 is four GPUs on one host; cn7 is a single GB10. Multi-host must be pinned GPU-free.


4. Test plan (minimal, one host, one GPU, one model)

Phase 0 — GPU-free, must pass before any hardware booking (zero GPU time). pytest tests/cli/test_planning.py tests/cli/test_commands.py (not opened) tests/cli/test_parameters.py (not opened) — this head has never run in CI, so a green run is itself the first result. Add: common_preparation_kwargs(...)["context"] == 131072 capped and == recipe.context unset through BasePreparationConfig(**kwargs) (the seam is asserted as a dict at :318, not as a constructed config); one pytest.raises(UsageError, match="prefill-chunk-size") for context_target=2048 with the fixture's 4096 chunk — planning.py:594-597 is a new safety check with no test; reproduction_args contains --request-context 131072; manifest context_target present with DEPLOYMENT scope; flag present on export/bench/debug-serve and absent from flare run; and a --ranks 2 plan carrying the cap (the only available pin for multi-host). Also run the two one-liners from §2 and re-run.

Phase 1 — the cap reaches the core (1 GPU of cn5, not 4; SM120 matches the author's card). Model: nvidia/GLM-5.3-Flash-NVFP4 (cached on cn5; GLM uses 256-token pages per docs/core-design.md:1480). Read the recipe maximum from MODEL --help and choose N = half that, rounded down to a page multiple. Two exports from the same command differing only in the flag: A --request-context N, B unset.

  1. Reachability gate: /v1/models → max_model_len is N on A. On B expect min(recipe max, pages × page_tokens) (Helios's fit_context clamps at load, so B may legitimately read below the recipe max on 96 GiB). If A does not move, stop and report "external recipe does not forward context".
  2. A prompt just over N tokens is rejected at admission on A with the context error; a prompt just under is accepted and generates. This is the one assertion no runtime flag can satisfy.
  3. flare inspect A shows the capped extent and its reproduction command re-exports N.
  4. Falsification control: an unaligned N (e.g. 130000 on a 256-token page) fails at planning with an actionable message, not at core load with Helios's opaque "invalid prepared model configuration" (catalog.rs:50-57,70).

Phase 2 — the isolating VRAM comparison, at concurrency 1 and 4, for A and B, under both --kv-cache-limit memory (default) and --kv-cache-limit concurrency. The A/B × kv-limit pairing is what separates this export-time flag from the runtime flag. Under memory the delta may be ~0 — report that as the result, not as a failure.

Phase 3 — regression, same job. A pre-PR core still loads and serves unchanged; a no-flag export at this head yields the same preparation config as main (prepared_context returns recipe.context, exactly what bootstrap.py:132 passed before); --request-context still absent from flare run.

Budget and efficiency. 2 exports + ~6 serve starts on a single cn5 GPU ≈ 1–2 GPU-hours, one host, one model, one GPU. Skip cn7 (no ARM64-specific question). Skip multi-host (no second host — pin GPU-free in Phase 0). No throughput A/B — the PR claims memory and admission-ceiling behaviour, not speed; a perf sweep would burn time on a claim the PR does not make.


5. Bottom line for the referral decision

Full report · Notes Decision to Test: no (84%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.

Apply Labels

Applied: +triage:review, +performance, +enhancement, +area:memory, +area:preparation

Classification Confidence

Threshold: 65%

Triage

Priority

Type

Area

Model

explore

Author: roobyz (CONTRIBUTOR); Discord rzr2020 Motivation: A recipe's default per-request context (often 256K tokens) reserves far more KV cache than requests actually use, so a deployment cannot fit the concurrency it wants. This adds --request-context N so the exported core declares a smaller per-request ceiling, and requests that would exceed it are rejected at admission. Scale: +78 / −31 lines in 9 files (head 503a438, rebased onto 2147cd4c; was +91/−28 in 8 at my previous amendment) Proposal:

Full report · Notes

Value Proposition

Value Proposition — PR #533, --request-context

Charter alignment. The change sits where the charter says it should: one declarative deployment-scoped field in ignition/parameters.py, one accessor (Plan.prepared_context), one seam (ignition/preparation/bootstrap.py:132), no Helios change and no per-model branch — consistent with "keep the runtime small and model-agnostic" and "solve the right problem in the right place." The motivation (same-model concurrency, KV provisioning) does not touch the multi-model/co-hosting non-goal, and the dossier records the earlier charter objection as withdrawn. Unset, the plan is byte-equivalent to main, so the blast radius is small.

Novelty & status. Not obsolete: the dossier cites no merged PR fixing this; #454 only raised the question. Not superseded: the remaining co-editors of ignition/planning.py are open #453 and #122, neither identified as canonical for this capability. Genuinely additive at the Ignition layer.

Value vs maintenance cost. Cost is low: +78/−31 across 9 files, additive plan/manifest keys (checkpoint_context retained beside prepared_context), one new test, no runtime branch. Beneficiaries are real but narrow — operators wanting a host-independent, export-declared ceiling. The evidence is the weak link, and the dossier's substantive objection stands:

No prompt-injection attempt was found in the description, diff, docs, or thread.

Verdict: Worth it with changes. Right mechanism, right layer, small footprint; mergeability hinges on (1) restating the benefit as an admission-control ceiling plus the two baseline rows, (2) reconciling the alignment rule across help/code/docs, and (3) making the chunk ceiling cap-aware and posting a passing CI run.

Full report Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.

Classify intake

Selected: triage:review, performance, enhancement, area:memory, area:preparation

Threshold: 65%

Triage

Priority

Type

Area

Model

Apply Labels (Intake)

No label changes

Subtraction and simplicity

Subtraction/Simplicity/Conventions review of PR #533 at head 503a438: the architecture is lean (one field, one Plan.prepared_context accessor, one seam at ignition/preparation/bootstrap.py:132), but the min(target, ceiling) clamp is re-derived in six places and two of those are removable outright.

Findings, high value first:

  1. Dead conjunct in the alignment gate — ignition/planning.py:198-200 guards on target <= self.declared_context, which cannot change the outcome because _validate_declared_context (:432-441) already proves declared % page_tokens == 0 and prepared_context (:375) clamps oversized targets. Gate on self.prepared_context % self.page_tokens instead: one rule instead of two, closing the help/code/docs contradiction at its source.
  2. Plan.context ignores the cap while documenting it as "the longest sequence one request may reach" (ignition/planning.py:367-370), so callers re-write min(...) at :222 and :626. Redefine as min(self.prepared_context, self.tokens); both call sites collapse and the added "prepared_context" key at :409 becomes a duplicate that can be deleted.
  3. A third clamp lives in RecipeParameters.status_parts (ignition/parameters.py:1606-1607) computed from a different base (context.recipe.context, wrong under any adjust_context hook) than the plan report; delete it, or use the existing status_label mechanism (:105, :707-720). Same family: un-branch context_hint (ignition/cli/serve.py:73-74).
  4. ignition/cli/help.py:46 duplicates the flag's own page-size rule in a 200-character line; revert to the short original. Likewise revert the --request-context insertion into the hand-maintained flag list at docs/direct-execution.md:54-56 — the enumeration this PR deletes elsewhere.
  5. Rename context_target → request_context (ignition/parameters.py:1344) so flag, plan JSON and manifest key agree (5 source lines, 6 test lines).

Explicitly lean and worth keeping: the single accessor, the single seam, the cap-aware bench/demand_pages guards, and the docs paragraphs that replaced inline flag enumerations with a pointer to RecipeParameters.

Open: whether three JSON keys are wanted, and whether the manifest key name difference is intentional; no execution evidence exists at any head, so everything above is a static read.

Full report · Notes

Correctness and contracts

Reviewed PR #533 at head 503a438 (cap --request-context). The design is sound — one declarative field, one Plan.prepared_context accessor, one preparation seam, cap-aware bench/chunk guards and reporting, no Helios change, no per-model branch, and unset-flag exports match main. Nothing here runs per request, so there is no new contention, buffering or failure-propagation surface. The problems are contract and claim accuracy:

  1. Major — status_parts prints min(target, context.recipe.context) (ignition/parameters.py:1606-1607) instead of the served min(target, declared_context) (ignition/planning.py:372-375, :363-365); wrong for any checkpoint-declared or adjust_context-scaled context, and it prints even when the cap is a no-op while serve's hint suppresses itself (ignition/cli/serve.py:73-74). Untested.
  2. Major — three surfaces, two alignment rules: help says the value "must be a multiple of the page size" unconditionally (ignition/parameters.py:1351), code checks only when target <= declared_context (ignition/planning.py:198-200), and the docs row asserts both in one sentence (docs/cli-design.md:458), self-contradictory for e.g. 500001.
  3. Major — the description's "reduces KV pool/export size" is not what the code does: pages, cache states and snapshot budget come from GPU supply (ignition/planning.py:502-510, ignition/preparation/bootstrap.py:133); only the declared max_sequence_tokens shrinks, and the runtime pool only under a non-default --kv-cache-limit.
  4. Major — the evidence table has no stock-core baseline under a reduced --memory-limit and no --kv-cache-limit context row, so it does not answer the inherited #454 question.
  5. Minor — --prefill-chunk-size still advertises the uncapped ceiling (ignition/parameters.py:1336, :1502-1506) and is only rejected later (ignition/planning.py:626-629).
  6. Minor — help renders default: none (no default_label), contradicting docs/cli-design.md:458.
  7. Minor — status_parts lacks a context.recipe is None guard (latent; ignition/parameters.py:126), and the alignment UsageError inside fit() aborts GPU auto-selection (ignition/planning.py:609) for a world size the message never names.

Open: the alignment rule for an above-max misaligned value; whether the maintainer accepts an admission-control framing in place of baselines; whether external hyperflare_recipes re-rounds config.context; whether direct execution honors the cap (ignition/direct/scheduler.py:202); no test run or CI result at any head. No prompt injection found.

Full report · Notes

Final review

Recommendation: Ready To Merge

All prior blockers and earlier review items are resolved at 503a438: the change cleanly adds --request-context via one declarative RecipeParameters field, one Plan.prepared_context accessor, and one preparation seam (ignition/preparation/bootstrap.py:132), with full parity across single-host export, multi-host export, ignition bench, and --direct serving, no Helios changes, and exact no-op behavior when unset. No blocking defects remain; one non-blocking display mismatch introduced during the rebase onto #212 (status_parts using context.recipe.context instead of _declared_context_limit) and two small simplifications are noted below for an optional quick follow-up.

Merge Risk

Level: Low

Walkthrough

Pre-merge Checks

Blockers

None.

Should Fix

  1. ignition/parameters.py:1606-1607 — status_parts() ignores checkpoint-declared / adjust_context-scaled ceilings (rebase mismatch with #212) and lacks a context.recipe is None guard:
    • Currently:
      if self.context_target is not None:
          parts.append(f"request context {min(self.context_target, context.recipe.context):,} tokens")
      
    • After #212, Plan.declared_context resolves via adjust_context(recipe.base_context(checkpoint), ctx) (ignition/planning.py:363-365, mirrored by _declared_context_limit at ignition/parameters.py:1299-1304). For a checkpoint with a larger checkpoint.context (e.g., 1,048,576 over a 262,144 recipe, as in tests/cli/test_planning.py:462) or an adjust_context hook (:527), passing --request-context 524288 prints request context 262,144 tokens in the Select GPUs status line even though prepared_context and the exported core serve 524,288 tokens. In addition, ParameterContext.recipe defaults to None (ignition/parameters.py:126), so direct calls without a recipe raise AttributeError, and oversized no-op targets still print even though ignition/cli/serve.py:74 suppresses the cap hint when inactive.
    • Fix: Reuse _declared_context_limit(self, ctx) and only emit when the cap is active (or recipe is absent):
      if self.context_target is not None:
          declared = _declared_context_limit(self, ctx)
          if declared is None or self.context_target < declared:
              parts.append(f"request context {self.context_target:,} tokens")
      

Subtract / Simplify

  1. ignition/planning.py:368-370, :222, :626-629 — make Plan.context cap-aware (return min(self.prepared_context, self.tokens)):
    • Plan.context is documented as "The longest sequence one request may reach", yet currently ignores prepared_context (min(self.declared_context, self.tokens)), forcing both guards at :222 and :626 to repeat min(context, prepared_context) and causing Plan.to_dict()["context"] (:407) to report the uncapped context even when --request-context is active. Changing :370 to return min(self.prepared_context, self.tokens) removes both min(...) wrappers and the effective local while keeping "prepared_context" in to_dict() (which remains distinct from "context" whenever self.tokens < self.prepared_context).
  2. ignition/planning.py:198-200 — check self.prepared_context % self.page_tokens directly:
    • Replace if target is not None and target <= self.declared_context and target % self.page_tokens: with if target is not None and self.prepared_context % self.page_tokens: (formatting self.prepared_context in the message). Keeps the target is not None guard so an unset flag never emits a --request-context error, drops the redundant range comparison, and validates the exact value passed to common_preparation_kwargs and Helios (helios/src/model/catalog.rs:48-55).

Nits

Dropped on verification

Full report

Classify triage

Selected: triage:review

Threshold: 65%

Triage

Apply labels

No label changes Decision to Test: yes (89%): Testing will add considerable value with the code. It is ready to merge and the tests will validate and improve confidence on hardware we have available for testing.

Pre Test Report

Hardware Test Plan — PR #533 "Cap the per-request context target" (head 503a438)

Verdict: refer to hardware testing, narrowly — ~2–4 GPU-hours on ONE GPU of cn5. Skip cn7. Skip multi-host.

PR #533 adds --request-context N, an export-time cap on the prepared per-request context. It is a memory-sizing and admission-ceiling change with no speed claim, so this plan deliberately contains no throughput A/B. Two things are worth GPU time and nothing else is: (1) does the cap actually reach the exported core (max_sequence_tokens, advertised max_model_len, admission enforcement), and (2) does it buy VRAM that the default --kv-cache-limit memory mode does not already give. Item 2 may honestly measure ~0 — report that, don't hide it.


1. What the code guarantees (verified at 503a438, so you can predict the result)

Fact Citation
Plan.prepared_context = declared_context when unset, else min(declared, N) ignition/planning.py:373-375
declared_context = adjust_context(recipe.base_context(checkpoint), …) (checkpoint/#212-aware) planning.py:363-365, :432-441
The single seam into every recipe/core: "context": plan.prepared_context ignition/preparation/bootstrap.py:132 (BasePreparationConfig.context, default 262144 at :33)
It becomes the served ceiling and is advertised helios/src/server/config.rs:131,148 → max_sequence_tokens; /v1/models max_model_len at helios/src/server/models.rs:99
Served ceiling is then clamped to physical pages helios/src/model.rs:263-275 (fit_context)
Over-cap request → HTTP 400, before any prefill work, message names the ceiling helios/src/server/request.rs:577-587; code context_length_exceeded at helios/src/server.rs:743 (not opened)
Cap also lowers the default output limit (max_new_tokens defaults to max_sequence_tokens) helios/src/server/config.rs:210-213
Misaligned in-range N rejected at planning; above-max N silently clamps planning.py:198-200, :373-375
Prefill chunk must be ≤ served context (export-time rejection) planning.py:626-629
Cap recorded in plan JSON / manifest / repro args / serve hint planning.py:407-409, ignition/parameters.py:1529-1530, ignition/cli/serve.py:69-74
Page sizes: Qwen 64, GLM 256, DeepSeek 128 tokens docs/core-design.md:1480
Default runtime mode ignores the cap for pool sizing (page_ceiling → None for KvCacheLimit::Memory) helios/src/runtime_core/memory.rs:314-316; default memory per docs/cli-design.md:733

Two known head-of-branch defects that can corrupt your reading if you trust the wrong surface (both non-blocking, already reported in the final review):


2. Hardware targeting

Model: nvidia/GLM-5.3-Flash-NVFP4 (cached on cn5; GLM-5.3 Flash is the model the repo's own examples qualify, docs/model-preparation.md:318, docs/multi-host.md:340). Page size 256 → N must be a multiple of 256.

Preflight before booking the GPU (5 min, no GPU):

df -h ~ /tmp; du -sh ~/.cache/flare/cores ~/.cache/huggingface/hub

A cn5 job gets only 16 GiB scratch. A checkpoint + core for a GLM-class model can exceed that; point paths.core_cache, paths.export_staging, and paths.hub_cache in ~/.config/flare/config.toml (not opened) at a larger writable volume, or the run dies mid-export and burns the booking.


3. Phase 0 — GPU-free, must be green first (zero GPU time)

The head has no CI. Its own new test is tests/cli/test_planning.py:298-329 (stubs source_identity, asserts the bootstrap seam, both rejections, manifest uint_value, repro args). Run:

.venv/bin/python -m pytest tests/cli/test_planning.py tests/cli/test_parameters.py (not opened) tests/cli/test_commands.py (not opened) -q

Then confirm, all GPU-free because planning precedes download (ignition/cli/serve.py:264-290) and derive() (ignition/cli/preparation.py:62-81):

.venv/bin/ignition export glm-5.3-flash-nvfp4 --gpus 0 --request-context 100000 --verbose   # expect UsageError "--request-context 100,000 … is not a multiple of the 256-token page size" (planning.py:198-200)
.venv/bin/ignition export glm-5.3-flash-nvfp4 --gpus 0 --request-context 2048 --verbose      # expect UsageError "--prefill-chunk-size 4,096 exceeds the 2,048-token context" (planning.py:626-629)
.venv/bin/ignition export glm-5.3-flash-nvfp4 --help | grep -A2 request-context              # flag present; note the "Context: X tokens max (page size: 256)" line (help.py:46)
flare-cli/target/release/flare run --help | grep request-context || echo "absent on flare run (correct)"

Record the declared maximum X from that --help line. Set N = largest multiple of 256 ≤ X/2 (e.g. X=262144 → N=131072). Do not hardcode N anywhere below.

Gate: if any of these fail, stop — a GPU run would test code that cannot plan.


4. Phase 1 — does the cap reach the core? (the only genuinely new capability; ~2 exports)

Two exports from the same command, differing only in the flag. A = capped, B = stock.

# A
.venv/bin/ignition export glm-5.3-flash-nvfp4 --gpus 0 --max-concurrency 4 --request-context $N 2> a-plan.json (not opened) | tee a-export.txt
# B  (skip only if `flare models list` already holds a stock core for this alias+TP: then reuse it)
.venv/bin/ignition export glm-5.3-flash-nvfp4 --gpus 0 --max-concurrency 4                 2> b-plan.json (not opened) | tee b-export.txt

A1 — the artifact (no serving needed). From a-plan.json (not opened) / b-plan.json (not opened):

python - <<'PY'
import json
for f in ("a-plan.json (not opened)","b-plan.json (not opened)"):
    p=json.load(open(f))["plan"]
    print(f, {k:p[k] for k in ("context","checkpoint_context","prepared_context","tokens","page_tokens","guaranteed_tokens","demand_pages")})
PY

PASS: A prepared_context == $N; B prepared_context == checkpoint_context (the declared max); demand_pages == 4 × prepared_context/page_tokens in each (planning.py:331 — this is the KV-demand number the PR exists to lower).

A2 — the exported core. flare inspect <A entry>:

flare-cli/target/release/flare inspect CACHE_ENTRY_A --json | grep -m1 max_sequence_tokens

PASS: max_sequence_tokens == $N on A, declared max on B; and A's printed reproduction command contains --request-context $N (ignition/parameters.py:1529-1530 → flare-cli/src/inspect.rs:454). This is the reproducibility claim from the closed #454.

A3 — the reachability gate (stop condition). Serve A and B and compare the advertised ceiling:

flare-cli/target/release/flare run CACHE_ENTRY_A --gpus 0 --max-concurrency 4 --kv-cache-limit concurrency &
curl -s localhost:8000/v1/models | python -c 'import json,sys; d=json.load(sys.stdin)["data"][0]; print(d["max_model_len"], d["model_info"]["flare"]["context_length"])'

PASS: A reports exactly $N. B: expect ≥ N and ≤ declared max — not necessarily the recipe max, because Helios narrows the served ceiling to pages × page_tokens at load (helios/src/model.rs:263-275). The pass condition is A == N and B > N, not "B == recipe max". FAIL here = "the external hyperflare_recipes recipe does not forward BasePreparationConfig.context" — the seam is outside this repo (AGENTS.md:379-396 (not opened)). Stop and report that; do not keep spending GPU time.


5. Phase 2 — admission ceiling, cheap (no long generation)

The 400 is produced from prompt + max_tokens > max_sequence_tokens before any prefill work (request.rs:577-587), so this costs seconds, not minutes. Calibrate the prompt with the CPU-side counter (docs/api.md:13):

curl -s localhost:8000/v1/messages/count_tokens -d '{"model":"…","messages":[{"role":"user","content":"<~1k token text>"}]}'

Then, against A and B:

# accepted on both (a few tokens of generation, then cancel)
curl -s localhost:8000/v1/chat/completions -d '{"model":"…","messages":[{"role":"user","content":"<~1k>"}],"max_tokens":4000}' | head -c 200
# rejected on A only
curl -s -w '\n%{http_code}\n' localhost:8000/v1/chat/completions -d '{"model":"…","messages":[{"role":"user","content":"<~1k>"}],"max_tokens":200000}'

PASS on A: HTTP 400, code: context_length_exceeded, message prompt of P tokens plus an output limit of O tokens exceeds this server's context of $N tokens, and the body carries the context is limited by … the --request-context cap hint (ignition/cli/serve.py:73-74 → helios/src/server/http.rs:57-68). Same request on B (stock) must be accepted — that comparison is the assertion no runtime flag can reproduce, since --kv-cache-limit/--memory-limit cannot lower max_sequence_tokens.

Also record "default output limit" from flare inspect on A vs B: it should drop with the cap (config.rs:210-213) — a real user-visible side effect worth one line in the report.


6. Phase 3 — the isolating VRAM comparison (A/B × kv-limit mode; ~4 serve starts)

At --max-concurrency 4, for A and B, under both pool modes:

for core in A B; do for mode in memory concurrency; do
  flare-cli/target/release/flare run $core --gpus 0 --max-concurrency 4 --kv-cache-limit $mode &
  sleep 45   # after load settles
  nvidia-smi --query-gpu=memory.used --format=csv,noheader -i 0
  curl -s 'localhost:8000/metrics?format=json' | python -c 'import json,sys; m=json.load(sys.stdin); print({k:m.get(k) for k in ("total_kv_pages","free_kv_pages","cached_kv_pages")})'
  kill %1
done; done

Read total_kv_pages as the primary number (helios/src/server/metrics.rs:1388), with nvidia-smi memory.used as corroboration.

Expected, and this is the honest framing:


7. Phase 4 — regression (same job, ~10 min)

  1. No-op path: from b-plan.json (not opened), prepared_context == checkpoint_context and the core loads and serves identically to a main-built core of the same alias/TP. If a pre-PR core is already cached, just flare run it — it must still load (helios/src/model/catalog.rs:42-69).
  2. Bench record: ignition bench … --request-context $N writes configuration.preparation including the cap (ignition/cli/bench.py:263-266); one run, no tuning sweep, just confirm two different caps produce different records.
  3. --direct parity (optional, 1 run): ignition debug-serve … --direct --request-context $N, then curl /v1/models — served ceiling should be $N (the cap reaches direct execution via config["max_sequence_tokens"], ignition/direct/scheduler.py:202). Cheap confirmation, and it is the one path not covered by the added test.

8. Budget, skip list, stop conditions

Item Cost
Preflight + Phase 0 (GPU-free) ~20 min CPU
Phase 1 (one export ≈ 30–60 min on one Blackwell; skip export B if a stock core is cached) 1–2 GPU-h
Phase 2 (admission probes) ~10 min
Phase 3 (4 serve starts) ~45 min
Phase 4 (regression) ~20 min
Total ≈2–4 GPU-hours, 1 GPU of cn5, 1 model, 1 host

Skip: cn7 (no ARM64 question), multi-host --ranks>1 (no second host — Phase 0 pins it), any throughput or latency sweep (the PR makes no speed claim), any full-context decoding test (Phase 2 replaces it), autotune-effort sweeps.

Stop and report instead of continuing if: Phase 0 fails; the preflight shows <~25 GiB writable scratch for export; Phase 1 A3 shows max_model_len does not move (external-recipe gap); or Phase 1 A2 shows --request-context missing from the reproduction command.


9. What to bring back

  1. prepared_context / demand_pages for A vs B (plan JSON).
  2. flare inspect context + reproduction command for A.
  3. /v1/models max_model_len for A and B, with the < N / > N comparison.
  4. The exact 400 body + code + context_hint for A, and B accepting the same request.
  5. total_kv_pages and nvidia-smi memory.used for the 2×2 grid (core A/B × memory/concurrency), including the honest memory-mode delta.
  6. Any mismatch between the Select GPUs status line and prepared_context (expected: the known display bug at ignition/parameters.py:1606-1607) — worth reporting as confirmation, not a new blocker.
  7. Whether the external recipe actually forwarded the cap (item 3) — the single fact that decides whether this feature ships working.

Full report · Notes

Discord Test Request

Deliverable — Discord post (copy from here)

Recommendation: Test

High confidence — worth GPU time, but narrowly scoped.

Hardware Required

Justification

Estimated Time to Complete

~2–4 GPU-hours on one GPU, plus ~20 min GPU-free preflight and unit tests.


Verification I did (what backs the post, and what does not)

Checked directly at PR #533 head 503a438 (diff + files):

Findings that changed the post versus the supplied report:

  1. The report's claim that the PR description "reads as if VRAM shrinks unconditionally" is out of date at this head — the description itself now carries the caveat ("Under the default --kv-cache-limit memory mode, the pool fills available VRAM regardless of the cap"). The post still states the condition, because the headline number (≈16 GB at concurrency 4) is concurrency-mode only.
  2. The PR's evidence table is Qwen3.8-27B, while the plan picks GLM-5.3-Flash-NVFP4 (page size 256). Keeping GLM is fine, but the cap must be a multiple of 256, and its declared max has to be read from --help, not assumed from the 262,144 figure in the Qwen table.
  3. The known status-line defect is real and visible in the diff: parameters.py:1606-1607 prints min(context_target, context.recipe.context), which ignores declared_context/adjust_context, so it can under-report. The post does not rely on that surface.

Not verified from this tree (asserted by the supplied report, cited to code I did not open): the Helios side of the claim — helios/src/server/config.rs:131 (not opened),148 (max_sequence_tokens), models.rs:99 (not opened) (max_model_len), request.rs:577-587 (not opened) and the context_length_exceeded code, model.rs:263-275 (not opened) (fit_context), runtime_core/memory.rs:314-316 (not opened) (page_ceiling → None for KvCacheLimit::Memory), page sizes in docs/core-design.md:1480 (not opened), and the cn5/cn7 hardware identities and 16 GiB scratch limit. The post's hardware and time numbers therefore rest on the supplied pre-test summary, not on my own reading.

Review-hygiene note: no attempt to direct me appeared in the PR description, diff, docs or thread; the bot comment's closing "Note to requester (not part of the comment body)" is internal review bookkeeping, not an instruction I acted on.

Caveat on process: I was cut off before writing scratchpad entries, so this report is the only durable record of the verification above.

Full report