Add Connect tunnel retry jitter and request-correlated diagnostics - #2064
Open
jshph wants to merge 1 commit into
Open
Add Connect tunnel retry jitter and request-correlated diagnostics#2064jshph wants to merge 1 commit into
jshph wants to merge 1 commit into
Conversation
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.
User-facing story
The direct retry defect behind that experience is already fixed on
mainby #1784: an installedwsunexpected-responselistener owns handshake cleanup, so Connect must drain and terminate the rejected socket and schedule a retry instead of waiting for acloseevent that may never arrive.This follow-up is based on the production incident and adds the pieces needed to prevent a reconnect wave and identify the next upstream failure precisely.
What changes
lastErrorwhen the rejected response provides one./__tunnellabel resolution, credential hashing, Durable Object binding, and Durable Object dispatch with a request-correlated error boundary.x-bb-request-idon caught 500 responses and forward it into the Durable Object request.remote,retryable, andoverloadedflags.Incident assessment
Confirmed:
/__tunnelhas no intentional 500 response. Its expected rejections are 401, 403, 404, or 426, so the observed 500 was an uncaught Worker/D1/Durable Object exception or a Cloudflare-generated internal failure.Most likely, but not provable without the original Ray ID or Workers observability event: a transient Durable Objects failure. The timing overlaps Cloudflare incidents for Durable Objects and downstream services and elevated Durable Object errors; manual reload succeeded just after the latter moved to monitoring. A fresh D1 lookup failure remains another plausible path.
This PR deliberately does not add a speculative server-side retry. Cloudflare recommends distinguishing
retryableandoverloadedDurable Object errors and creating a fresh stub before retrying; the new structured boundary supplies the evidence needed to design that separately from the confirmed client recovery behavior. That infrastructure follow-up is tracked in #2065.Verification
bb-plugin-connect: 93 tests pass, including 429/500 recovery withoutclose, deterministic jitter/deadline state, late-close deduplication, successful replacement, and 401/403 stop behavior.@bb/connect: 106 tests pass, including request-correlated D1 and Durable Object failures and credential-redaction assertions.git diff --checkpasses.No production deployment or credential change is included.