#2 [high] S1 (high): collapse filter_gpus into pre_context; reverts the candidates() hunk to the existing one-liner
=== Evidence at head ===
ignition/planning.py:576-577 filter_gpus = chosen if chosen is not None else supported plan_sizes = params.filter_world_sizes(world_sizes, replace(pre_context, gpus=filter_gpus))
ignition/planning.py:611-613 candidate_sizes = candidate_params.filter_world_sizes( world_sizes, replace(pre_context, root=candidate_params, gpus=filter_gpus) )
The 3-line wrap at 611-613 exists only because this PR added the extra gpus= argument; on main (and before this diff) it was the single line
candidate_sizes = candidate_params.filter_world_sizes(world_sizes, replace(pre_context, root=candidate_params))
=== Why the collapse is safe ===
params.validate(pre_context) at ignition/planning.py:563 is the only use of pre_context BEFORE the GPUs are resolved (the author deliberately keeps it gpus-free). After :566-575 the only uses are :577, :585 and :611-613. So pre_context can be rebound once with the resolved GPUs and both later call sites simplify.
chosen is None iff selected is None (ignition/planning.py:567, 572), so the expression is a straight two-way choice.
=== Proposed === Replace :576-577 with pre_context = replace(pre_context, gpus=chosen if chosen is not None else supported) plan_sizes = params.filter_world_sizes(world_sizes, pre_context) and replace :611-613 with the existing one-liner candidate_sizes = candidate_params.filter_world_sizes(world_sizes, replace(pre_context, root=candidate_params))
Effects: filter_gpus variable deleted; gpus=filter_gpus no longer duplicated at two sites; the candidates() hunk disappears from the diff entirely (the PR then touches one filter call site instead of two); net −2 lines.
Optional follow-on: with pre_context.gpus already == chosen in the explicit branch, ignition/planning.py:585
params.validate(replace(pre_context, gpus=chosen, world_size=len(chosen)))
becomes replace(pre_context, world_size=len(chosen)). Keeping gpus=chosen explicit is defensible; author's call.
=== Optional nesting reduction in the same block ===
Current :567-575 nests the bounds check and the architecture loop inside if selected is not None:. Flatter, guard-clause form:
chosen = None if selected is None else tuple(gpus[index] for index in selected)
if selected is not None and any(index >= len(gpus) for index in selected):
raise UsageError(...)
if rejected := next((gpu for gpu in chosen or () if not gpu.supported), None):
raise CapacityError(f"GPU {rejected.index} ({rejected.name}) is not an {SUPPORTED_ARCHITECTURES} device")
Removes one nesting level and the 3-line for/if loop; walrus is already used in this file (:646 larger := automatic(size)). Present as optional, not required.
#5 [high] Research summary
Subtraction / Simplicity / Conventions lens on PR #635. Verdict: the diff is lean and idiomatic — no new flags, config knobs, env vars, fallbacks, or speculative abstraction, and no logic duplicating an existing repo helper (format_gpus, _shortfall, SUPPORTED_ARCHITECTURES, gpu.supported are all reused; .supported appears nowhere else in ignition/; filter_world_sizes overrides exist only in tests). Two worthwhile simplifications, both in the new code, plus one low-value prose note.
Correction to the dossier first: head has moved to 3c3c4df9 (newest commit, Jonathan Gutierrez). Dossier amendment A5 ("the author's claimed edits are absent") is superseded — the tuple construction, the hoisted architecture check, filter_gpus in candidates(), the extended docstring, the _recipe()/_gpu() reuse and the SM90 explicit case are all present at head, matching the PR description. A5 should not be cited as an open item.
S1 (high) — filter_gpus is one value spelled at two call sites; collapsing it removes the variable, a line, and an entire hunk. ignition/planning.py:576-577 defines filter_gpus = chosen if chosen is not None else supported and spends it on replace(pre_context, gpus=filter_gpus); ignition/planning.py:611-613 respells the same gpus=filter_gpus inside a 3-line wrap that exists only because of the added argument (it was a one-liner before this PR). params.validate(pre_context) at :563 is the only use of pre_context before the GPUs are resolved, so rebinding it once — pre_context = replace(pre_context, gpus=chosen if chosen is not None else supported) — lets :577 take pre_context directly and returns :611-613 to its pre-PR form candidate_params.filter_world_sizes(world_sizes, replace(pre_context, root=candidate_params)). Result: variable gone, duplication gone, net −2 lines, and the PR touches one filter call site instead of two. Purely mechanical; semantics identical. Optional follow-ons: :585 can drop its now-redundant gpus=chosen, and the :567-575 nesting can flatten to guard clauses using the walrus already used at :646.
S2 (medium) — the new test's if any(not gpu.supported ...): return () guard is dead code. At tests/cli/test_planning.py:573-574 the branch is unreachable through planning.plan, the only entry point the test drives: on the automatic path filter_gpus is already filtered to supported GPUs (planning.py:566,576), and on the explicit path the hoisted CapacityError at planning.py:573-575 fires before filter_world_sizes at :577. The test's own SM90 case (test_planning.py:596-599) asserts that CapacityError — i.e. it asserts the branch is not taken. The fall-through return ... if size == 4 already yields () for unsupported GPUs, so deleting the two lines changes nothing observable. Keep the SM90 assertion (it pins the PR's deliberate error-precedence decision); delete only the guard. I explicitly rejected two tempting-but-wrong suggestions: extracting a shared fixture (the inline subclass matches existing precedent, the inline BadContextGroup at tests/cli/test_planning.py:547-556), and reusing ToyShardingParameters (:62-115), whose filter_world_sizes ignores context.gpus and so cannot express the behavior under test.
S3 (low, no action needed) — the hook contract landed in a docstring. docs/preparation-development.md:32-36 lists the RecipeParameters hooks but was not updated; the contract instead went into ignition/parameters.py:560-565, which is present-state, history-free prose and satisfies repo-prose/SKILL.md:26-29. Only substantive nit: the docstring documents context.world_size is None, which is true at every call site, so the world_size half documents a constant a recipe cannot act on. One clause at most; not worth a new document.
#6 [high] Clean-diff verification (negative findings) — what the lens checked and found nothing to flag
=== Nothing added that needs subtracting (checked at head 3c3c4df9) ===
- No new CLI flag, argparse field, config key, or environment variable in the diff. Diff is confined to ignition/parameters.py (+5 −1), ignition/planning.py (+13 −9), tests/cli/test_planning.py (+35 −0) per
pr_files. The PR description's claim "without changing RecipeParameters signatures" holds:filter_world_sizes(self, world_sizes, context)signature is byte-identical to main (ignition/parameters.py:560). - No new public API, wrapper function, or injection point. The change is entirely inside the existing one-shot
plan()(ignition/planning.py:543-651) plus one loop: the recipe hook's visibility is what changes, not the surface. - No dead code left behind by the deletion side of the diff: the moved architecture check does not survive in its old position (ignition/planning.py:587-589 region now ends at the
elif len(supported) < plan_sizes[0]branch, :590-591), so there is no duplicated check to clean up. - No fallback branch, no speculative generality, no compatibility shim.
filter_gpusis the only new local, and it is genuinely consumed twice (hence entry #2's dedupe, not a speculative knob). - Existing helpers reused rather than re-rolled:
format_gpus(ignition/planning.py:164-168),_shortfall(:513),SUPPORTED_ARCHITECTURES(:38),SUPPORTED_CAPABILITIES(:37),Gpu.supportedproperty (:51-53),replace().gpu.supportedappears ONLY at ignition/planning.py:566 and :574 in production code (search_code \.supported\b), so the PR is not adding a parallel capability test next to an existing one. filter_world_sizesproduction call sites are exactly two, both insideplan()(:577, :611). No other caller to update, no duplicate filtering path.- Docs prose meets .agents/skills/repo-prose/SKILL.md:26-29 (present-state specification, no chronology, no false definite references, no lifecycle labels). The PR description itself follows AGENTS.md:72-113 four-part order (why / what / benefit / evidence).
=== Material AGENTS.md conventions checked, no structural violation ===
- AGENTS.md:188-193 ("Reject unsupported abstractions and churn"): satisfied — no framework, extension point, fallback layer, or config switch; edits are minimal and directly support the requested behavior. Also: no unsolicited rename/format/annotation sweep; the two simplications proposed in entries #2/#3 are deletions of the new lines themselves.
- AGENTS.md:176-181 (reject architectural violations; "flags, enums, callbacks, optional paths ... cannot bypass boundaries"): the recipe-side
filter_world_sizeshook already existed and is the sanctioned place for recipe policy (docs/preparation-development.md:32-36). The PR keeps model-specific policy OUT of ignition core — no model branch added — which is exactly the charter's "no per-model special cases or flags". - AGENTS.md:165-169 (contribution must address a real defect) and the no-#404 point ("Good ideas in the wrong place will be declined"): the hook is in the right layer. This lens raises no objection; value/authorization is the other lens's call.
- AGENTS.md:194-199 (focused, meaningful validation; "source-text checks and mocks that bypass the behavior cannot establish runtime correctness"): relevant. The new test drives real
planning.planwith syntheticGpudescriptors — it exercises the behavior, not source text. The residual gap (CPU-only, synthetic descriptors, single host) is a validation-strength note for the correctness lens, NOT a convention violation.
#1 [medium] Head state correction: dossier c2ef7974 is stale, head is 3c3c4df9
Verified at head 3c3c4df9 ("Pass candidate GPUs into filter_world_sizes during planning", Jonathan Gutierrez, 2026-11-30) — search_history shows it is the newest commit; the dossier's c2ef7974 is the previous force-push.
pr_files at head: ignition/parameters.py (modified, +5 −1), ignition/planning.py (modified, +13 −9), tests/cli/test_planning.py (modified, +35 −0).
Superseded dossier claims (A5) — now PRESENT at head:
supported = tuple(gpu for gpu in gpus if gpu.supported)is now a tuple (ignition/planning.py:566), not a list.- The architecture check IS hoisted above the filter (ignition/planning.py:573-575), before
filter_world_sizesat :577. filter_gpusis threaded intocandidates()(ignition/planning.py:611-613).- The docstring on
ParameterGroup.filter_world_sizesIS extended (ignition/parameters.py:560-565). - The test now has an unsupported-SM90 explicit case (tests/cli/test_planning.py:596-599).
Still true from A5: the test still builds its own inline Checkpoint/Recipe? No — it now uses _recipe() and _gpu() (tests/cli/test_planning.py:579-587). So A5 is fully superseded; the updated PR description in the task prompt matches head. Do not cite A5 as an open item.
Consequence for the subtraction lens: the chosen/filter_gpus duplication I flag is genuinely at head, and the unreachable test branch at test_planning.py:573-574 is at head.
#3 [medium] S2 (medium): unreachable any(not gpu.supported) branch in the new test's inline hook
tests/cli/test_planning.py:569-577 @dataclass(frozen=True) class CapabilityAwareParams(RecipeParameters): def filter_world_sizes(self, world_sizes: tuple[int, ...], context: ParameterContext) -> tuple[int, ...]: sizes = super().filter_world_sizes(world_sizes, context) if any(not gpu.supported for gpu in context.gpus): return () if context.gpus and all(gpu.capability == (12, 1) for gpu in context.gpus): return tuple(size for size in sizes if size in (3, 4)) return tuple(size for size in sizes if size == 4)
The if any(not gpu.supported ...): return () branch (test_planning.py:573-574) is unreachable through the public entry point planning.plan, which is all the test drives. Proof:
- automatic path:
filter_gpus = supported= only gpus withgpu.supportedTrue (ignition/planning.py:566, 576) →any(not gpu.supported ...)is always False. - explicit path:
filter_gpus = chosen, and the hoisted check at ignition/planning.py:573-575 raisesCapacityErrorBEFOREfilter_world_sizesat :577 → the branch is never reached. The test that "covers" this branch, test_planning.py:596-599, asserts theCapacityError("...not an SM...")raised at :575 — i.e. it asserts the branch is NOT taken.
So the guard is dead code inside the test: it adds a fake third behavior that no assertion can observe. return tuple(size for size in sizes if size == 4) already yields () on unsupported GPUs, so deleting the two lines changes nothing.
Proposed: delete test_planning.py:573-574. Test then reads def filter_world_sizes(self, world_sizes: tuple[int, ...], context: ParameterContext) -> tuple[int, ...]: sizes = super().filter_world_sizes(world_sizes, context) if context.gpus and all(gpu.capability == (12, 1) for gpu in context.gpus): return tuple(size for size in sizes if size in (3, 4)) return tuple(size for size in sizes if size == 4)
Note: the SM90 assertion itself is worth keeping — it pins the PR's stated design decision (hardware CapacityError wins over a parameter UsageError). Value is in the assertion, not the guard. This is subtraction inside a test, not a request to weaken coverage.
Secondary (do NOT propose a new shared fixture): the inline subclass at test_planning.py:569-571 follows existing repo precedent — the inline BadContextGroup/BadContextParams at tests/cli/test_planning.py:547-556 — so an inline class here is idiomatic and should stay. Reusing the module-level ToyShardingParameters (:62-115) is NOT viable: its filter_world_sizes ignores context.gpus, so it cannot express the behavior under test.
#4 [low] S3 (low): the hook contract now lives in a docstring while the hook list doc was left alone
docs/preparation-development.md:32-36 documents the contract the PR extends but was not updated:
- planning.Plan carries the resolved parameters instance directly and
invokes its validate, filter_world_sizes, adjust_weights_bytes,
adjust_rank_costs, adjust_page_tokens, adjust_context,
capacity_relief_options, status_parts, to_dict, manifest_parameters,
and reproduction_args hooks.
The PR adds the substantive hook contract to the docstring instead (ignition/parameters.py:560-565): def filter_world_sizes(self, world_sizes: tuple[int, ...], context: ParameterContext) -> tuple[int, ...]: """Restrict candidate tensor-parallel world sizes during planning.
``context.gpus`` contains the explicitly selected GPUs (when ``--gpus`` is given)
or all supported host GPUs (during automatic planning), and ``context.world_size`` is ``None``.
"""
for _, subgroup in self._subgroups():
Two prose consequences, both small:
(a) The documented guarantee is incomplete in a way a recipe author will hit. world_size is None holds at both plan-time call sites (ignition/planning.py:577, 611-613) but NOT in candidates() for the explicit---gpus path, where candidates() returns early at :609-610 and never calls the filter — so the filter sees gpus but no size. More importantly filter_world_sizes is only ever called with world_size is None, so the world_size half of the sentence documents a constant, and a recipe cannot use the hook to narrow per-size. Worth one clause ("it cannot narrow a size already chosen") or drop the world_size mention.
(b) _tuning_gpus/conftest aside, the substring "auto" vs "automatic planning" is fine. No prose skill violation — the docstring is present-state, no chronology, no false definite reference. Cite .agents/skills/repo-prose/SKILL.md:26-29 (documentation is a present-state specification) as the standard it meets.
Verdict: acceptable as-is; if anything is added, add one clause to the existing bullet in docs/preparation-development.md rather than a new document.