Repository navigation
fix(gateway): send Content-Length on MCP App sandbox HEAD responses - #118553
vincentkoc merged 1 commit into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 10, 2026, 9:46 AM ET / 13:46 UTC. ClawSweeper reviewWhat this changesThe PR makes MCP App sandbox GET and HEAD responses expose the same byte-accurate Content-Length and adds loopback parity coverage. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessThis PR remains necessary: current main still omits Content-Length on the dedicated sandbox listener’s HEAD success and error responses. The response owner is the right repair point, and the separate standalone-host follow-up is already tracked independently. Priority: P2 Review scores
Verification
How this fits togetherThe MCP App sandbox is a dedicated unauthenticated HTTP origin that serves a generated proxy page for embedded MCP App views. It receives sandbox requests from the gateway runtime and returns isolated HTML or plain-text errors. flowchart LR
A[MCP App view request] --> B[Dedicated sandbox listener]
B --> C{Valid route and policy?}
C -->|No| D[Plain-text error]
C -->|Yes| E[Generated sandbox HTML]
D --> F[GET or HEAD response]
E --> F
Before merge
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +66. Total +66 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land this net-neutral listener repair after exact-head CI completes, while keeping the standalone MCP App host repair in #120905 separate. Do we have a high-confidence way to reproduce the issue? Yes: current main visibly takes the HEAD no-body path without setting a length, and the PR supplies a focused real-loopback GET/HEAD comparison. Is this the best way to solve the issue? Yes: the listener owns the generated representation, while the existing shared helper owns plain-text metadata; this avoids a HEAD-only workaround or duplicate error policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 14f8ed121e03. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
Punchcard-Session: coral-summit-orchard-93
2a40064 to
613b01f
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
Punchcard-Session: coral-summit-orchard-93
Summary
Preserve byte-accurate representation metadata for
GETandHEADresponses from the dedicated MCP App sandbox origin.The rewritten change:
Content-Lengthfor both methods;HEADresponse body.What Problem This Solves
The sandbox handler accepted
HEAD, but its successful response calledres.end()without the HTML body. Node therefore had no bytes from which to deriveContent-Length. The same problem existed on the route's plain-text 400 and 404 responses.Current-main loopback reproduction:
Content-LengthContent-LengthThis is a metadata parity defect, not a claim that RFC 9110 universally requires
Content-Lengthon every HEAD response. When supplied on HEAD, the value must match the corresponding GET representation size.Root Cause
The route relied on Node's implicit length calculation from
res.end(body). That calculation worked for GET, but the handler intentionally passed no body for HEAD. Error branches duplicated response construction and had the same omission.Provenance: the route and HEAD branch originated in
f3971bbd56e/ #69039. The current PR author is @zenglingbiao.Why This Change Was Made
The route owns the representation, so it is the correct place to record its byte length. Reusing
respondPlainText()also removes duplicate error-response policy and fixes 400/404 through the existing canonical helper.Alternatives rejected:
User Impact
Clients probing the sandbox origin with HEAD receive the same representation metadata as GET while still receiving no body. GET response bytes and sandbox security headers remain unchanged.
Evidence
src/gateway/mcp-app-sandbox-http.test.tspasses 6/6; repeated local runs stayed green.613b01fbaac027d1f18b10ffd3d40857197e7305:nothing_found, high confidence.cbx_843c23648b61, runrun_1a97b1290420.Punchcard-Session: coral-summit-orchard-93