test(cloudflare): Add headroom for wrangler cold-start in integration tests#22083
Merged
Conversation
… tests The Cloudflare integration tests flake on CI. Each test spawns its own `wrangler dev` (cold workerd boot), makes a request, and waits for envelopes to be delivered to the mock server. The runner has no internal timeout, so it relies entirely on Vitest's `testTimeout`; and `fetchWithRetry` only tolerates a ~2s "ready-but-not-serving" window. Both are tight given how slow and variable wrangler cold-start is on a loaded CI runner (locally these tests finish in <5s, but CI cold-start can stall for much longer). - Raise `testTimeout` from 30s to 60s. - Raise the `fetchWithRetry` budget from 10 to 25 attempts (~2s -> ~5s) to cover a longer ready-but-not-serving window. Both are pure ceilings with no happy-path cost — tests still complete as soon as the worker serves and envelopes arrive. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
andreiborza
approved these changes
Jul 8, 2026
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.
The Cloudflare integration tests are a recurring source of flaky-CI reports across several suites.
Root cause
Every test spawns its own
wrangler dev(cold workerd boot), makes a request, and waits for envelopes to be delivered to the mock server. Two ceilings are tight for how slow and variable wrangler cold-start is on a loaded CI runner:testTimeout(was 30s). Cold-start + async work (Durable Objects, Workflows) + envelope delivery must all fit in that budget.fetchWithRetry— which the runner already uses to paper over wrangler's "reports Ready before it can serve" race — only tolerated a ~2s window.Locally these tests finish in <5s and I could not reproduce a failure across 80+ runs, which is consistent with a low-rate, load-dependent cold-start stall rather than a logic bug.
Fix
testTimeout30s → 60s.fetchWithRetrybudget 10 → 25 attempts (~2s → ~5s).Both are pure ceilings — tests complete as soon as the worker serves and envelopes arrive, so there's no happy-path cost and no assertion changes.
Since I couldn't reproduce locally or retrieve the (expired) CI logs, these target the two documented/architectural races of the spawn-wrangler-per-test setup. If a specific suite keeps flaking afterwards with a fast, deterministic failure (e.g. a 500 response or a wrong assertion), that would indicate a genuine intermittent bug in that suite needing its own investigation.
Fixes #22047
Fixes #21916
Fixes #21831
Fixes #21665
🤖 Generated with Claude Code