ruby: Recover retried worker history - #96
Open
dpashk-figma wants to merge 3 commits into
Open
Conversation
dpashk-figma
marked this pull request as ready for review
August 6, 2026 19:37
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit cb156e1. Configure here.
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
The existing Redis worker log records every reservation made by a worker, but normal retry behavior intersects that log with the build’s failed-test set. That is appropriate for test failure recovery, but not for process-local artifacts such as SimpleCov output: tests that passed before a worker was terminated disappear from the retried process’s coverage data and are not selected by a failure-only retry.
This change introduces an opt-in recovery path:
--retry-modedefaults tofailures, so existing callers retain their current behavior.Durable history reconstruction
Worker#worker_historyreads that list and restores chronological reservation order.Two-phase recovery queue
WorkerHistoryRecoverywraps the original Redis worker and presents the same queue interface to Minitest:Keeping both phases in one process is important for coverage: SimpleCov accumulates the replayed history and any newly claimed shared work into one result set. It also supports repeated Buildkite retries. The worker’s durable history is retained, and reservations made after the shared queue resumes are appended for the next retry.
Recovery evidence
When
--recovery-manifestis supplied, a Minitest reporter writes JSON only after the queue is exhausted and any required replay completed. A terminated worker or incomplete replay leaves no manifest.The manifest records:
A successful first attempt records zero replay counts,
replay_completed: true, andresumed_shared_queue: false. A successful worker-history retry records positive history/replay counts and both completion booleans as true. Downstream artifact producers can therefore reject incomplete or failure-only retries instead of silently publishing partial data.Compatibility and operating assumptions
Fixes: https://app.asana.com/1/10497086658021/project/1217018759338815/task/1217018759338827
Test Plan
bundle exec rake build.