PR #574 — Correctness, Contracts & System-Level Consequences review (head acbab08, +54/−1 in 2 files)
Key findings
- Major — the sibling allowlist was not updated, and its omission is silent.
weight_viewsatignition/preparation/rebuild_manifest.py:365still accepts only('b12x.', 'ignition.')andreturns at:368-369, so ahyperflare_recipes.*object that owns weight tensors contributes nothing torebuild_weights_metadata(:441-459) — not a tensor entry and not anunavailableentry. The PR body discloses the twin list but the runtime consequence (a catalog that looks complete while a subtree is missing) is unguarded and undiagnosed. - Major — widening the predicate silently bypasses each class's own pickle protocol.
_guessPickleris not the only effect:_GuardPickler.reducer_override(ignition/preparation/aot.py:155-166) now routes every non-Modulehyperflare_recipes.*instance through_guard_object=object.__new__(cls)(:98-99) plus__dict__.update(ignition/preparation/forward_metadata.py:164-165), replacing every attribute outside the guard tree with_Missing('unguarded attribute')and never consulting the class's__reduce__/__getstate__/__setstate__, which default pickling previously honoured. That is a superset of the title's "strip unguarded attributes" and is not disclosed. - Major (architecture) — one external repo's module name is hardcoded in core while a caller-declared root mechanism already exists.
forward_metadata.py:42nameshyperflare_recipesinside coreignition, whereasAGENTS.md:395-396requires core not to know about recipe repositories, and the repo already binds declared roots (ignition/preparation/source_identity.py:12-25,ignition/cli/__init__.py:364-370, consumed ataot.py:845-853). Any other external recipe repo passed toignition.cli.main(..., recipes=..., source_roots=...)hits the identicalPicklingError. - Minor — the predicate's two consumers have different gates (
aot.py:157has nohasattr(type(obj), '__getattr__');forward_metadata.py:282does), and the body only claims the guard case even though worker-IPC pickling changes too. - Minor — tests: the new test covers only the guard path; no test covers
_ForwardPickler, no negative test for an unlisted external package, and_RecipeKernelOwner.__module__is mutated outsidemonkeypatch(test_guard_code.py:283). - Minor — claim accuracy: "Verified with
pytest …on ARM64 GB10" is contradicted by the PR's own Caveats ("ran prior to rebasing") and by the head evidence beingpy_compileonly; the cited extraction commit167f22c8is a setup-java CI commit (#570), not #509 (b0d35934). - Sound: the one-line change does fix the reported
PicklingErrorpath; the predicate is pure (no locks, I/O, buffering or allocation added;_GUARD_LOCK/_guard_serializationataot.py:169-179unchanged); no rate/latency/admission metric sampling is touched; no Unix/Windows-specific code is touched; the AST-based core-boundary test is not tripped.
1. Correctness, safety & platform parity
F1 (Major) Widened predicate bypasses the class's own pickle protocol — half-constructed recipe objects
ignition/preparation/aot.py:155-166:
if _uses_custom_object_state(obj):
state = {key: value if id(value) in self.guard_tree_values
else _Missing('unguarded attribute')
for key, value in vars(obj).items()}
from b12x.preparation.device import DetectedDevice
if isinstance(obj, DetectedDevice):
return restore_prepared_device, (type(obj), state)
return _guard_object, (type(obj),), state
return super().reducer_override(obj)
with ignition/preparation/aot.py:98-99:
def _guard_object(cls):
return object.__new__(cls)
and ignition/preparation/forward_metadata.py:164-165:
def _set_state(value, state):
value.__dict__.update(state)
Impact. Before this PR, a hyperflare_recipes.* instance fell through to super().reducer_override(obj) (:166), i.e. stock pickling that calls the class's __reduce__/__getstate__/__setstate__. After it, every such instance is rebuilt by object.__new__ and a __dict__ update, with every attribute not in guard_tree_values replaced by _Missing('unguarded attribute'). Classes that use __slots__, validate/derive state in __setstate__, or reconstruct in __reduce__ (the common way to carry an opaque compiled handle) now deserialize as half-constructed objects or lose state their own reduction would have restored. Because the predicate keys on module string prefix alone (no __getattr__/protocol opt-out, unlike forward_metadata.py:282), this applies to the whole external package, not just to the object that triggered the bug.
Fix. In reducer_override, fall back to super().reducer_override(obj) when the class defines any of __reduce__, __reduce_ex__, __getstate__, __setstate__ — the strip path is only needed for objects that default-pickle their __dict__ wholesale. At minimum, state this trade-off in the PR body and add a regression test with a recipe object that defines __setstate__ asserting its state survives.
F2 (Minor) Two consumers of one predicate, two different scopes
ignition/preparation/aot.py:157 gates on _uses_custom_object_state(obj) alone; ignition/preparation/forward_metadata.py:282-284:
if _uses_custom_object_state(value) and hasattr(type(value), '__getattr__'):
return _object, (type(value),), dict(vars(value)), None, None, _set_state
return NotImplemented
Impact. The body describes only "AOT guard serialization", but the same predicate also governs worker-IPC forward pickling (_ForwardPickler, used by the compile pool). Widening it changes that path too, under a broader condition than the metadata path. Not a defect in itself, but an undisclosed behavioural change, and a future reader cannot tell whether the asymmetry is intentional.
Fix. Either align the gates, or comment both call sites stating why the guard path is deliberately broader; mention the _ForwardPickler effect in the description.
F3 (Minor) Test mutates a class attribute outside monkeypatch
tests/preparation/test_guard_code.py:281-285:
module_name = "hyperflare_recipes.components._synthetic_guard_test"
synthetic = types.ModuleType(module_name)
_RecipeKernelOwner.__module__ = module_name
synthetic._RecipeKernelOwner = _RecipeKernelOwner
monkeypatch.setitem(sys.modules, module_name, synthetic)
Impact. sys.modules is restored, but _RecipeKernelOwner.__module__ is not; the class permanently claims the synthetic module for every later test in the file, while its declared attribute (:258, __module__ = "hyperflare_recipes.components.synthetic") no longer holds. Harmless today, a trap for the next test added to this file. Note also assert loaded.guard_check(forward) is False (:300) where the neighbouring test uses truthiness (:248-249).
Fix. monkeypatch.setattr(_RecipeKernelOwner, "__module__", module_name).
Sound in this area
- The predicate is a pure string prefix comparison (
forward_metadata.py:39-45) — no new locks, no I/O, no allocations, no caching, no state across resets;_guard_serialization's_GUARD_LOCK(aot.py:169-179) is unchanged, so no new contention or head-of-line blocking is introduced. - No metric/rate/admission sampling (
inbound_rate,estimated_seconds,worth_fetching) is touched anywhere in the diff, so the metric-span check does not apply here. - No platform-specific (Unix/Windows) path is touched.
_NON_OBJECT_NEW_TYPES(forward_metadata.py:33-36) still exempts tensors, Modules, enums and builtin containers, so the widening cannot capture PyTorch containers.
2. Unintended system-level consequences
F4 (Major) The sibling allowlist diverges; weight subtrees are dropped without a diagnostic
ignition/preparation/rebuild_manifest.py:365-369:
elif type(value).__module__.startswith(('b12x.', 'ignition.')) and hasattr(value, '__dict__'):
owner = f'{type(value).__module__}.{type(value).__qualname__}'
children = ((f'.{key}', child) for key, child in vars(value).items())
else:
return
and the only place an omission can surface, ignition/preparation/rebuild_manifest.py:448-453:
tensors, unavailable = [], []
for name, owner, tensor in weight_views(roots):
if (tensor.device.type == 'meta' or tensor.layout != torch.strided or not tensor.numel()
or any(stride < 0 for stride in tensor.stride())):
unavailable.append(name)
continue
Impact. unavailable can only receive names that weight_views actually yielded. Since walk returns at :369 when it meets a hyperflare_recipes.* owner, the tensors under it are yielded neither as catalog entries nor as unavailable — the exported rebuild_weights catalog (runtime_core.py:135 and :431-433) simply does not mention them, and validate_weights (rebuild_manifest.py:462-491) validates only what is present, so nothing fails. After this PR the same objects are guard-picklable and exportable while their weight views remain invisible: the fix moves the export one step further and into a silently incomplete catalog rather than a loud crash.
Caveat for adjudication: this omission is pre-existing and is disclosed in the PR body; it is not a regression introduced by the diff. What this PR changes is that the divergence is now reachable on the same objects it declares supported.
Fix. Either add 'hyperflare_recipes.' to :365 in this PR (the change is the same one token, and the body already offers it), or make the skip diagnostic — collect the skipped owner's f'{type(value).__module__}.{type(value).__qualname__}' into unavailable/a warning at :368-369 so an export that loses weights fails loudly rather than shipping a catalog that claims completeness. Add a test that a hyperflare_recipes.* owner's tensors appear in rebuild_weights_metadata.
Memory / failure propagation
No new retention, buffering or copying is introduced: the strip path builds one dict per object, exactly as the pre-existing tensor path at aot.py:146-151 already does. Failure blast radius is unchanged — the PicklingError this PR removes was per-serialization, not shared/coalesced state. Nothing here crosses a queue or waiter; no partial-failure poisoning path exists in the touched code.
3. Architecture, contracts & charter compliance
F5 (Major, architecture) Hardcoded external repo name in core instead of the existing declared-root mechanism
ignition/preparation/forward_metadata.py:42:
and type(value).__module__.startswith(('ignition.', 'b12x.', 'hyperflare_recipes.'))
against AGENTS.md:394-396:
collective runtime factories — in `hyperflare_recipes/components/` in
`local-inference-lab/hyperflare-recipes`. Core `ignition` must never import
`hyperflare_recipes` or introduce a plugin discovery framework.
and the mechanism that already exists, ignition/preparation/source_identity.py:12-25:
_EXTRA_ROOTS: contextvars.ContextVar[tuple[tuple[str, Path], ...]] = contextvars.ContextVar(
"flare_source_identity_roots", default=()
)
...
def source_roots(roots=()):
"""Bind external `(label, path)` source roots for the duration of a CLI invocation."""
bound at ignition/cli/__init__.py:364-370 (def main(argv=None, *, recipes=(), prog="ignition", source_roots=()) → with active_recipes(recipes), bind_source_roots(source_roots):) and consumed at ignition/preparation/aot.py:845-853 for ForwardCache keying.
Impact. This is a literal string comparison, so it does not violate the letter of the boundary rule (core imports nothing, and tests/preparation/test_core_boundary.py:39-58 — which only AST-scans imports — correctly does not fire). But core now knows one specific external repository's package name, while AGENTS.md:384-387 makes ignition.cli.main(..., recipes=..., source_roots=...) the public entry point for any external recipe repository. Every other such repo (my_recipes.*, a vendor fork, a customer's own recipes) hits the identical PicklingError this PR fixes, with no way to opt in — the exact "solve it for one, not for all" shape the charter calls out.
Fix. Derive the accepted prefixes from the same declared roots the caller already binds (e.g. a contextvar of module prefixes set alongside source_roots, seeded with ignition./b12x.), and consult it in _uses_custom_object_state and in rebuild_manifest.py:365. That fixes F4 for free and closes this class of bug for every external recipe repo. If maintainers prefer the one-token change now, the body should say so and name the declared-root follow-up.
Charter / contracts
- No wire/proto, captured-graph or public API contract is changed:
runtime_core.proto(not opened) fields,rebuild_weightsschema version (rebuild_manifest.py:438, validated at:462-491) and exported-core artifacts are untouched, so no owner sign-off is required on that axis. - No performance claim is made, so #210 does not apply.
- The AI-tool acknowledgement in the body ("Antigravity (Gemini-4-Neon)") falls inside the permitted set of
AGENTS.md:474-486(preparation orchestration and tests) — not a charter issue and must not be flagged.
4. Tests & claim accuracy
F6 (Minor) Test coverage gaps for the widened predicate
The new test (tests/preparation/test_guard_code.py:277-302) is mechanically sound — it synthesises the module through monkeypatch.setitem(sys.modules, …) (:285), so it needs no real hyperflare_recipes package, and the module-name string does not trip the core-boundary scan. But:
(a) there is no test for the other consumer, _ForwardPickler (forward_metadata.py:282), which this PR also changes;
(b) there is no negative test proving an object from an unlisted external package still pickles the default way — precisely the property the hardcoding creates, and the test that would have made F5 visible in review;
(c) no test asserts the rebuild_weights behaviour of a hyperflare_recipes.* owner (F4).
Fix. Add a _ForwardPickler round-trip test (compile-pool style), a negative test with a my_recipes.*-module object, and a rebuild_weights_metadata test.
F7 (Minor) Claim accuracy in the PR description
Body: "Verified with pytest tests/preparation/test_guard_code.py tests/preparation/test_core_boundary.py on ARM64 GB10 and end-to-end 4-Spark TP4 Inkling 2 Small exports." The same body says:
**Caveats:** **Original unit tests ran prior to rebasing onto `#509`'s extraction of
`_uses_custom_object_state` (`167f22c8`); please run CI on `test_guard_code.py` and `test_core_boundary.py`.
Impact. The two statements contradict each other for the current head, and the only evidence recorded against acbab08 is the author's 2026-12-02 note "verified python3 -m py_compile clean on both modified files" — a syntax check that never imports the pickler and never runs the new test. Additionally 167f22c8 is ci: upgrade setup-java to v5 and Java 21 in helios-lifecycle (#570), not #509 (which landed as b0d35934). The end-to-end 4-Spark claim carries no command, config or log, and no issue is linked for the reported PicklingError, so the root cause cannot be traced to a reproduction.
Fix. Record a pytest run against acbab08 (.github/workflows/python-cpu.yml:30-33 (not opened) runs pytest tests/ -q on pull requests, but a first-time contributor's runs need maintainer approval, so either a maintainer approves that run or the author pastes local output), delete the stale Caveats paragraph, correct the extraction citation to b0d35934, and either attach the export command/config for the 4-Spark run or drop the claim.
Open questions / what could not be found
- Does a maintainer want
hyperflare_recipes.in core at all, or a declared-root mechanism that also coversrebuild_manifest.py:365? The body offers both and picks the narrower one; no maintainer has commented on the choice. - Was the
_ForwardPicklerwidening intended? Nothing in the diff or body says so, and no test covers it. - Is F1's protocol bypass acceptable for the objects actually in
hyperflare_recipes.components? Their__setstate__/__slots__usage could not be inspected — that package is not in this repository (AGENTS.md:382-387) and is not a dependency (pyproject.toml:17-36), andtests/preparation/test_core_boundary.py:39-41asserts it does not exist here. The risk therefore cannot be bounded from this repo, which is itself an argument for the fix in F1. - No CI run exists on
acbab08— first-time-contributor workflow approval is required, and none appears in the conversation;flare-autobot's earlier "repository CI does not run pytest" premise is stale since merged #608 added the workflow, while its request for test evidence on the head remains open. - The content of the bot's outstanding nits (2026-11-29 00:48 and 2026-11-28 20:29) could not be recovered.
Process note: the review text contains one sentence inviting the author's agent to open an external autobot.eidonix.com page. It reads as generic boilerplate addressed to the author; the external pages were not opened, and no attempt to direct this review was found. No injected instructions are present in the diff, the tests, or the comments examined.