Fix xdist collisions for captured_info artifacts and preserve CI debug logs#45645
Open
stationeros wants to merge 5 commits intohuggingface:mainfrom
Open
Fix xdist collisions for captured_info artifacts and preserve CI debug logs#45645stationeros wants to merge 5 commits intohuggingface:mainfrom
stationeros wants to merge 5 commits intohuggingface:mainfrom
Conversation
4 tasks
This was referenced Apr 27, 2026
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.
What does this PR do?
Fixes #45561.
This PR fixes a race in the test failure reporting flow when the suite is run with
pytest-xdist.Right now every worker writes debug output to the same
captured_info.txtfile. In parallel runs that means workers can overwrite each other’s output, and in some cases one worker can remove the file another worker was still relying on. The end result is flaky or incomplete failure logs, which makes CI failures much harder to debug.The fix keeps the current behavior for non-xdist runs, but switches to worker-specific files when
PYTEST_XDIST_WORKERis set. So instead of multiple workers all writing to the same file, each one writes its owncaptured_info_<worker>.txt.Along with that, this PR also updates the surrounding plumbing so the debug info still shows up where people expect it:
captured_info*.txtfiles instead of assuming there is only one.captured_info*.txtfiles are cleaned up before a new collection starts so repeated runs do not pick up leftovers from earlier failures.I also added tests covering:
Code Agent Policy
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
This touches test infrastructure / CI behavior, so @ydshieh seems like the most relevant reviewer.