Fix summary step to wait for retry workers before reporting#393
Merged
Conversation
When Buildkite retries a job, the main queue is already exhausted from the original run. A retry worker may find unresolved failures via the error-reports fallback and start re-running them via the Retry queue. But those tests are not in the Redis running set, so active_workers? returns false and the summary's wait_for_workers loop exits immediately on exhausted? — canceling the retry worker before it can clear the error-report. Fix: after the main loop exits due to exhausted?, if this is a retry run (BUILDKITE_RETRY_COUNT > 0) and error-reports are still non-empty, wait up to inactive_workers_timeout for retry workers to clear them.
Covers the case where wait_for_workers must stay open on a retry run until retry workers clear error-reports. Also verifies the secondary wait is skipped when BUILDKITE_RETRY_COUNT is not set.
…ailures When workers die before flushing per-test stats, error-reports has the authoritative failure data but the aggregated stats show 0. This caused the summary line to say "0 failures, 0 errors" in green while simultaneously printing a FAILED TESTS SUMMARY below it. Also moves FakeEntry/fake_entry test helper to a shared support file so it's available across all test files without cross-file dependencies.
Contributor
Author
|
Verified end-to-end on https://buildkite.com/shopify/world-shopify-selective-tests/builds/903009 -- |
thadcraft-shopify
approved these changes
Apr 8, 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.
Two fixes for the retry summary step.
The race condition: previously,
wait_for_workerswould see the queue as exhausted and exit immediately on retry runs -- before the retry worker had a chance to re-run the failed tests and clearerror-reports. This meant the summary step would report failures that were about to be fixed.wait_for_workersnow stays open on retry runs (BUILDKITE_RETRY_COUNT > 0) untilerror-reportsis empty orinactive_workers_timeoutexpires.The misleading stats line: when workers die before flushing their per-test stats, the summary line would show "0 failures, 0 errors" in green while simultaneously printing a
FAILED TESTS SUMMARYbelow it.aggregatesnow useserror-reportsas a floor for the failure count, so the line can never be misleadingly green when failures are known.