Repository navigation
test(cache): keep the backend's early answer to an upload in the e2e proxy - #985
Merged
Merged
Conversation
…proxy The remote cache e2e proxy streamed each request body to the backend as it arrived. The Worker rejects an upload without a token by its headers, answering 401 before it reads the body, and then closes the connection, which resets it if body bytes are still unread. On a slow runner, a later piece of the body could reach the proxy after that reset but before the proxy read the 401. Writing it failed with EPIPE, Node destroyed the socket with the 401 unread, and the proxy answered 502, so `remote_cache::upload_without_token` failed on macOS CI. The proxy now reads the whole request before forwarding it, so the body goes out with the headers before the backend can answer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fspy benchmarklinuxmacoswindows |
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.
Motivation
remote_cache::upload_without_tokenfailed on #969's macOS CI (job). The test expects the backend's401 Invalid credentialsfor an upload without a token. Insteadvp rungotHTTP status 502, andremote-cache-server stopreportedPOST /store failed: write EPIPE. The test predates the dry-run stack; the race is in the e2e proxy that sits in front of the backend.Changes
request.pipe(upstream)). The Worker rejects an upload by its headers and answers 401 before reading the body. workerd then closes the connection, resetting it when body bytes are still unread.upstream.end(body). The body then goes out together with the headers, before the backend can answer, and an error after the answer is ignored, as before.🤖 Generated with Claude Code
Note
Low Risk
Changes only the e2e remote-cache proxy’s request forwarding; production cache paths are unaffected.
Overview
Fixes a race in the e2e remote-cache proxy where uploads without a token were reported as 502 instead of the backend’s early 401.
The tap no longer streams the client body with
request.pipe(upstream). It buffers the full request, then sends it withupstream.end(Buffer.concat(body))so headers and body reach the Worker before it can reject and reset the connection. Comments now describe that reset-after-answer behavior and why late body writes could drop the unread 401.Reviewed by Cursor Bugbot for commit e63c3be. Bugbot is set up for automated code reviews on this repo. Configure here.