Correctness report · NVIDIA/hyperflare-inference #533

Raw Markdown for agents: https://autobot.eidonix.com/p/bc1b8a6a-8cb4-4eb0-8acd-49b1735cbdb6.md

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

The three blockers raised at earlier heads are fixed at this head: max_fn=_recipe_context_limit is gone, so Plan.prepared_context's clamp branch is live (planning.py:360-363); --request-context is hand-emitted in RecipeParameters.reproduction_args (parameters.py:1484-1485) ahead of the base-class-field skip (parameters.py:1492-1496); the prefill-chunk bound uses min(result.context, result.prepared_context) (planning.py:594-597); and multi-host _export_hosts resolves parameters from args so the flag now reaches plan(). One blocking defect remains, in the PR's own new test, plus one behaviour regression and two reporting gaps I can show in the code.

Key findings

Blocking — the PR's new test fails without FlashInfer. tests/cli/test_planning.py:295-329 calls rebuild_manifest.from_plan(...) (line 323) but never stubs source_identity. from_plan calls source_identity() (ignition/preparation/rebuild_manifest.py:290 import, :327 use), which imports flare_heliopause and raises RuntimeError("the preparation environment requires FlashInfer") when FlashInfer is absent (ignition/preparation/source_identity.py:39-41), or RuntimeError("FlashInfer native source directory is unavailable…") when its native sources are missing (source_identity.py:78-81). Every sibling test that reaches from_plan stubs it — test_planning.py:159, :223, :333 and tests/cli/test_parameters.py:296 (not opened) all do monkeypatch.setattr("ignition.preparation.source_identity.source_identity", lambda: "test-source"). The new test even takes monkeypatch as an argument and never uses it, which is the tell that the stub was dropped. The head has no CI checks, so this was not observed. Fix: add the identical one-line monkeypatch.setattr at the top of the test.

Should fix — the bench context check got looser on the uncapped path. It was selection.required_context > self.context; it is now > self.prepared_context (planning.py:212). With no cap, prepared_context returns recipe.context (planning.py:361-362) while context is min(recipe.context, tokens) (planning.py:353-355). So whenever the KV pool cannot hold the full recipe context — the common memory-constrained case this PR targets — the new bound is strictly higher than before and a bench --contexts selection above the pool-derived context now passes planning and only fails after model download, tuning and graph capture, at ignition/bench/runner.py:388 ("benchmark case exceeds prepared capacities"). Fix: compare against min(self.context, self.prepared_context), the same shape the chunk check already uses at planning.py:594.

Should fix — the served context is still missing from Plan.to_dict(). to_dict reports "context": self.context (stock, pool-derived) and "checkpoint_context": self.recipe.context (planning.py:395-396) but never prepared_context, so the {"plan": …} JSON printed by export and bench cannot show the value actually exported as max_sequence_tokens; only the raw target appears, via parameters.to_dict.

Should fix — status_label prints the raw target, not the effective context. status_label=lambda v: f"request context {v:,} tokens" if v else None (parameters.py:1318) is rendered by status_parts (parameters.py:1555-1560) into the "Select GPUs" line. With --request-context 500000 on a 262144-context recipe it prints "request context 500,000 tokens" while the served context is 262,144.

Details, nits and the verified-clean list follow.


Blocking

1. tests/cli/test_planning.py:295-329 — new test calls from_plan without stubbing source_identity.

Should fix

2. ignition/planning.py:212 — bench required-context check regressed for uncapped plans.

3. ignition/planning.py:395-396 — to_dict() records no served context.

4. ignition/parameters.py:1318 — status label shows the raw target instead of the effective context.

Nits

Verified clean (through this lens)

Open questions / what only a run can settle

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