Correctness report · NVIDIA/hyperflare-inference #533

Raw Markdown for agents: https://autobot.eidonix.com/p/7d577928-4fcc-44b3-9c45-d6d3e84f2d8c.md

Correctness review — PR #533 "Cap the per-request context", head 448f70a7

Key findings

Verdict: should fix — no blocking defects remain at this head.

Every defect I raised against earlier heads is fixed and re-verified in the code at 448f70a7, not merely claimed in the description:

  1. The new test no longer raises without FlashInfer — tests/cli/test_planning.py:296 stubs source_identity, like the neighbouring tests at :159/:223/:339.
  2. The bench check is now pool-aware — ignition/planning.py:212 compares against min(self.context, self.prepared_context), so an uncapped, pool-limited plan keeps main's bound and does not defer failure to ignition/bench/runner.py:388 (not opened).
  3. The printed plan reports the served extent — ignition/planning.py:396 emits "prepared_context": self.prepared_context beside "context", so the {"plan": …} printed by ignition/cli/serve.py:206, :435 and bench.py:194 shows what is exported as max_sequence_tokens.
  4. The status line shows the clamped value — ignition/parameters.py:1560-1561 prints min(self.context_target, context.recipe.context), matching Plan.prepared_context (planning.py:358-363), so --request-context 500000 on a 262,144-token recipe reports 262,144.
  5. The prefill-chunk bound uses the cap — planning.py:594-597 rejects a chunk above min(result.context, result.prepared_context) at export rather than leaving Helios to refuse the core at load time.
  6. The cap is reproduced — --request-context is hand-emitted in RecipeParameters.reproduction_args (parameters.py:1483-1484) ahead of the base-class-field skip (:1491-1495), so rebuild_manifest.reproduction_arguments carries it.

What remains is one should-fix about where the page-alignment rule is enforced and described, plus four nits and three untested paths listed below.

The lens found nothing else wrong: the uncapped path is behaviour-identical to main, the clamp branch is reachable and aligned, the manifest/reproduction plumbing composes, the Helios contract the export must satisfy is met, and the admission consequence the docs claim exists does exist.


Should fix

1. ignition/parameters.py:1318 and ignition/cli/help.py:46 — the page size named to the user is not the page size the check uses, and the check fires only after model resolution and GPU discovery.


Nits

a. ignition/parameters.py:1560-1561 — status_parts dereferences context.recipe without a None guard. Every other label in that loop reads only the field value (spec.status_label(getattr(self, dc_field.name)), parameters.py:1557), and ParameterContext.recipe defaults to None (parameters.py:119). No current caller passes a recipe-less context — the only call is serve.py:271 with plan.parameter_context (planning.py:224-232) — but status_parts is documented as a general Plan hook (docs/preparation-development.md:30-34) and is trivially callable as RecipeParameters().status_parts(ParameterContext()) in a test. Guard with context.recipe is not None.

b. ignition/planning.py:320-321 — demand_pages still uses the uncapped demand, and is printed. demand_pages = self.concurrency * (self.recipe.context // self.page_tokens) and it reaches the plan report at to_dict (planning.py:407). A capped plan's printed demand_pages overstates by concurrency * (recipe.context - prepared_context) / page_tokens — exactly the quantity the PR's VRAM table measures. demand_pages has no consumer other than to_dict, so self.prepared_context // self.page_tokens would describe what was prepared. This bears on AGENTS.md:452-456: an advanced flag must be "carried through the plan into the recipe's PreparationConfig, so the plan, its printed report, and its recorded measurements describe what was prepared" — the report is now half-right (prepared_context right, demand_pages wrong).

c. tests/cli/test_planning.py:302-314 — most assertions restate inputs and defaults. context_target is None, capped.parameters.context_target == 131072, oversized.parameters.context_target == 500000 and stock_plan.context == min(recipe.context, stock_plan.tokens) restate what was just passed in or what main already returns. The semantically loaded assertions are :309, :314 and :318-319.

d. tests/cli/test_planning.py:335 — the manifest assertion checks scope, not value. _preparation_value writes non-negative ints to uint_value (ignition/preparation/rebuild_manifest.py:270-274), so by_key["context_target"].value.uint_value == 131072 would catch a wrongly recorded cap; today only the enum is compared.


Untested paths (state as unverified, not as broken)


Verified clean through this lens


Open questions / could not verify by reading alone

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