Skip to content

Minitest: Initialize test runs before checking retry expiry - #102

Merged
ckwarteng merged 3 commits into
masterfrom
ckwarteng/initialize-ci-queue-before-retry
Oct 5, 2026
Merged

ckwarteng merged 3 commits into
masterfrom
ckwarteng/initialize-ci-queue-before-retry

Conversation

@ckwarteng

@ckwarteng ckwarteng commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Written by AI, edited by me

Buildkite can retry a job before it ever reaches minitest-queue. The runner checks retry expiry before initializing the run timestamp, interprets the missing timestamp as expired data, and aborts with "The test run is too old and can't be retried". We fix this by initializing the run timestamp before checking retry expiry. Initialization only writes a missing timestamp, preserving the original age of existing runs.

In the example Figma build, the original worker was spot-terminated during setup, before Run tests. Both replacement attempts hit this error despite the build being only minutes old.

Validation

  • All six added regression tests pass locally: 45 assertions. Fresh retries reproduced the original error before the fix.
  • GitHub Actions on Ruby 3.0, 3.1, 3.2, and 3.3: all 246 tests pass in each job (1,362 assertions, zero failures or errors).
  • The test bundle constrains JSON to < 3 for compatibility with its existing ActiveSupport 5.2 fixture; this does not change the packaged runtime dependencies.

@ckwarteng ckwarteng closed this Oct 5, 2026
@ckwarteng ckwarteng reopened this Oct 5, 2026
@ckwarteng
ckwarteng marked this pull request as ready for review October 5, 2026 17:32
@ckwarteng
ckwarteng requested review from a team, michaelnyu, pratham-figma and yfang-figma and removed request for a team October 5, 2026 17:37
@ckwarteng ckwarteng changed the title ruby: Initialize test runs before checking retry expiry Minitest: Initialize test runs before checking retry expiry Oct 5, 2026
@ckwarteng
ckwarteng requested a review from ebarajas October 5, 2026 17:52

@ebarajas ebarajas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch!


def expired?
(@created_at.to_f TEN_MINUTES) < CI::Queue.time_now.to_f
(@created_at.to_f + TEN_MINUTES) < CI::Queue.time_now.to_f

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol i really hate ruby sometimes

@ckwarteng
ckwarteng merged commit feb3e30 into master Oct 5, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants