ruby: Replay worker history on retries - #99
Merged
Conversation
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.
Describe
Implementation design
A Redis worker already records every reservation it receives. The existing retry path intersects those reservations with the build's failed-test set. That is correct for rerunning failures, but it cannot reconstruct process-local output such as SimpleCov data: tests that passed before a worker was terminated are omitted from the retry.
This change makes retry selection explicit:
Minitest exposes the same choice at the CLI:
failed-testspreserves the current behavior and ordering.worker-historyreads the retried worker's existing build-scoped reservation list, restores chronological order, expands suite-bin-packing chunk reservations through their existing Redis metadata, and deduplicates test IDs while preserving first-reservation order.The replay uses the existing
Redis::Retrystatic queue. There is no recovery wrapper, second shared-queue phase, or recovery manifest. Static queues honor shutdown, and worker-history retry queues additionally require complete exhaustion: shutdown or a circuit breaker that stops replay early fails the retry rather than accepting a partial process-local artifact.Worker-history selection fails closed when:
Centralized reporting caveat
A worker-history retry does not rejoin the shared Redis queue. In the intended single-worker failure case, surviving workers continue draining shared work while the restarted worker reconstructs its own process-local output. If the full fleet is restarted before the shared queue is exhausted, no retry may remain to claim undistributed work; centralized reporting will then fail the build. This correlated-failure limitation is deliberate and documented: it may require rerunning the build, but it cannot publish an incomplete artifact as a successful run.
Fixes: https://app.asana.com/1/10497086658021/project/1217018759338815/task/1217018759338827
Test Plan
bundle exec rake buildsucceeds.