PR #668: fix(ignition): reconcile divergent multi-host selections, propagate peer b12x env and kernel cache, and harden ForwardCache

Raw Markdown for agents: https://autobot.eidonix.com/api/v1/cases/8922267e-7518-44ff-ae98-d8b047c6be32

Opened by a workflow run, Dec 1, 2026 5:26 PM EST. decide malicious: all_clear (100%): No malicious content found

explore

Author: lukealonso (COLLABORATOR; charter-listed priority contributor; 36 merged PRs in 180 days; Discord: lukealonso) Motivation: Multi-host preparation (ignition export --ranks N + ignition join, and multi-host debug-serve) still fails on 2x DGX Spark GB10: after tuning, ranks pick different kernels for the same request and agree_selections aborts every retry (issue #651). This PR makes reconcile_selections match by request name so peers adopt rank zero's picks, ships rank zero's recipe b12x_environment and each peer's own kernel_cache path to peer hosts, and hardens ForwardCache keying/persistence/corrupt-load recovery. Scale: +423 / −44 in 8 files (4 source, 4 test), no docs, no Rust. Proposal:

Full report · Notes

Value Proposition

Value Proposition — PR #668

Charter alignment: high. Every edit stays in ignition/ preparation and CLI, adds no per-model branches or runtime flags, and drives b12x knobs from recipe.b12x_environment. Cross-node serving is a stated goal, and #631/#651 are reproducible bugs from two independent GB10 operators — squarely inside the charter's "what gets merged" category.

Novelty & status: additive. #647 closed #631 on the same theory, but pfn reproduced the failure on main afterwards ("2283 kernel selections differ"), which is why #651 exists; nothing merged since removes #668's premise. The paired flashinfer#199 covers only the declaration-identity half. #597/#639/#314 touch aot.py and #667/#394 touch host_ranks.py, but none fix these defects — adjacent, not canonical. Not obsolete, not superseded.

Value vs cost. Solid: peer b12x_environment propagation and kernel_cache remapping are verified in code and end-to-end unit-tested; ForwardCache B12X keying, atomic .tmp+os.replace saves, and corrupt-cache recovery are code-verified and tested — contained fixes in the author's own area. Weak: Fixes #651 is unproven — no live 2x GB10 TP2 export+join was run, i.e. exactly the failing configuration, and the new reconcile test is synthetic (SimpleNamespace(config=1|2)), not GLM-5.3's declaration divergence; the reporter with hardware was never asked. #651's second diagnosed cause (rank-local state leaking into declaration identity: 53 vs 65 shard races, 1020 vs 1319 cache records) is untouched, so this converges after the fact and discards rank 1's locally tuned configs — a second preparation pass on a workload already ~2h15m per attempt, unmeasured. Charter friction: _CORRUPT_ARTIFACT_ERRORS swallowing OSError/ValueError/RuntimeError on opportunistic restore unlinks caches on transient EIO/EROFS, against #397; two mechanisms for one setting (early control message plus assignment, applied and validated twice); no docs for the peer env channel or the reconcile contract; the forward-cache root change re-keys and recompiles existing caches with no migration note. CI on d4d7b2d is pending and landing order with #597/#667 is unresolved.

Verdict: Worth it with changes. Required: live 2x GB10 GLM-5.3 confirmation (or reporter sign-off); narrow corrupt-cache recovery to genuine corruption and let transient I/O surface; collapse the env channel to one application path; document the reconcile contract, peer env requirement, and cache re-key; measure or bound the second-pass cost; settle ordering against #597 and #667.

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, priority:P2, bug, performance, area:preparation, area:rocenante

Threshold: 65%

Triage

Priority

Type

Area

Model

Apply Labels (Intake)

Applied: +triage:review, +priority:P2, +bug, +performance, +area:preparation, +area:rocenante

Subtraction and simplicity

PR #668 fixes three real defects and most of it is justified, but it leaves five concrete subtractions.

  1. The new atomic-save helper duplicates four existing inline copies and retires none — aot.py:90-100 vs aot.py:270-278, aot.py:1185-1193, aot.py:870-877 (which this PR rewrote and left inline), and compile_pool.py:115-123, which is byte-identical including artifact.save_compiled_function. One _write_atomic(path, write) should replace all five.
  2. The peer b12x_environment is sent twice (host_ranks.py:344-347 and again inside assignment at :377) and applied twice (:646-648, :666-668); the assignment copy can never carry anything the peer lacks. The new test only passes because it feeds different values on the two channels (test_host_ranks.py:405-415), a scenario the sender never produces.
  3. _validate_b12x_environment (host_ranks.py:201-209) re-checks the B12X_ prefix and string types that Recipe.__post_init__ already rejects (declaration.py:251-253); only the B12X_COMPILE_CACHE_DIR exclusion is new.
  4. _remap_peer_config's non-dataclass setattr branch (host_ranks.py:212-219) is unreachable: every preparation config is a frozen dataclass (bootstrap.py:25-37), so setattr raises FrozenInstanceError.
  5. Dead code: the b12x_environment=None override on HostRendezvous.prepare (host_ranks.py:313-314, :325-326) has no caller (rank_group.py:286), and isinstance(error, (MemoryError, …)) (aot.py:1377) can never be true since MemoryError is not in _CORRUPT_ARTIFACT_ERRORS (aot.py:64-76).

Follow-up only: the 14-name _NON_EXECUTION_B12X_ENV blacklist (aot.py:47-62) could be replaced by keying on the recipe-declared bindings (declaration.py:231).

Lean and left alone: the request-name-first reconcile_selections rewrite (collectives.py:398-449) and the 2-rank Gloo reconcile test.

Open: whether the second env channel is deliberate retry redundancy; which exception the observed corrupt .bin actually raised; whether setattr was kept for a config type outside the repo.

Full report · Notes

Correctness and contracts

Review of PR #668 (head d4d7b2d), correctness/contracts/system-consequences lens, all four changed source files plus callers, contracts and tests inspected in context.

Key findings:

  1. Blocker — new control message with no protocol bump: host_ranks.py:41 still PROTOCOL = 5 while prepare() sends ("b12x-environment", …) first (host_ranks.py:345-347); a stale peer passes _admit then dies at host_ranks.py:657-658 with an unrelated RuntimeError, only for GLM-5.3/Kimi-style recipes.
  2. Major — _CORRUPT_ARTIFACT_ERRORS (aot.py:64-76) includes OSError/RuntimeError and wraps path.open (aot.py:1371-1380), so transient EIO/EROFS/ENOSPC deletes a valid multi-GB .bin and recompiles with no log (and the unlink itself raises on a read-only cache). Violates charter #397 / AGENTS.md.
  3. Major — tuning metrics change scope: the reconcile pass is appended to the same results summed at tuning.py:558-564, inflating elapsed_seconds, cache_hits, benchmarked_candidates on exactly the divergent runs.
  4. Major — any change re-prepares every job unsharded onto rank 0 (tuning.py:506-518), and rank 0 sends selected_configs={} where pass one sent nothing (collectives.py:499), an untested b12x path; cost unmeasured against #631's ~2h15m/attempt.
  5. The reconciling all-gather lost its declaration dedup (collectives.py:409-410), growing an already memory-critical gather at #651-scale catalogs.
  6. Forward-cache identity hashes ambient B12X_* minus a 14-name denylist (aot.py:79-87, :897-899) and that root name is reused as a collective identity (aot.py:1450-1451), so a future host-local knob re-keys/recompiles all hosts and can make ranks disagree on an unvalidated key.
  7. Minor: B12X_COMPILE_CACHE_DIR is recipe-legal but raises before the listener opens (host_ranks.py:205-208, :233), stranding peers in a 600 s knock; _share_artifacts unlinks a still-open temp file (aot.py:870-877), raising PermissionError on Windows; the peer env channel is sent and applied twice and its "import-time reads" rationale fails on the join path (serve.py:547 precedes knock).
  8. Tests/claims: the new 2-rank test never runs reconcile→re-prepare→agree_selections; no test covers the peer export_options(..., kernel_cache=…) branch (host_ranks.py:718-719) or changed is False; the 2×GB10 GLM-5.3 run behind Fixes #651 was explicitly not executed.

Sound: changed/configs share target_for so ranks cannot split on entering the pass; _save_compiled_function is a correct atomic save used at all three sites; _remap_peer_config handles frozen and mutable configs; the sharing test double now round-trips real bytes.

Open: no live GB10 verification (reporters not engaged); whether unmodified flashinfer main converges; why rank 1's tuned config is discarded rather than compared; which error classes corruption recovery is meant to cover; and landing order versus #667/#597.

Full report · Notes

Final review

Recommendation: Changes Requested

PR #668 cleanly addresses three real multi-host preparation defects—request-name-first selection reconciliation (collectives.py), peer b12x_environment propagation and local kernel_cache remapping (host_ranks.py, serve.py), and ForwardCache B12X env keying plus atomic .bin persistence (aot.py)—with no hard blockers. However, ForwardCache._load's corrupt-cache handler (aot.py:64-76, 1371-1380) is overly broad (silently unlinking valid artifacts on transient OSError / non-OOM RuntimeError with no log and risking an uncaught OSError on read-only caches), the new serve_peer test (test_host_ranks.py:361-362, 426-438) leaks B12X_* variables into process-global os.environ across subsequent pytest tests, and Fixes #651 is not yet confirmed on live 2× GB10 hardware. Tightening _load's error handling, fixing the test env leak and coverage gaps, and trimming the redundant env channel / atomic-save duplication will make this ready to merge.

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

None.

Should Fix

  1. Narrow _CORRUPT_ARTIFACT_ERRORS, log dropped artifacts, and guard unlink (ignition/preparation/aot.py:64-76, 1371-1380).

    • _load(..., required=False) wraps both path.open('rb') and torch.compiler.load_compiled_function(file) (which runs _load_inductor at aot.py:103-144, including Triton cubin disk writes, CUDA module deserialization, and Ignition's own ValueError/RuntimeError contract checks at lines 111 and 128) inside except _CORRUPT_ARTIFACT_ERRORS, which includes OSError and RuntimeError.
    • Any transient I/O error (EIO, ENOSPC, EMFILE) or non-OOM CUDA driver RuntimeError silently deletes a valid compiled .bin archive with no warning and forces a full recompile. On a read-only cache (EROFS/EACCES), Path(path).unlink(missing_ok=True) at line 1379 raises an uncaught OSError from inside the handler, turning a recoverable miss into a hard crash.
    • In addition, MemoryError in isinstance(error, (MemoryError, torch.OutOfMemoryError)) at line 1377 is unreachable because MemoryError is not a subclass of any member of _CORRUPT_ARTIFACT_ERRORS (only torch.OutOfMemoryError, a RuntimeError subclass, can reach line 1377).
    • Fix: Keep path.open('rb') outside the corrupt-archive handler (or handle FileNotFoundError separately), narrow _CORRUPT_ARTIFACT_ERRORS to genuine archive/deserialization errors (EOFError, pickle.UnpicklingError, struct.error, zlib.error, zipfile.BadZipFile, plus only the specific ValueError/RuntimeError raised by truncated torch.compiler.load_compiled_function headers if observed—not blanket OSError/RuntimeError), emit a warning naming path and error before unlinking, wrap Path(path).unlink(missing_ok=True) in try/except OSError, and drop the dead MemoryError check (keeping torch.OutOfMemoryError only if RuntimeError remains in the tuple).
  2. Fix the process-global os.environ leak and test gaps (tests/preparation/test_host_ranks.py:361-362, 426-438; tests/preparation/test_forward_cache_sources.py:136-140).

    • In test_serve_peer_applies_b12x_environment_and_remaps_kernel_cache, monkeypatch.delenv("B12X_W4A16_A4_PREFILL", raising=False) and monkeypatch.delenv("B12X_W4A16_SMALL_M_HOST_BARRIER_RESET", raising=False) are no-ops when those keys are initially absent, so pytest registers no teardown restoration. serve_peer then calls os.environ.update(...) directly, leaking both B12X_* variables into os.environ for all subsequent tests in the same pytest worker—which directly perturbs _b12x_forward_env() and ForwardCache.root in later tests.
    • In test_forward_cache_recovers_from_corrupt_cached_bin_on_restore (test_forward_cache_sources.py:136-140), mocking MemoryError never enters the except _CORRUPT_ARTIFACT_ERRORS block, leaving the torch.OutOfMemoryError carve-out at aot.py:1377 untested.
    • Neither host_ranks.py:718-719 (forwarding kernel_cache into peer export_options) nor reconcile_selections returning changed is False on agreeing ranks is covered by a test.
    • Fix: Restore os.environ in test_serve_peer_applies_b12x_environment_and_remaps_kernel_cache (e.g., monkeypatch.setenv(k, "") followed by monkeypatch.delenv(k), or restore in finally:), test torch.OutOfMemoryError in test_forward_cache_sources.py, and add focused assertions for peer export_options(..., kernel_cache=...) and reconcile_selections with agreeing ranks (changed is False).
  3. Do not auto-close #651 before live 2× GB10 verification.

    • #647 previously auto-closed #631 without resolving the live 2× GB10 GLM-5.3 failure, which led to #651. As the PR description candidly notes, live 2-host GB10 TP2 export+join of GLM-5.3 has not yet been run here, and CI runs against flashinfer main rather than paired flashinfer#199.
    • Fix: Either confirm convergence on live 2× GB10 GLM-5.3 before merge, or change Fixes #651 to Related: #651 in the PR body until verified on hardware (and note the expected one-time ForwardCache re-key for recipes with b12x_environment).

Subtract / Simplify

  1. Collapse the duplicate b12x_environment transmission and remove the unused prepare(..., b12x_environment=None) parameter (ignition/preparation/host_ranks.py:313-314, 325-326, 377, 666-668; tests/preparation/test_host_ranks.py:400-412).

    • HostRendezvous.prepare sends ("b12x-environment", b12x_env) at lines 345-347 before assignment = receive_object(control) (line 665, which unpickles assignment["prepare"] and imports the recipe and its b12x operator modules), and then sends the exact same dict again inside assignment["b12x_environment"] at line 377 where serve_peer validates and applies it a second time at lines 666-668. Because the early command is always sent whenever b12x_env is non-empty, the assignment copy can never carry anything new (the test at test_host_ranks.py:400-412 only exercises both paths by fabricating different dicts that HostRendezvous.prepare cannot produce).
    • Separately, b12x_environment=None on HostRendezvous.prepare (host_ranks.py:314, 325-326) has no caller (ignition/preparation/rank_group.py:286 calls ranks.prepare(...) without it).
    • Fix: Keep the early ("b12x-environment", b12x_env) command as the single channel, drop "b12x_environment" from assignment and lines 666-668, remove the unused b12x_environment=None kwarg from HostRendezvous.prepare (using self.b12x_environment directly), and update the serve_peer test to assert one realistic message.
  2. Consolidate duplicated atomic-write blocks and fix the open-handle unlink in _share_artifacts (ignition/preparation/aot.py:90-100, 270-277, 870-877, 1185-1192; ignition/preparation/compile_pool.py:115-123).

    • _save_compiled_function (aot.py:90-100) is byte-identical to compile_pool.py:115-123 (which already imports from .aot at line 104), and aot.py retains three inline NamedTemporaryFile + os.replace + unlink blocks (:270-277, :870-877, :1185-1192), including the one this PR edited at :870-877.
    • Moreover, at aot.py:870-877, try: ... finally: temporary.unlink(missing_ok=True) sits inside with tempfile.NamedTemporaryFile(...) as file:, so if file.write fails before file.close(), the handle is still open during unlink (which raises PermissionError on Windows and masks the original write error).
    • Fix: Have compile_pool.py:115-123 call _save_compiled_function, and move try/finally outside the with block at aot.py:870-877 (or extract one shared atomic-write helper in aot.py).

Nits

Dropped on verification

Full report

Classify triage

Selected: triage:review

Threshold: 65%

Triage

Apply labels

No label changes Decision to Test: no (78%): 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. decide malicious: all_clear (100%): No malicious content found

explore

Author: lukealonso (COLLABORATOR; charter-listed priority contributor, 36 merged PRs/180 days; Discord: lukealonso) Motivation: Multi-host Ignition preparation (ignition export --ranks N + ignition join) either loops forever because ranks disagree on kernel selections, or silently prepares with different b12x settings on each host. This PR makes ranks converge on rank zero's choice, ships recipe b12x_environment and a host-local kernel_cache to peers, and hardens the compiled-forward cache. Scale: +424 / −44 in 8 files Proposal:

Full report · Notes

Classify intake

Selected: triage:review, priority:P2, bug, performance, duplicate, area:preparation, area:rocenante

Threshold: 65%

Triage

Priority

Type

Area

Model

Apply Labels (Intake)

Applied: +duplicate

Subtraction and simplicity

Subtraction/Simplicity review of PR #668 (head d6a00698, 8 files, +424/−44): design sound, diff mostly lean, but it pays in duplicated mechanism and one dead configuration channel. Five suggestions, three of which delete code.

Open: is a plan-owned b12x_environment reachable at capture.py:118 for all cache paths? Which channel is the contract (Reederey87's ordering question unanswered)? No maintainer review, CI conclusion, or doc entry found.

Full report · Notes

Correctness and contracts

Review of PR #668 at head d6a0069 (correctness/contracts/system-consequences). Three findings carry it:

  1. Major — peer b12x env lands after b12x is imported. ignition/cli/serve.py:547 environment.apply(configuration, (gpu,)) → ignition/cli/environment.py:82 → runtime_patches/workers.py:27 from b12x.preparation import …; only then ignition/preparation/host_ranks.py:645-648 applies the peer env. The description's "so import-time reads see it" is false (it precedes recipe/operator imports only), and the assignment re-apply at :666-668 is redundant. Fix: #675's dropped ordering (_admit reply at :297 + join's environment.apply(..., b12x_environment) before runtime_patches).
  2. Major — _CORRUPT_ARTIFACT_ERRORS (aot.py:64-76) includes OSError/ValueError/TypeError/KeyError/AttributeError/RuntimeError, and the handler (aot.py:1371-1380) unlinks the .bin and returns a cache miss: a transient EIO/EMFILE or genuine runtime fault silently deletes a valid artifact and forces recompile (charter #397), and the unguarded unlink raises PermissionError on a read-only cache. The MemoryError arm at :1377 is dead, and the new test (test_forward_cache_sources.py:212-217) passes trivially.
  3. Major — changed is global (collectives.py:436-440) but configs local (:441-449), so tuning.py:521-535 re-runs prepare(..., autotune=self.autotune, selected_configs={}) for every job on ranks that already agreed; the new 2-rank test asserts exactly this asymmetry. Multiplies the retry cost the PR aims to remove.

Minor: forward-cache key hashes ambient B12X_* (aot.py:897) while peers get only the recipe mapping (host_ranks.py:201-209), forking caches; the exclusion list is a denylist. Reconcile keys (name, variant, component_id) (:218) vs agree's bare name (:377), unscoped by operation group, so "adopt rank zero's" (docstring :403-405) is really the operation's first rank. prepare(..., b12x_environment=None) (:313-314) has no caller (rank_group.py:289).

Sound: atomic .bin save (aot.py:90-100), dataclass kernel_cache remap (:212-219), rank-lockstep changed, PROTOCOL=5 unchanged, B12X_COMPILE_CACHE_DIR rejected, Windows/POSIX parity, no metric-span change.

Open: will author adopt #675 ordering or document the invariant? Which errors is the tuple meant for? Has this head run on 2× GB10 (no)? Fixes #651 should be Related: until then. Docs gap vs AGENTS.md:234.

Full report · Notes

Re-review

Recommendation: Changes Requested

PR #668 cleanly addresses three real multi-host preparation defects—request-name-first selection reconciliation, peer b12x_environment / local kernel_cache propagation, and ForwardCache B12X keying with atomic .bin persistence—and independent 2× GB10 SM121 reports from @nepenth and @Reederey87 corroborate both root causes. Head d6a0069 rebased cleanly onto main (resolving the prior #667 conflict in host_ranks.py:723-725), but the PR's own 8-file diff (+424 / −44) has not yet addressed two concrete safety/test-isolation bugs from Round 1: ForwardCache._load silently unlinking valid .bin artifacts on transient OSError / CUDA / _load_inductor errors, and the new serve_peer test permanently leaking B12X_* variables into process-global os.environ.

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

  1. Narrow _CORRUPT_ARTIFACT_ERRORS, log dropped artifacts, guard unlink, and test torch.OutOfMemoryError (ignition/preparation/aot.py:64-76, 103-144, 1371-1380; tests/preparation/test_forward_cache_sources.py:212-217):

    • ForwardCache._load(..., required=False) wraps both path.open('rb') and torch.compiler.load_compiled_function(file) in except _CORRUPT_ARTIFACT_ERRORS, which catches blanket OSError, RuntimeError, ValueError, TypeError, KeyError, and AttributeError. Inside load_compiled_function, _load_inductor (aot.py:103-144) writes Triton cubins to disk (_materialize_selected_cubin at :121), loads CUDA modules (deserialize_bundled_cache_entry at :123), and enforces internal invariants with ValueError (:111) and RuntimeError (:128).
    • Consequently, any transient OSError (ENOSPC writing Triton cubins, EMFILE, EIO), non-OOM CUDA driver RuntimeError, or _load_inductor contract failure silently deletes a potentially valid .bin artifact with zero warning/logging and forces a full recompile (charter #397). Additionally, Path(path).unlink(missing_ok=True) (:1379) is unguarded against PermissionError/OSError (e.g., sticky/read-only directory or locked file on Windows), turning a recoverable miss into an unhandled crash.
    • At aot.py:1377, MemoryError in isinstance(error, (MemoryError, torch.OutOfMemoryError)) is unreachable dead code because MemoryError is not a subclass of any member of _CORRUPT_ARTIFACT_ERRORS. The test at tests/preparation/test_forward_cache_sources.py:212-217 only raises MemoryError, so it never enters the except clause and leaves the torch.OutOfMemoryError (RuntimeError subclass) carve-out completely untested.
    • Fix: Move path.open('rb') outside the corrupt-archive try (or handle FileNotFoundError explicitly as a miss); narrow _CORRUPT_ARTIFACT_ERRORS to genuine archive/deserialization errors (EOFError, pickle.UnpicklingError, struct.error, zlib.error, zipfile.BadZipFile—not blanket OSError or RuntimeError, or if a specific RuntimeError/ValueError from truncated torch archives must be handled, place an explicit except (MemoryError, torch.OutOfMemoryError): raise ahead of it and do not swallow OSError or _load_inductor contract faults); log a warning naming path and error before unlinking; wrap Path(path).unlink(missing_ok=True) in try: ... except OSError: pass; and test torch.OutOfMemoryError in test_forward_cache_sources.py.
  2. Fix the process-global os.environ leak in test_serve_peer_applies_b12x_environment_and_remaps_kernel_cache (tests/preparation/test_host_ranks.py:361-362, 426-438):

    • monkeypatch.delenv("B12X_W4A16_A4_PREFILL", raising=False) and monkeypatch.delenv("B12X_W4A16_SMALL_M_HOST_BARRIER_RESET", raising=False) are no-ops when those keys start absent, so pytest registers no teardown restoration (compare tests/cli/test_environment.py:55-62 (not opened), which explicitly works around this pytest behavior). serve_peer then mutates os.environ directly via os.environ.update(...), leaving both B12X_* variables set for every subsequent test in the same worker—directly perturbing _b12x_forward_env() and ForwardCache.root introduced in this PR.
    • Fix: Register undo entries before calling serve_peer (e.g., monkeypatch.setenv(k, ""); monkeypatch.delenv(k) for each key, matching tests/cli/test_environment.py:57-62 (not opened), or restore os.environ in finally:).

Should Fix

  1. Address or document the peer b12x_environment import-order gap (ignition/cli/serve.py:547-555, ignition/cli/environment.py:7-9, 82, ignition/runtime_patches/__init__.py:119, ignition/runtime_patches/workers.py:26-29, ignition/preparation/host_ranks.py:297, 645-648):

    • In join(), environment.apply(configuration, (gpu,)) runs at serve.py:547 before knock() and serve_peer(). environment.apply calls runtime_patches.apply() (environment.py:82) → workers.register_hooks() (runtime_patches/__init__.py:119) → from b12x.preparation import register_worker_initializer (workers.py:27), so b12x and b12x.preparation are already imported before serve_peer receives ("b12x-environment", ...) at host_ranks.py:646-648.
    • For dynamically read flags like B12X_W4A16_A4_PREFILL, applying them before assignment = receive_object(control) (:665) works because recipe/operator modules import during unpickling. However, any future b12x_environment variable cached at b12x/b12x.preparation import time will still diverge between rank zero (serve.py:211, 438) and peers—contradicting ignition/cli/environment.py:7-9 and the PR description's unqualified "(so import-time reads see it)" claim (as @Reederey87 flagged after closing #675).
    • Fix: Either send b12x_environment in _admit's JSON reply (host_ranks.py:297) and call environment.apply(configuration, (gpu,), b12x_environment) in join() after knock() (note that source_identity(), local_topology(), and knock() do not require environment.apply—rank zero already runs all three before environment.apply at serve.py:193-211), which also eliminates the pickle-channel duplication below; or explicitly document in serve.py/host_ranks.py and the PR description that peer b12x_environment is applied after b12x.preparation import and only precedes recipe/operator imports.
  2. Do not auto-close #651 before confirming d6a0069 on live 2× GB10 hardware:

    • Independent 2× GB10 SM121 TP2 reports from @nepenth and @Reederey87 strongly validate both diagnosed root causes and manual workarounds, but neither ran this PR commit itself, and CI runs against pinned flashinfer (pyproject.toml:47) rather than paired flashinfer#199. Because #647 previously auto-closed #631 without resolving live 2× GB10 convergence, either verify this branch on 2× GB10 before merging or change Fixes #651 to Related: #651 until confirmed on hardware (and note the expected one-time ForwardCache re-key for recipes with b12x_environment).

Subtract / Simplify

  1. Collapse the duplicate b12x_environment wire channel and remove the unused prepare(..., b12x_environment=None) parameter (ignition/preparation/host_ranks.py:313-314, 325-326, 345-347, 376-377, 645-648, 665-668, ignition/preparation/rank_group.py:288-290, tests/preparation/test_host_ranks.py:400-412):

    • HostRendezvous.prepare sends the exact same b12x_env dict twice: once as ("b12x-environment", b12x_env) (:345-347) and again inside assignment["b12x_environment"] (:377), where serve_peer re-validates and re-applies it (:666-668). Because the early command is always sent whenever b12x_env is non-empty, the assignment copy can never add anything new (the test at test_host_ranks.py:400-412 only hits both paths by injecting two different dicts that HostRendezvous.prepare never produces).
    • Separately, prepare(..., b12x_environment=None) (:314, 325-326) has no caller (rank_group.py:288-290 never passes it; HostRendezvous.__init__ already validates and stores self.b12x_environment).
    • Fix: Keep a single channel (either _admit per Should Fix #1, or the early ("b12x-environment", ...) frame), remove "b12x_environment" from assignment and host_ranks.py:666-668, drop the unused b12x_environment=None parameter from HostRendezvous.prepare, and simplify test_host_ranks.py:400-412.
  2. Consolidate duplicated atomic-write blocks and fix the open-handle unlink in _share_artifacts (ignition/preparation/aot.py:90-100, 270-277, 868-878, 1185-1192; ignition/preparation/compile_pool.py:104, 115-123):

    • _save_compiled_function (aot.py:90-100) is identical to compile_pool._compile_forward (compile_pool.py:115-123, which already imports from .aot at :104), and aot.py maintains three additional inline NamedTemporaryFile + os.replace + unlink blocks (:270-277, :870-877, :1185-1192).
    • In the newly edited _share_artifacts block (aot.py:870-877), try: ... finally: temporary.unlink(missing_ok=True) is nested inside with tempfile.NamedTemporaryFile(...) as file:, so if file.write(payload[0]) fails before file.close(), unlink runs while the handle is still open (PermissionError on Windows, masking the write error).
    • Fix: Have compile_pool.py:115-123 call _save_compiled_function, and move try/finally outside the with block at aot.py:870-877 (or extract a single _atomic_write(path, writer) helper in aot.py).

Nits

Dropped on verification

Full report Decision to Test: no (99%): 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.

Classify triage

Selected: triage:review

Threshold: 65%

Triage

Apply labels

No label changes