Repository navigation
fix(link): the link WebSocket's memory acceptance passes: a link socket no longer re-serializes its create, and the HTTP relay reports its own stall - #8625
Merged
Conversation
… lease when traffic accounting throws
…ts hold check copy
… while the link WebSocket is on (#8601)
…rts for the load, not the warm-up or the upstream hold
…through turn streams (#8601)
…client has read it (#8601)
…input, not only the root object
…ps a paced turn paced
… so both RSS acceptance runs sync on a stall the Home reports (#8600)
…ead of serializing it into a request and parsing it back (#8600)
…ssing with both Homes reporting their stall (#8600)
…mbo children, recoveries and retries read their own bodies (#8600)
…yed waiting through three event-loop turns
…real under paused readers and an early HTTP cut only makes passing harder
…ffer instead of garbage collection
…ers, from one parse per build (#8601)
…en traffic flow throws
…tch a relay stage that loses the paced mark
… slicer, and the relay as the read-ahead source
…ith the core module boundaries
…ocket-create-memory # Conflicts: # structure/remote-link.md
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. |
…reader-memory # Conflicts: # tests/fixtures/test-layout-expected.json
…ocket-create-memory
…e-memory Brings in dev 9532563 and the squash of the lower slice; no file of this slice is edited (git merge-tree, no conflicts).
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. |
lidge-jun
added a commit
that referenced
this pull request
Nov 13, 2026
…ance, the Home counts link sockets, and the review nits of #8622 and #8625 (#8647) * test(responses): pin the combo replay on a paced source, and only the read slots on an unpaced one * fix(responses): a combo child's required-tool check keeps whether the outbound body denies every tool, not the parsed body * fix(link): end every relayed request's traffic flow through one guarded helper, so a throwing end never keeps the lease * fix(link): a throwing stall observer never breaks a relayed body * test(link): a parsed create stays with its own request when a fallback or recovery builds the next one * docs(link): note that a link create's parsed body shares its nested input with the frame * feat(link): the Home counts each link WebSocket in its per-link traffic book with the Child's definition * test(link): the RSS acceptance announces a stall only after a quiet window, and fails a load that does not settle * docs(link): only the settled acceptance runs count, and how the quiet window settles them (#8600) * docs(link): the Home counts link sockets in the Child's units, and says where completeness differs * docs(link): the traffic counters' comments cover a link socket's message payloads * docs(responses): the required-tool check keeps its tool declarations as well as whether the body denies every tool * test(link): a refused or failed link upgrade counts nothing in the Home's traffic book * style(link): drop the trailing blank line from the gate and the RSS fixture * docs(link): the quiet window's timers are the only ones that change adds to the RSS fixture * test(link): the failed-upgrade case proves the gate reached server.upgrade * test(responses): the workflow ceiling test's hand-made socket carries its WsData, as every upgraded socket does #8415 added a test that hands sendResponseToWebSocket a socket with no data. Every socket the shared Responses server upgrades carries a WsData object (the Responses socket, the live sideband, the Remote Workspace agent and the link gate all pass data to server.upgrade), and the bridge already reads ws.data on its other paths, so the socket in the test is what was wrong; since the Home counts link socket traffic, sendTextFrame reads ws.data.link on every send and the test threw.
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
This PR builds on #8622: it is stacked on that branch, and its acceptance runs depend on that PR's paced reads.
The opt-in link WebSocket memory acceptance (design 6.3,
tests/e2e-style/link-websocket-rss.test.ts,OCX_LINK_WS_RSS_ACCEPTANCE=1) compares two runs of the same stalled load: 24 link WebSocket creates of nearly 8 MiB each, and the same load sent through the HTTP link relay. The WebSocket run's peak RSS must exceed the HTTP run's by at most 24 × 32 MiB. On dev it did not: the WebSocket run was 1,123 MiB over the HTTP run. It also could not pass by construction, because the HTTP run had no stall the Home reported (#8600).Where a near-8 MiB create was held, from heap snapshots at the stall and from the code path:
Request(a transient copy).The fix:
websocket-handler.tsbuilds the synthetic request without a body. It binds the parsed object to that request (attachParsedRequestBodyinsrc/server/request-decompress.ts, a WeakMap). Preparation takes it once and admits it withadmitParsedJsonRequestBody, which applies the same resolved inbound limit (413inbound_body_too_large) and the same translator-budget observation as the bounded reader. Every request the pipeline builds from it, whether a combo child, a recovery or a retry, is anotherRequestand reads its own body. A local socket still sends a request body.setLinkRelayWaitObserverForTestsinlink-websocket-limits.ts) from each chunk it hands over until its reader asks again. The RSS fixture counts these waits with the link pump waits, so each run synchronizes on a stall its own Home reports. Without an observer, nothing is called.structure/remote-link.mdcarries the attribution and the numbers once, and says what the announcements mark: the first moment every load reader waits at once, which can come before the load's sustained stall. A paused reader's kernel buffer still takes bytes in flight, and a relay also waits in the gap between chunks. Bun exposes no sustained-backpressure signal, and the acceptance uses no quiet period, so runs vary.The reservation (32 MiB), the budget (768 MiB) and the cap (24 sockets) are unchanged.
What stays unchanged by default: the link WebSocket is off unless both switches are set, and the build's release gate (
linkWebsocketTransportReady) stays closed, so no link socket exists in any install. Local WebSocket and HTTP requests keep their request bodies. The relay's stall signal runs only while a test installed its observer. Nothing here opens the gate.Refs #8600
Verification
Red first:
tests/server/link-websocket-upgrade.test.ts, "the pipeline takes the frame the socket parsed": on the base,readJsonRequestBodywas called once for a link create (expected 0). The local-socket control is still read.combo/free). The test passes on the base and now.tests/server/link-websocket-pump.test.ts(Link WebSocket: find which allocations hold a large create on the Home, then cut the copies or justify a reservation from named buffers #8600 describe): the relay's waiting transitions across reads, the end of the body and cancel. Before the change the file could not load: the seam did not exist.Canonical acceptance, 24 sockets, 4-core Linux VM, kernel VmHWM, peak over idle per socket:
Run 4 tried a three-event-loop-turn confirmation that was later removed (it passed at 276 MiB).
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=2over 98 files (link server tests, the Responses relay, rewrite, snapshot repair, combo, WebSocket endpoint and steering suites, the request-decompress and body-size suites, the core module boundaries, layout, structure, file-size ratchet, and the client and lab boundaries) on dd5f74a: exit 0, 3218 pass, 4 skip, 0 fail. After the comment and whitespace commit (9d46df1), 14 of those files were rerun: 640 pass, 2 skip, 0 fail.OCX_LINK_WS_RSS_ACCEPTANCE=1 bun test tests/e2e-style/link-websocket-rss.test.ts: the runs in the table, one at a time.NOT RUN:
bun run testsuite: this VM is limited to focused files with parallelism 2.Review
A read-only reviewer (gpt-6.1-terra, xhigh) ran three rounds:
Open: synchronizing on a sustained stall would need either a quiet period (a timer, which this lane's rules forbid in tests) or socket state that Bun does not expose for HTTP responses. The acceptance therefore compares the loads at their first all-waiting moment. All recorded runs passed with room to spare, but they do not prove a sustained-stall comparison. Whether to add a quiet period to this opt-in acceptance is left to the maintainer.
Checklist