Explore scratchpad · NVIDIA/hyperflare-inference #678

Raw Markdown for agents: https://autobot.eidonix.com/p/905672fe-2115-4a41-bd6f-971698f51b8f.md

#1 [high] Change: PR #678 propagates bound source roots into spawned processes

PR #678 "fix(ignition): propagate bound source roots to spawned rank and replica processes", base main, head e72ec0d, 4 files +233/-91.

Real semantic changes (small):

Not changed but load-bearing: the two consumers of _EXTRA_ROOTS are ForwardCache.init (ignition/preparation/aot.py:845-853, mixes extra-root .py bytes into the cache key -> self.root = root/'forwards'/key.hexdigest() at aot.py:855) and source_identity() (source_identity.py:33-54, combined_roots mixed at :112-113). The "cache-root agreement check" the PR title/body refers to is not a single named function; the observable effect is that rank 0 and peers derive the same ForwardCache.root (aot.py:855) and thus share the same per-host cache directory and the same source_identity=self.root.name values passed to InductorSelections (aot.py:928, 1225, 1382) -> _execution_identity (inductor_tuning.py:100-106). Also rebuild_manifest.from_plan records source_identity() (rebuild_manifest.py:327).

#2 [high] Related work: #670 contains the same rank_group source-root fix (competing)

PR #670 (open, lukealonso, COLLABORATOR, opened 2026-12-02 00:26, head 0aeb2c1, +823/-267) bundles three things, one of which is exactly PR #678's rank_group.py fix:

#3 [high] Claims/evidence: "cache-root agreement check in ForwardCache._prepare_ranks" does not exist on main; it is #597's addition

PR #678's description says the bug makes exports "fail the cache-root agreement check in ForwardCache._prepare_ranks". Verified on main/PR head (ignition/preparation/aot.py):

#4 [high] Reach: multi-host ignition join peer path still has no source-roots binding

Verified by grep for source_roots|current_source_roots at PR head: the only bindings are ignition/cli/init.py:364-370 (main(..., source_roots=...)), ignition/preparation/rank_group.py:53-59/295-298, ignition/preparation/tuning_replicas.py:145/158/174-176. Nothing in ignition/preparation/host_ranks.py or ignition/cli/serve.py. Consequence (reasoned, not run): multi-host export/serve peers run ignition join -> ignition/cli/serve.py:528-549, which computes source_identity() at serve.py:546 with an empty _EXTRA_ROOTS, and HostRendezvous._admit compares it to rank zero's identity (host_ranks.py:270-271 "source identity differs from rank zero's; every host must run the same checkout"); serve_peer/RemoteSource also uses source_identity() (host_ranks.py:629-631) and prepares at host_ranks.py:654-657 with no root binding. So an external recipe CLI that binds roots on rank zero still has unbounded peers on other hosts, both for identity agreement and for the ForwardCache key (aot.py:845-855). This is consistent with the description, which scopes the fix to "spawned tensor-parallel peer processes" and "local tuning replicas", but the PR's headline benefit ("unblocking same-SKU multi-GPU exports launched through external recipe CLIs") should not be read as covering multi-host. PRs #668 and #675 are the open work on that peer path (b12x env / kernel_cache / rendezvous), neither propagates source roots. Also note ignition convert/serve launched directly as ignition ... never bind roots at all; only external CLIs passing source_roots= do.

#11 [high] Research summary

Case file for PR #678 gathered; scratchpad holds 10 entries covering every angle (change, why, related work, recent activity, people, community, project fit, claims/evidence, reach, process).

Headlines a reader could not get from the description:

  1. #670 by lukealonso already contains the identical rank_group.py fix. #670 ("parameterize THINK_TAGS ... and propagate peer source roots", open, +823/-267) makes exactly the prepare_group -> _peer source_roots(...) change; #678 adds the small extra pieces (#670 lacks): current_source_roots(), the tuning_replicas.py replica propagation, and the three new tests — indeed #670's own Autobot review asked for such a test and suggested splitting the rank_group fix out. Neither PR references the other; both open at once on the same lines.

  2. The stated failure mode ("cache-root agreement check in ForwardCache._prepare_ranks") does not exist on main. On main a root mismatch surfaces as FileNotFoundError/cache miss; the fail-fast root check is added by the author's other open PR #597, which also matches #678's SM120 same-SKU/mixed-SKU evidence rig. #678 does not cite #597.

  3. The multi-host peer path is untouched: ignition join / host_ranks.py / serve.py never bind source roots, so source_identity() and the ForwardCache key stay rootless on remote peers; the fix is local-spawn only.

  4. Small undeclared gaps: _replica imports the recipe module (_resolve_recipe, tuning_replicas.py:155) before entering source_roots(...) at :158; the new tests assert ContextVar visibility, not equal ForwardCache.root/source_identity(); and peer-written rebuild metadata (rebuild_manifest.py:327) now carries rank 0's identity — none of these are mentioned in the PR body or limitations.

Charter fit is clean (no flags, no plugin, shared ignition/preparation, fixes the documented external-recipe CLI entrypoint), no docs were added, no human review or CI exists on the head commit e72ec0d, and the PR is otherwise small: one new 3-line function plus argument plumbing, with rank_group.py's +91/-85 being almost entirely re-indentation of _peer's body.

#12 [high] Why: the problem, its origin, and which issues/PRs report it

Problem: external recipe repos (local-inference-lab/hyperflare-recipes) call ignition.cli.main(..., source_roots=...), which binds _EXTRA_ROOTS (ignition/cli/init.py:364-370, ignition/preparation/source_identity.py:12-30). Two consumers hash those roots: ForwardCache.__init__ (ignition/preparation/aot.py:845-855, key -> self.root) and source_identity() (source_identity.py:33-54, :112-113). mp.get_context("spawn") children (rank_group.py:301, tuning_replicas.py:179) start with an empty ContextVar, so peers get a different root/source identity than rank 0.

Origin of the mechanism: the external-recipe split by Luke Alonso — commits da037284 / 17bb3c4a / 568aeca0 (2026-11-22, "Stage hyperflare_recipes separation...", "Remove extracted hyperflare_recipes...", "Align core Flare docs..."), later PR #545 (698ee450, compositional RecipeParameters + dynamic CLI). source_roots/_EXTRA_ROOTS first appears in the history of source_identity.py at da037284; test_forward_cache_sources.py's source-root tests came with #545/da037284. The public entrypoint contract is codified at AGENTS.md:382-387.

No issue in the repo reports this defect. The only other place it is written down is PR #670 (lukealonso) and PR #597/#668's ForwardCache discussions; #668 reports a different multi-host ForwardCache defect (missing B12X_* env in the cache key) and #651 tracks multi-host autotune divergence. So: no linked issue, no user report attached to #678 — the "why" rests entirely on the PR body plus #670's parallel description.

#15 [high] Amendments of 2026-12-02 (post-rebase) to report #14 for PR #678

PR #678 force-pushed/rebased after the 21:29 UTC comment (head 90b0d315953e453c8438f0129cc5173d01fcb731, +136/-20 in 5 files, was +233/-91 in 4). Items below supersede the corresponding parts of report #14.

  1. SCALE/FILES CHANGED. Now 5 files: ignition/preparation/aot.py (+2/-2), rank_group.py (+2/-2), source_identity.py (+6/-1), tuning_replicas.py (+8/-3), tests/preparation/test_forward_cache_sources.py (+118/-12) (pr_files [1]). The rank_group.py +91/-85 re-indentation is gone; the PR's own rank_group hunk is only two lines.

  2. #670 IS MERGED (2026-12-02 14:16, head 46e380a, +1132/-307; read_item 670). So report #14's "open competing duplicate, no cross-reference either way" is superseded: #670 landed, and #678 is now a follow-on that (a) replaces the private _EXTRA_ROOTS import with the new accessor and (b) adds the tuning-replica path. PR labels are now area:preparation, bug, duplicate, priority:P2, triage:review (read_item 678) — repo-side triage still marks it a duplicate.

  3. FULL-BODY _peer WRAP IS GONE (my prior "conflict surface / roots stay bound through serve_rank" finding). On this head, with bind_source_roots(extra_roots): at rank_group.py:60 covers only the preparation block to :74, and _peer(..., extra_roots=()) at :44-45 is merged #670 code, not part of #678's diff (search_code [6]; pr_diff [2]). #678's only rank_group change is extra_roots = current_source_roots() at rank_group.py:297 replacing _EXTRA_ROOTS.get().

  4. TESTS NOW ASSERT CACHE-ROOT AGREEMENT (supersedes scratchpad #7's "asserts ContextVar only"). tests/preparation/test_forward_cache_sources.py:109 computes an unbound baseline_root; :120-123 assert rank0/rank1 equal extra_roots AND equal cache_root AND cache_root != baseline_root. Same for the replica test: :216 baseline, :242-245 equality plus difference. New test_current_source_roots_reflects_active_scope (:151-160) checks nesting/reset. Peer test is a real spawn over loopback Gloo; replica test is a real spawn with _cpu_replica_entry (:199-207) patching torch.cuda.set_device/synchronize and core_storage.CoreStorage in the child (author-disclosed limitation, PR description "Supporting evidence and limitations").

  5. DESCRIPTION REWRITE (was my highest-value finding). The PR body (read_item 678) now names the main failure mode as divergent ForwardCache roots / FileNotFoundError / cache misses and explicitly conditions the same-SKU mismatch on "unmerged PR #597", and states plainly that _replica today calls prepare(..., compile_forwards=False) and exits at TuningComplete without reaching an in-tree ForwardCache or source_identity(), i.e. tuning propagation is defensive parity, not a live bug. It also states git grep _EXTRA_ROOTS leaves references only inside source_identity.py — verified: aot.py:845-847 and rank_group.py:295-297 use current_source_roots(); remaining _EXTRA_ROOTS uses are source_identity.py:12,19,26,48 (search_code [6][14]).

  6. DOCSTRING NIT FIXED. source_identity.py:24 now reads "Bind external (label, path) source roots for the active CLI or spawned worker context."

  7. STILL TRUE / NOT FIXED:

  1. NEW CONFLICT SURFACE: #695 (open, lukealonso, 2026-12-02 21:41, +526/-15) rewrites ignition/preparation/tuning_replicas.py and tuning.py for cross-rank tuning selection sharing (items_touching [58]; read_item 695). It independently reports ForwardCache._prepare_ranks BindingMismatch on scratch_layout for --tuning-gpus exports — a different root cause (divergent tuning selections, not cache roots) but the same failure surface #678's description cites, and it edits the same spawn/_replica region. Whoever merges second re-resolves the _replica args tuple. #695 also reports test_source_identity failing in its environment for unrelated venv reasons.

  2. VERIFICATION STATUS: no CI check run demonstrated on head 90b0d31; the 36-passed/7-suite figure is author-reported (PR description; comment 2026-12-02 21:29). The only Autobot review on the PR is the 11:19 UTC one, which predates the rebase and the test/description fixes; no re-review has been posted.

#16 [high] Research summary

Amendments recorded as scratchpad entry #15; they supersede the corresponding parts of report #14.

Amendments to report #14 (PR #678, head 90b0d31 after the 21:29 UTC rebase):

  1. The competing PR is no longer competing. #670 merged at 2026-12-02 14:16 (head 46e380a, +1132/−307), so report #14's "open duplicate, neither PR cites the other" is superseded. #678 is now a follow-on to merged code: it replaces #670's private _EXTRA_ROOTS import with the new current_source_roots() and adds the tuning-replica path. Repo triage still labels the PR duplicate (P2).
  2. Scale changed: +136/−20 in 5 files (was +233/−91 in 4). rank_group.py's +91/−85 re-indentation and full-body _peer wrap are gone — #678's only rank_group.py change is extra_roots = current_source_roots() at :297; with bind_source_roots(...) at :60 is merged #670 code. My earlier "roots stay bound through serve_rank" and conflict-with-#670 findings are withdrawn.
  3. Tests now prove what report #14 said they didn't. Both spawn tests assert ForwardCache.root equality between siblings and difference from an unbound baseline (test_forward_cache_sources.py:109,120-123 for peers, :216,242-245 for replicas), plus a ContextVar nesting/reset test (:151-160). Replica test stubs CUDA/CoreStorage in the child (author-disclosed).
  4. Description and docstring rewritten. The PR body now names the main failure mode correctly, conditions the _prepare_ranks same-SKU mismatch on unmerged #597, and discloses that _replica reaches no in-tree ForwardCache today — my top finding is closed. source_identity.py:24 docstring now covers spawned workers. Docs still untouched (docs/ has no source_roots mention).
  5. Still unfixed: the multi-host ignition join path (serve.py:528-552, source_identity() at :546 with no bound roots; host_ranks.py:270-271,597-631); _replica still imports the recipe (tuning_replicas.py:155) before binding roots at :158; peer rebuild metadata still records the child's source_identity() (rebuild_manifest.py:329).
  6. New conflict: #695 (open, lukealonso, +526/−15) rewrites tuning_replicas.py/tuning.py (not opened) and independently reports a ForwardCache._prepare_ranks BindingMismatch for --tuning-gpus exports from a different root cause (divergent tuning selections); merge order decides who re-resolves the _replica args tuple.
  7. Evidence status: the 36-passed figure is still author-reported; no CI run is shown on 90b0d31, and the only Autobot review (11:19 UTC) predates all of these fixes.

#5 [medium] Change (detail): what each modified function does, line by line

Files at PR head, all under ignition/preparation/:

#6 [medium] Gap: _replica imports the recipe before binding the roots

#7 [medium] Claims/evidence: the new tests assert ContextVar visibility, not equal cache roots

Tests at PR head, tests/preparation/test_forward_cache_sources.py:

#8 [medium] People: author is the #597 mixed-SKU ForwardCache author; no human engagement yet

#9 [medium] Project fit: aligns with the external-recipe rule; no docs added

Charter (read_charter) and repo docs, as facts:

#10 [medium] Reach: only external ignition.cli.main(source_roots=...) launches change; core CLI untouched

Verified on PR head by grep:

#13 [medium] Related work: #668 and #675 touch the same ForwardCache/peer-path surface but not source roots

#17 [medium] Residue of 2026-12-02 re-review: exact test gating, CLI binding site, remaining private-var uses

Always quotes IDs for tool calls.

Additions/corrections to entry #15, from the same re-review pass (head 90b0d315953e453c8438f0129cc5173d01fcb731).

A) TEST GATING CORRECTION. Report #14 said both real-spawn tests are "Linux-only". Only the replica test is: test_prepare_recipe_propagates_source_roots_to_spawned_tuning_replica carries @pytest.mark.skipif(sys.platform != "linux", ...) (tests/preparation/test_forward_cache_sources.py:210) plus pytest.importorskip("flare_heliopause") (:212). test_prepare_group_propagates_source_roots_to_spawned_peers (:100) has no skipif and no importorskip, and drives rank_group.prepare_group with SimpleNamespace(devices=("cuda:0", "cuda:1")) over loopback Gloo (:111-123). The file total is 246 lines; the diff is +118/−12.

B) TEST FIXTURES worth citing. _stub_forward_cache_root() (:35-42) monkeypatches aot.torch.cuda.get_device_properties to an SM120/96-SM namespace and returns str(ForwardCache(...).root) — this is the whole mechanism by which the tests "assert real cache roots" on CPU. _record_replica_source_roots (:163-172) writes replica-{index}.json with extra_roots + cache_root and raises tuning_replicas.TuningComplete() for index > 0 (matching the in-tree contract that a replica must not continue past kernel preparation). _cpu_replica_entry (:199-207) patches torch.cuda.set_device, torch.cuda.synchronize, and core_storage.CoreStorage in the child, then calls tuning_replicas._replica(*args) — so the real spawn/serialization path is exercised, not the CUDA work. _REPLICA_TEST_RECIPE (:175-196) is a synthetic 1-rank recipe whose prepare is the recorder; it needs RankCosts, Checkpoint, MappingProxyType, SamplingDefaults imports added at the top of the file (:7-19). test_frontend_contract_validates_tool_delimiters (:126-148) is merged #670's test, untouched by #678.

C) THE BINDING SITE (unchanged by this PR, but it is the root of the external-recipe contract): ignition/cli/__init__.py:364 def main(argv=None, *, recipes=(), prog="ignition", source_roots=()), importing source_roots as bind_source_roots at :365 and entering with active_recipes(recipes), active_prog(prog), bind_source_roots(source_roots): at :370. Identical on main (search_code at ref main gave the same lines), confirming the PR does not alter the public entrypoint.

D) REMAINING PRIVATE-VAR USES after the change, all inside source_identity.py and therefore legitimate: definition _EXTRA_ROOTS :12-14, accessor body :19, source_roots set/reset :26 and :30, and source_identity()'s own combined_roots = (*_EXTRA_ROOTS.get(), *extra_roots) at :48 (note the separate extra_roots= keyword there is unrelated to the ContextVar). Nothing outside the module reads it any more, which is what the PR description's git grep claim asserts.

E) FORWARD-REFERENCE the report should keep straight: ForwardCache._prepare_ranks exists on main (aot.py:1023) but the same-SKU cache-root comparison the description originally cited is #597's addition; on main the rank-agreement failure mode is BindingMismatch from guard/binding checks (aot.py:94, :439, :573, :1319). #695 (open) reports exactly that BindingMismatch on decoder.layers[*].attention.scratch_layout from divergent tuning selections — so two open PRs now cite the same exception with different causes, which is the sharpest thing a reviewer should not conflate.