Skip to content

[wrangler] Fix requests hanging after local Worker reloads - #16862

Merged
petebacondarwin merged 1 commit into
mainfrom
codex/fix-proxy-worker-reload-retry
Nov 12, 2026
Merged

petebacondarwin merged 1 commit into
mainfrom
codex/fix-proxy-worker-reload-retry

Conversation

@petebacondarwin

@petebacondarwin petebacondarwin commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Fix local requests hanging when their connection to the previous Worker fails after its replacement is already ready. ProxyWorker now drains the retry queue immediately after requeueing a stale request. If the proxy is still paused, the request remains buffered until play arrives.

Previously, the rejection handler assumed a future play would drain the queue. When play had already arrived, the request remained pending until another request triggered queue processing. This addresses the Windows reload timeout observed in #16849. Workerd's additional HTTP retry can expose this ordering, but Wrangler must handle a late rejection regardless of the runtime's timing.

Add deterministic regression coverage for the old request failing both before and after the replacement becomes ready. The late-failure case fails without the fix. This queue belongs to Wrangler; Miniflare, the Vite plugin, and the Vitest plugin do not need changes.

Validated locally on macOS:

  • Development controller tests: 13 files, 138 tests passed (8 existing todos).
  • Existing inflight requests are retried during UserWorker reloads E2E test passed.
  • Wrangler build, check:type, and type:tests passed.
  • Targeted oxlint, formatting, and git diff --check passed.

Windows verification is left to CI.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: this restores existing local development request retry behavior without changing configuration or public APIs.

Devin Review

@changeset-bot

changeset-bot Bot commented Nov 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1f0ecbb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
wrangler Patch
@cloudflare/vitest-plugin Patch

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

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Nov 12, 2026
@workers-devprod
workers-devprod requested review from a team and cjol and removed request for a team November 12, 2026 14:49
@workers-devprod

workers-devprod commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@devin-ai-integration devin-ai-integration Bot 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@ask-bonk

ask-bonk Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

LGTM!

github run

@clanky-the-clanker clanky-the-clanker Bot 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.

✅ Approved — Small, correct fix to how the retry queue is drained, with regression tests for both orderings; no issues found.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

No security concerns.


📖 AGENTS.md: ✅ LGTM

No AGENTS.md updates are needed.


📋 Code Quality: ✅ LGTM

Draining the queue straight after a request is queued again is correct. While the proxy is paused processQueue does nothing, and once play has arrived it retries the request immediately. The regression tests cover both orderings.


⚡ Performance: ✅ LGTM

No performance concerns.


📝 Documentation: ✅ LGTM

The changeset is present, and the updated comment explains why the queue is drained at that point.


Reviewed commit: 1f0ecbbf

@pkg-pr-new

pkg-pr-new Bot commented Nov 12, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@16862

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@16862

@cloudflare/codemods

npm i https://pkg.pr.new/@cloudflare/codemods@16862

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@16862

@cloudflare/containers-shared

npm i https://pkg.pr.new/@cloudflare/containers-shared@16862

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@16862

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@16862

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@16862

miniflare

npm i https://pkg.pr.new/miniflare@16862

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@16862

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@16862

@cloudflare/runtime-types

npm i https://pkg.pr.new/@cloudflare/runtime-types@16862

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@16862

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@16862

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/@cloudflare/vitest-plugin@16862

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@16862

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@16862

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@16862

wrangler

npm i https://pkg.pr.new/wrangler@16862

commit: 1f0ecbb

@petebacondarwin petebacondarwin added ci:e2e Run wrangler + vite-plugin E2E tests on a pull request ci:run-remote-tests Run remote/E2E tests that require Cloudflare API credentials labels Nov 12, 2026

@workers-devprod workers-devprod 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.

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Nov 12, 2026
@petebacondarwin
petebacondarwin enabled auto-merge (squash) November 12, 2026 15:14
@petebacondarwin
petebacondarwin merged commit c889551 into main Nov 12, 2026
109 of 124 checks passed
@petebacondarwin
petebacondarwin deleted the codex/fix-proxy-worker-reload-retry branch November 12, 2026 15:21
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Nov 12, 2026
edmundhung added a commit that referenced this pull request Nov 17, 2026
Now that a reload is detected by a new proxyData rather than a changed
URL, a root-path GET whose old-preview connection fails after the
replacement `play` has already drained the queues is requeued with
nothing left to drain it. Before, the URLs matched and the request
failed instead. Drain right after requeueing, as Wrangler does since
#16862; processQueue still waits while the proxy is paused.

Replace the POST reload test with a GET where `play` completes before
the old connection drops, and say in the changeset that only GET and
HEAD requests are retried.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:e2e Run wrangler + vite-plugin E2E tests on a pull request ci:run-remote-tests Run remote/E2E tests that require Cloudflare API credentials

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants