Case file — PR #678 "fix(ignition): propagate bound source roots to spawned rank and replica processes"
https://github.com/NVIDIA/hyperflare-inference/pull/678 · author brandonmmusic-max (CONTRIBUTOR, Discord "Brandonmusic") · head e72ec0d · base main · opened 2026-12-02 10:57 · open, "ready for review", 0 comments, 0 reviews, no CI checks on the head commit · 4 files, +233 / −91.
Key findings
- A priority contributor's open PR already contains the same core fix. #670 (
lukealonso, open, 2026-12-02 00:26) makes exactly therank_group.pychange #678 leads with: "#678's What changed" bullet 2 and #670's "TP peer source-root propagation (ignition/preparation/rank_group.py)" describe the sameprepare_group→_peer→source_roots(...)edit (ignition/preparation/rank_group.py:44-59, 295-311). #670's own Autobot review asked for a CPU test for that fix and suggested splitting the rank_group fix into its own PR; #678 looks like that split but cites neither #670 nor the review. Neither PR references the other; both are open on the same lines, so merge order decides which one duplicates the other. #678's genuine additions over #670:current_source_roots()(source_identity.py:17-19), thetuning_replicas.pyreplica propagation (:142, :158, :174-176, :190-194), and three new tests. - The failure mode named in the description does not exist on
main. The PR says peer ranks "fail the cache-root agreement check inForwardCache._prepare_ranks"._prepare_ranks(ignition/preparation/aot.py:1023-1295) has no cache-root comparison — its only agreement checks are about forward catalogs (aot.py:1045-1046, 714-715) and kernel inventory (ignition/preparation/inductor_tuning.py:236-279). A root mismatch onmainsurfaces as the peer resolving cache-relative paths under its ownself.root(aot.py:855) →FileNotFoundError/cache miss, which is how #597 and #670 describe it. The fail-fast check is added by the author's other open PR #597, whose SM120 same-SKU/mixed-SKU rig is also exactly the rig #678 cites as end-to-end evidence. #678 does not cite #597. - Multi-host peers are still unbounded and are not declared as out of scope. The only
source_rootsbindings in the tree at the PR head are ignition/cli/init.py:364-370, rank_group.py:59, tuning_replicas.py:158.ignition join(ignition/cli/serve.py:528-549,source_identity()at :546),HostRendezvous._admit's identity comparison (host_ranks.py:270-271) andserve_peer/RemoteSource(host_ranks.py:629-657) never bind roots, so a multi-host export launched from an external recipe CLI still fails identity agreement and still splits theForwardCachekey. The body limits itself to "spawned tensor-parallel peer processes" and "local tuning replicas", so this matches the letter of the description, but the headline benefit ("same-SKU multi-GPU exports") should not be read as covering multi-host. Open PRs #668 and #675 are the work on that peer path; neither propagates source roots. - Undeclared gaps:
_replicaresolves/imports the recipe (_resolve_recipe, tuning_replicas.py:155 → :128-139) before enteringsource_roots(...)at :158; the new tests assert ContextVar visibility rather than equalForwardCache.root/source_identity(); and peer-written rebuild metadata (rebuild_manifest.py:327) now records rank 0's identity instead of a rootless one. None of the three is in the body or the "limitations" paragraph. - Size is misleading: rank_group.py's +91/−85 is almost entirely re-indentation of
_peer's ~80-line body (aot.py:59 wrap); the semantic additions across the three source files are one 3-line function plus argument plumbing (~13 lines).
The change
Plain terms: the preparation code hashes the recipe source tree into cache keys and identity digests. External recipe repos tell ignition about their directories via ignition.cli.main(..., source_roots=...), which binds a ContextVar named _EXTRA_ROOTS (ignition/cli/init.py:364-370 → source_identity.py:12-30). multiprocessing "spawn" children do not inherit ContextVars, so the peer ranks and tuning replicas hashed nothing. This PR captures the binding in the parent and re-enters it in the child.
Verified, per file (at head e72ec0d):
- ignition/preparation/source_identity.py:17-19 — new
current_source_roots()returning_EXTRA_ROOTS.get(); the whole functional addition to this file (+5/−0). - ignition/preparation/rank_group.py:44-45 —
_peer(..., extra_source_roots=()); :53 importssource_roots; :59 wraps the entire peer body (preparation, export, serve/benchmark handoff,dist.destroy_process_group) inwith source_roots(extra_source_roots):. :295-298 —prepare_groupimportscurrent_source_roots, capturesextra_source_roots = current_source_roots()before thecontext.Process(...)at :309-312, where it is passed as the final positional argument (picklable). The spawn context ismp.get_context("spawn")(rank_group.py:301). - ignition/preparation/tuning_replicas.py:142 —
_replica(..., extra_source_roots=()); :158with source_roots(extra_source_roots), CoreStorage(world=plan.world_size) as storage:; :174-176prepare_recipecapturescurrent_source_roots(); :190-194 passes it as the last element of the spawnargs(context at :179). - tests/preparation/test_forward_cache_sources.py +129/−3 — three tests, described under Claims and evidence.
Load-bearing consumers the diff does not touch (they are why the binding matters): ForwardCache.__init__ mixes every *.py under each bound root into the cache key and sets self.root = root/'forwards'/key.hexdigest() (aot.py:845-855, including a ValueError for a bound root that is not a directory); source_identity() mixes (*_EXTRA_ROOTS.get(), *extra_roots) into the digest (source_identity.py:33-54, :48, :112-113); rebuild_manifest.from_plan records source_identity() (rebuild_manifest.py:327).
What the description says that the change does not fully do: it frames the bug as a ForwardCache._prepare_ranks agreement failure (see Key finding 2) and implies broader "same-SKU multi-GPU" coverage than the two local-spawn paths actually deliver. What the change does beyond the description: nothing in behaviour, but the description omits the rebuild_manifest identity consequence and the _resolve_recipe ordering gap.
The why
The defect is real and structural: external recipe packages can only be hashed if their directories are bound, source_roots is bound once per CLI invocation in the parent, and both spawn sites (rank_group.py:301, tuning_replicas.py:179) produce children with an empty ContextVar. ForwardCache.__init__ (aot.py:845-855) and source_identity() (source_identity.py:48) therefore diverge between rank 0 and peers, splitting the per-host compiled-forward cache directory and the identity string recorded in kernels/rebuild metadata.
Origin of the mechanism: the external-recipe split by Luke Alonso (commits da037284, 17bb3c4a, 568aeca0, 2026-11-22; later PR #545 698ee450). source_roots/_EXTRA_ROOTS first appears in source_identity.py's history at da037284; the existing source-root tests in test_forward_cache_sources.py came from the same work. The public contract is codified in AGENTS.md:382-387 ("external recipe repositories can pass their own Recipe tuples directly to ignition.cli.main(...)").
How widely it is wanted / evidence of reports: no issue in the repository reports this. The only other written-down statement of the bug is #670's description ("rank 0 hashed external recipe package roots into its ForwardCache path while spawned peer ranks did not, causing compiled-forward cache misses and FileNotFoundError during TP exports from external recipe packages (such as local-inference-lab/hyperflare-recipes)"), opened the same day. #668 reports a different ForwardCache key defect (missing B12X_* env), #651 tracks multi-host autotune divergence. So the "why" rests on two same-week PR descriptions and no user report.
Related work
- #670 (open, lukealonso, +823/−267, head
0aeb2c1) — competing/overlapping: contains the identicalrank_group.pyfix (+21/−16 there vs #678's +91/−85 for the same edit), plus an unrelated Helios parser feature. Does not touchtuning_replicas.pyorsource_identity.py. Its Autobot review (2026-12-02 01:03) asked to "add a CPU-only unit test for peer_EXTRA_ROOTSpropagation… no test file added" (which #678 supplies) and suggested "splitting theignition/preparation/rank_group.pypeer source-root fix into its own PR" (which #678 effectively is). Merge-order conflict on rank_group.py:44-59/295-311. - #597 (open, same author,
brandonmmusic-max) — the closest predecessor and the probable source of #678's stated symptom: it adds the_prepare_rankssame-SKU cache-root agreement check (RuntimeErrorwhen ranks sharing a GPU product name resolve different cache scopes) and shares #678's SM120 2-GPU same-SKU / 4-GPU mixed-SKU test rig. Complementary (diagnostic check + root-cause fix) but neither PR cites the other. - #668 (open, lukealonso, +423/−44, area:preparation, priority:P2) — touches
aot.py(ForwardCache key) andtests/preparation/test_forward_cache_sources.py; no_EXTRA_ROOTS/rank_groupchanges. Textual conflict risk confined to the shared test file. - #675 (open, Reederey87) — multi-host analogue (
b12x_environmentforwarded to peer ranks inhost_ranks.py/serve.py); Autobot stopped its review because #668 covers it. Same "spawned/remote peer loses parent state" bug class, converging on the same week, and shows the multi-host half of this problem is being worked separately. - #664 (open, kbenkhaled) also edits
ignition/preparation/rank_group.py. Last merged changes nearby: #667 (1fbcc3c9, multi-host peer exports), #647 (f2ca2c41), #546/#433 (tuning replicas), #504 (rank_group). None of these touch_peer's prologue. - Superseded/undone: nothing — the PR reverses no prior work; there are no default-branch commits since the branch point (
1fbcc3c→e72ec0d) touching its files.
Recent activity
ignition/preparation in the last 60 days: 1fbcc3c9 (#667) "Harden Orbit payload integrity, multi-deployment TP seams, GB10 page-cache release, Unix flock drop, multi-host peer exports"; f2ca2c41 (#647) "Fix externalized core signing, stream-0 weight race, export I/O, multi-host tuning"; 555db719 (#648) "Migrate ignition runtime patches and preparation onto public b12x contracts"; e80b1f2f (#618) "decouple signed bodies, single-pass export, slice synthesis". #678 builds on this hardening work without reversing it; the trend is toward multi-host peer correctness (#667, #668, #675), the one axis #678 leaves alone.
People
- Author
brandonmmusic-max: 2 merged (#162, #154), 4 closed (#480, #468, #215, #163), 5 open (#597, #475, #458, #457, #678). Merged areas: heliopause/src, helios, helios/src, helios/tests, ignition/preparation. #597 is the substantive predecessor for this subsystem; it went through 6 Autobot review rounds (Changes Requested→Ready To Merge, head0d794b5, 2026-12-01 20:03). Discord "Brandonmusic". - Area owners (last 180 days of commits):
ignition/preparation— Luke Alonso 161, Martin Vit 52, Eugene Rakhmatulin 36;tests/preparation— Luke Alonso 207, Martin Vit 34, jasonc 23. Luke Alonso is a priority contributor per the charter and is the author of the external-recipe split (#545) that created_EXTRA_ROOTS, and also author of the competing #670 — so the person most likely to review #678 has already written its core hunk elsewhere. - Engagement: nobody. No comments, reviews or reactions on #678 as of the last read (
Discussion (0)).
Community
Nothing to report: 0 comments, 0 reviews, 0 reactions, no linked issues, no cross-references in either direction with #670, #597 or #668. Interest signals are indirect only — three same-week open PRs (#668, #670, #675) in the adjacent ForwardCache/peer-state surface.
Project fit
As facts, from the charter (read_charter) and repository docs:
- Charter, How We Work: "Solve the right problem in the right place … Look for the smallest footprint in shared code"; "Bring real evidence … Bug fixes need to address the root cause; don't just swallow, skip, or retry an unexplained error (#397)". #678 fixes the binding instead of relaxing the hash, edits only shared
ignition/preparation, and adds no CLI flag, env var, plugin or model branch — it lines up on both counts. - Charter, "Keep the runtime small and model-agnostic. Ignition writes the recipes…"; AGENTS.md:382-387 says external recipe repos pass
Recipetuples toignition.cli.main(...)and that "Coreignitionmust never importhyperflare_recipesor introduce a plugin discovery framework." #678 makes exactly that documented entrypoint work under TP, and adds neither import nor discovery. - Charter goal "Prepare supported model recipes with Ignition and serve captured CUDA graphs from Rust on SM103, SM120, and SM121" — evidence is SM120, inside the supported matrix.
- Charter, "PR descriptions: Expect four parts" (why / what / claimed result / evidence): #678 has all four plus an explicit limitations paragraph — above the bar.
- Where it does not line up / is silent: no documentation update anywhere (no docstring change in
source_roots, whose docstring at source_identity.py:24 still says "for the duration of a CLI invocation" although the new callers use it around spawned-process preparation); no mention of the multi-host peer path that remains broken; nothing in the docs describes the source-root hashing contract for external recipe authors.
Claims and evidence
| Claim (from the body) | What backs it | Status |
|---|---|---|
Peers fail "the cache-root agreement check in ForwardCache._prepare_ranks" |
Nothing on main; the check is added by #597 |
Not supported on main; most likely observed on a stack including unmerged #597 |
"Ensures rank 0, spawned TP peer ranks and spawned local tuning replicas compute identical ForwardCache root digests and source_identity hashes" |
Code does bind the roots in the children (rank_group.py:59, tuning_replicas.py:158); tests only assert that the ContextVar value is visible in the child (test_forward_cache_sources.py:83-110, 113-119, 186-188) | Mechanism is in the diff; the equal-digest assertion is not tested |
| 35 passed / 0 failed across 7 test files, CPU-only | Author-reported; not reproducible here (no run). Tests are real spawn and Linux-only (skipif sys.platform != "linux", test_forward_cache_sources.py:93, 157) |
Plausible; CI would run them (.github/workflows/python-cpu.yml:30-33 (not opened) runs pytest tests/ -q with CUDA_VISIBLE_DEVICES="") but no checks exist on e72ec0d |
End-to-end SM120 2-GPU same-SKU and 4-GPU mixed-SKU hyperflare_recipes.cli export completed |
Author-reported only; no logs, no artifact, no CI; the same rig appears in #597's evidence | Unverified |
Backward compatibility: extra_source_roots=() default |
Verified: in-tree callers use positional args that stay valid — tests/preparation/test_native_processes.py:228-229 (10 positional args), test_models… patched *args callers; nothing passes the new arg |
Holds |
| "No model core format, Helios ABI, or single-GPU preparation behavior changes" | Verified: no changes outside ignition/preparation, none in helios/heliopause/core layout; core ignition export never binds roots so its keys are byte-identical (cli/init.py:364-370 is the only binding site) |
Holds, with one caveat: for external-recipe launches, peer-written rebuild metadata (rebuild_manifest.py:327) now carries rank 0's identity where it previously carried a rootless one — a behaviour change in recorded artifacts the body does not mention |
Limitation stated: replica test stubs torch.cuda.set_device/synchronize/CoreStorage |
Confirmed at test_forward_cache_sources.py:146-154 (_cpu_replica_entry) |
Accurate |
Test coverage, precisely: test_current_source_roots_reflects_active_scope (:71-80) nesting/reset; test_prepare_group_propagates_source_roots_to_spawned_peer (:93-110) real spawn + loopback Gloo over the TemporaryDirectory rendezvous, asserts both ranks' memory reports carry (("external_recipes", str(external)),); test_prepare_recipe_propagates_source_roots_to_spawned_tuning_replica (:157-188) real spawn, asserts both replica-N.txt files contain the label/path. Not covered: multi-host ignition join (host_ranks.py), and the _resolve_recipe-before-binding ordering.
Reach
- Who/what changes: only launches that go through
ignition.cli.main(..., source_roots=...)— i.e. external recipe CLIs. The in-tree caller of that kwarg is the test at tests/cli/test_recipe_injection.py:78-98 (not opened). Plainignition export/serve/convertnever binds roots, so its behaviour, cache keys and on-disk artifacts are unchanged (verified by grep:source_rootsappears only at cli/init.py:364-370, rank_group.py:59/295/298/309-311, tuning_replicas.py:145/158/174/176). - Defaults/compat: new kwarg is trailing and defaulted in both
_peer(rank_group.py:44-45) and_replica(tuning_replicas.py:142); no signature-breaking change. - Effect: peers now share rank 0's per-host
ForwardCachedirectory (aot.py:855) and produce the samesource_identitystring, so compiled forwards are reused rather than missed;rebuild_manifestentries from peers gain rank 0's identity string. - Not reached: multi-host peers (
ignition join→ serve.py:528-549, host_ranks.py:270-271 admission identity check, :629-657 remote source/prepare). Users exporting from an external recipe CLI across hosts still hit the identity mismatch described at host_ranks.py:271 ("source identity differs from rank zero's; every host must run the same checkout"). - Dependencies/deployment/docs: none added or changed; no operator-visible configuration.
Process
- Draft or ready: marked ready for review; 4 files, +233/−91; single commit-ish head
e72ec0d. - CI: no checks on the head commit (orientation packet). The CPU workflow (.github/workflows/python-cpu.yml:30-33 (not opened)) would exercise the new tests if triggered.
- Review state: none — no reviewer assigned, no Autobot review visible on #678, no human comment.
- Age: opened 2026-12-02 10:57, last updated the same minute; #670 predates it by ~10 hours and already contains the main hunk; #675 was opened seven minutes earlier on the multi-host analogue.
Open questions / could not be found
- Does the author intend #678 to supersede #670's
rank_group.pyhunk, or to stack on #597? Neither PR mentions it; the head commit message and body give no cross-reference. - Was the observed "cache-root agreement" failure actually produced by #597's new check? The body's wording implies so, but nothing states the stack. This matters because on
mainalone the bug's symptom differs (FileNotFoundError/cache miss), which affects how the fix is verified. - Should
tuning_replicas._replicabind roots before_resolve_recipe(tuning_replicas.py:155)? As written, a recipe importable only via a bound external root still cannot resolve in the replica child. - Is the multi-host
ignition joinpath deliberately out of scope (deferring to #668/#675), or overlooked? The body's scope sentence suggests deliberate, but it is not stated and no follow-up is referenced. - No issue, benchmark, or user report exists to corroborate the "unblocks same-SKU multi-GPU exports" benefit; no CI run and no review comment on
e72ec0dto independently confirm the 35-passed claim.