You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Hackathon] fix(rerun): a failed deferred-retry chunk discards runs the earlier retry chunks already started and tells the user to rerun them #491
In test rerun --wait (explicit ids or --all), when more than 50 tests stay rate-deferred, the deferred-retry loop dispatches retry chunks sequentially into retryChunkResponses (test.ts:13003-13057). If a later chunk throws on the non-tunnel path, the catch logs and breaks (:13058-13068). The merge of the chunks that already succeeded (accepted, conflicts, notFound, and deferred = newlyDeferred at :13122) sits after the try block, so it is skipped. The tunnel branch of the same catch already calls emitRetryPartial(err, retryChunkResponses); only the ordinary path drops them.
Effect: runs the server accepted in earlier retry chunks are never polled or printed, their ids stay in deferred, the command exits 7, and nextAction says testsprite test rerun <ids> for tests that are already running. Following that hint uses a fresh idempotency key, so it double-dispatches and double-bills.
Trigger: a project over the 50 in-flight cap (so the retry splits into chunks); chunk 0 is accepted, chunk 1 fails with a whole-request 404 (one id lost its replayable run, a documented response shape) or a 5xx after retries.
POST batch/rerun #3 size=50 key=...:deferred-retry1:chunk0 (server accepts 50)
POST batch/rerun #4 size=2 key=...:deferred-retry1:chunk1 (404)
EXIT 7 52 test(s) were rate-deferred.
nextAction testsprite test rerun test_001 test_002 ...
server created runs: 51
stdout accepted runs: 1 deferred: 52
runIds visible anywhere in stdout+stderr: 1
Why tests miss it: test.rerun.spec.ts covers retry success, all-deferred and tunnel partials, but no non-tunnel case where a later retry chunk throws after an earlier one succeeded.
Proposed fix (local to the catch, no new dependency): before break, fold the successful retryChunkResponses into accepted / conflicts / notFound / advisories using the same merge code as the success path (extract it into a small local function), and keep in deferred only the failed chunk's ids plus chunks never attempted. Surface the failed chunk's error on stderr as today.
Tests: the 53-id scenario polls and prints 51 run ids, deferred holds only the 2 failed-chunk ids, and nextAction lists only those; existing tunnel-partial tests unchanged.
Not a duplicate: #405 / PR #410 fix the same symptom in the initial dispatch loop (test.ts ~12783-12828); PR #410's diff does not touch the deferred-retry loop. #477 is skipped-array merging in test run --all retries (test.ts ~10264), #471 is exit-code precedence, #426 is a signal during retry sleep. PR to follow once assigned.
Confirmations
I have searched existing issues and this is not a duplicate.
I have provided my Discord identity above for reward coordination.
Thanks @crypticsaiyan for the detailed write-up. The mechanism is real in v0.15.0: on the non-tunnel path a failing deferred-retry chunk logs and breaks, and only the tunnel path emits partial results (test.ts).
But test rerun is being folded into test run, deprecated in an upcoming release and removed in 1.0, so we're not taking rerun-only changes. On double dispatch: the server refuses a new run for a test already in flight, so following nextAction should not start duplicates. Tracked internally as DEV-2028. Closing as not planned.
Activity
zeshi-du commentedon Oct 20, 2026
Thanks @crypticsaiyan for the detailed write-up. The mechanism is real in v0.15.0: on the non-tunnel path a failing deferred-retry chunk logs and breaks, and only the tunnel path emits partial results (test.ts).
But
test rerunis being folded intotest run, deprecated in an upcoming release and removed in 1.0, so we're not taking rerun-only changes. On double dispatch: the server refuses a new run for a test already in flight, so followingnextActionshould not start duplicates. Tracked internally as DEV-2028. Closing as not planned.