Wait for the continuable job to start before interrupting it - #767
Merged
Conversation
The test slept a fixed 0.2 seconds after enqueuing and then signaled TERM, assuming the job would be mid-step by then. On a slow runner the signal could arrive before any worker had even claimed the job, and the wait for released jobs would return immediately, unable to tell "released" from "never claimed", so the test asserted against a job result that hadn't been touched yet. Have the job write a "started" marker at the top of its first step and wait for it before signaling, so the interruption always lands while the job is paused inside step one, which is the scenario the test exists to check: interrupt between steps, resume, complete. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Fixes the
ContinuationTest#test_continuable_job_can_be_interrupted_and_resumedflake seen twice this week on mysql (on #764's and #765's CI runs), failing withExpected: "stepped" / Actual: nil.CI log forensics (first-attempt logs + the
test.logartifacts) showed TERM arriving before any worker had claimed the job — the fixedsleep 0.2wasn't enough on a loaded runner.wait_for_jobs_to_be_released_forthen returned vacuously (zero claimed executions means it can't distinguish "released" from "never claimed"), and the assertions ran against an untouchedJobResult. The artifact timeline even shows the job being claimed ~120ms after the failed assertion and then interrupting perfectly cleanly — the test just asserted too early. Reproduced locally 5/5 by shrinking the sleep, with the exact CI signature.Same deterministic pattern as the other lifecycle fixes: the job now writes a
"started"marker at the top ofstep_one, and the test waits for it before signaling, so TERM always lands while the job is paused inside step one. The 0.5s pause stays as-is deliberately — it must complete within the pool's shutdown timeout for the graceful between-steps interruption the test verifies.Stability: 50 stress runs on mysql post-fix (only noise: one proven host-clock-jump from a laptop suspend), full file 10/10 green on rails_main.
🤖 Generated with Claude Code