Repository navigation
fix(link): decode the hold check's body copy only after the request is accepted, under the resolved inbound limit - #8613
Merged
Conversation
…accepted, under the resolved inbound limit (#8608)
Contributor
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Contributor
|
✅ Deterministic PR hygiene checks passed. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Summary
When a Remote Link has a releasable link WebSocket activity hold, the Home reads a copy of each relayed
POST /v1/responsesbody to see whether it returns the pending tool results. That copy was handled with looser bounds than the request itself (#8608):decodeRequestBody's 256 MiB default instead of the resolved inbound limit the handler uses (1 to 512 MiB,maxInboundBodyBytes).The fix in
src/server/index/link-listener.ts: the copy is read only after the handler answered below 400. A refusal (the budget's 503 included), an abort before headers, or a dispatch error cancels the copy unread; the cancel is not awaited, because a tee's cancel waits for the other half, which a refusal may leave unread. An accepted copy is decoded under the listener's resolved inbound limit (startContext.maxRequestBodySize, whichsrc/server/index.tssets fromresolveInboundBodyLimitWithWarning(config), fixed at bind like the public listener).structure/remote-link.mddescribes the new order.What stays unchanged by default: this code runs only while a link has a releasable hold, and holds come only from link WebSocket sockets. The link WebSocket release gate (
linkWebsocketTransportReady) is still closed in this build and nothing here opens it, so no existing install reaches the changed path. Relayed requests on links without a hold take no copy, as before.Closes #8608
Verification
Red first. Two tests in
tests/server/link-websocket-holds.test.tsfailed on origin/dev e85a975 for the stated reasons, and pass with the fix:withRaisedInboundBodyAdmissionwith a budget another lease already fills, so the zstd body is refused with 503. On devdecodeRequestBodywas called once (expected 0). The upload has fully arrived before the refusal, as it does while a request waits in the budget queue; the test reads a clone first to make that ordering deterministic.The three existing HTTP release tests (plain, refused after reading, zstd #8594) stay green. The holds file passed ten consecutive runs.
Commands (Bun 1.4.4, TMPDIR=/tmp):
bun run typecheck: exit 0bun run privacy:scan: exit 0bun run structure:check: exit 0bun scripts/test.ts --parallel=2 tests/server/link-*.test.ts tests/server/inbound-body-admission.test.ts tests/server/inbound-encoded-body-budget.test.ts tests/server/inbound-body-budget.test.ts tests/lab/core-link-boundary.test.ts tests/lab/core-lab-boundary.test.ts tests/test-layout.test.ts tests/test-layout-tooling.test.ts tests/ci-workflows/structure-ssot.test.ts tests/ci-workflows/file-size-ratchet.test.ts tests/clients/link-boundary.test.ts: exit 0, 622 pass, 0 fail, 35 filesNOT RUN: the full
bun run testsuite (the lane's VM is limited to focused files with parallelism 2; the change is confined to the link listener's hold observer, which the focused link and inbound-body files exercise). Cross-platform CI is left to the batched dev run.Review
A fresh reviewer (gpt-6.1-terra, xhigh, read only) reviewed commit ff5bdb6 on the brief "deferred tee read, every decision path, the resolved limit, the red-first tests, behaviour with the gate closed, the structure sentence": no P0-P2 findings. It noted that a relayed request can still be observed while the release gate is closed if a hold was persisted earlier; holds are created only by link WebSocket sockets, which this build never admits, so no install has one. It did not rerun the new tests against origin/dev (the red runs above are the author's). An earlier reviewer on another model was stopped before it reported, after the owner changed the reviewer model.
Checklist
Implemented by Claude Opus 5.5 (anthropic/claude-opus-5-5) in GOAT through the Codex harness; in-lane review by GPT-6.1 Terra (xhigh). Received as a git bundle from the VM that built it and pushed by the coordinator.