fix(runner): run file teardown after the file's tests in parallel - #1327
Merged
Chemaclass merged 1 commit intoAug 19, 2026
Merged
Conversation
Under --parallel the runner dispatched the file's tests as a background worker and ran tear_down_after_script in the parent on the next line, so the hook released the fixture its own tests were still reading. The same file passed sequentially and failed in parallel. Move the hook into the worker, after call_test_functions, which already waits for its per-test workers before returning. A hook failure recorded in a worker dies with the subshell, so publish it as a .result payload for the aggregator to count, the way a test publishes its own. Waiting on the worker from the parent was the other option. Measured on this suite it cost 12s of 52s: two slow acceptance files that define the hook stopped overlapping with anything. Closes #1320
Chemaclass
deleted the
fix/1320-tear-down-after-script-runs-before-tests-parallel
branch
August 19, 2026 18:10
5 tasks
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🤔 Background
Related #1320
Under
--parallelthe runner dispatched a file's tests as a background worker and rantear_down_after_scriptin the parent on the next line, so the hook released the fixture its own tests were still reading. The same file passed sequentially and failed in parallel.💡 Changes
call_test_functionsalready waits for its per-test workers, which is what makes the ordering hold..resultpayload so the parent still counts it. A failure recorded inside a worker dies with the subshell, and without this the hook error printed while the run reportedAll tests passed.docs/ai-agents.mdcaveat that told authors not to release a shared fixture in the hook. It existed only to work around this.