This repository was archived by the owner on Jul 17, 2026. It is now read-only.
fix(run): exit after profile.async_test — donation has consumed state#968
Open
claude-spd1 wants to merge 1 commit into
Open
fix(run): exit after profile.async_test — donation has consumed state#968claude-spd1 wants to merge 1 commit into
claude-spd1 wants to merge 1 commit into
Conversation
The async_test block calls the donating step_fn (donate=all-except-first) on `state` without rebinding it, then fell through to the mem_profile path and the main loop holding deleted buffers — guaranteed "Array has been deleted" whenever async_test was combined with a normal run. Mirror the mem_profile guard: os._exit(0) at the end of the block, plus a ProfileConfig validator refusing async_test+mem_profile together (each exits before the other could run). Audit finding M2 (2026-07-10 compile audit). Crew-Address: task/fix-async-test-donated-state Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
profile.async_test(run.py) calls the donatingstep_fn(donate="all-except-first") three times starting fromstateand never rebinds it — results land in locals whilestatekeeps naming the donated (deleted) buffers. Control then falls through to the mem_profile path and the main training loop, which die with "Array has been deleted" the moment they touchstate.Two changes, mirroring how the mem_profile path already guards the identical situation:
os._exit(0)at the end of the async_test block (same guard + comment as mem_profile's at the end of its block).ProfileConfigvalidator refusingasync_test+mem_profilein one config — each hook now exits before the loop, so combining them would silently skip whichever runs second. Refuse at config-parse time instead.Related Issue
Audit finding M2 from the 2026-07-10 JAX compile audit (latent correctness, profiling flag only). Refs against feature/jax @ eb786f7.
Motivation and Context
async_test alone happened to work only because nothing after it ran; combined with a normal run or mem_profile it was a guaranteed crash. Precedent for loud donation guards: PR #932 (resume-oom donation fix).
How Has This Been Tested?
test_config.py::test_profile_exiting_hooks_are_mutually_exclusivepins the validator (each flag alone validates; together refuses).param_decomp/tests/test_config.pypasses (15/15).Does this PR introduce a breaking change?
No. A config setting both
async_test: trueandmem_profile: truenow refuses at validation — previously it would have crashed mid-run instead.Crew-Address: task/fix-async-test-donated-state
🤖 Generated with Claude Code