fix(vite-plugin): retry transient module-transport failures in the runner worker - #14851
Merged
Merged
Conversation
…nner worker A single failed fetchModule invoke is cached by Vite's module runner and poisons the module graph for the rest of the dev session. The invoke is an idempotent request for module code, so retry it up to three times before giving up. Fixes cloudflare#14849
🦋 Changeset detectedLatest commit: 3f166c1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
workers-devprod
requested review from
a team and
edmundhung
and removed request for
a team
July 26, 2026 01:50
Contributor
|
Codeowners approval required for this PR:
Show detailed file reviewers |
@cloudflare/autoconfig
@cloudflare/config
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
edmundhung
approved these changes
Jul 28, 2026
edmundhung
left a comment
Member
There was a problem hiding this comment.
Thanks for the fix.
I think it is fine to merge without test as the retry is hard to replicate in test environment and the change is small enough. Our existing tests should also cover the happy path.
workers-devprod
approved these changes
Jul 28, 2026
workers-devprod
left a comment
Contributor
There was a problem hiding this comment.
Codeowners reviews satisfied
Member
|
Don't worry about CI flakes. I will sort them out. |
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 #14849.
Each
fetchModuleinvoke in the runner worker's module-runner transport was a single fetch to the dev server with no retry. If that one fetch failed transiently (e.g.Network connection lostfrom the loopback keep-alive race in #14848), Vite's module runner cached the rejection, and every request importing the affected module failed for the rest of the dev session — one transient hiccup out of thousands of module fetches permanently bricked the session until a file edit or dev-server restart.This change retries the invoke fetch up to three times before giving up. The invoke is an idempotent request for module code, so retrying is safe, and it converts a rare transient transport error into a non-event.
This complements the root-cause fix for the specific trigger I could reproduce (#14848 / #14850): even with that fixed, any other short-lived hiccup on the loopback path would still poison the session without a retry.