Repository navigation
test(ui): observe MCP cancellation at the HTTP boundary - #131680
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 6:29 AM ET / 10:29 UTC. ClawSweeper reviewWhat this changesThe PR changes MCP App browser conformance tests to observe the Gateway’s actual HTTP response lifecycle rather than rely on a Playwright failure event during cancellation. Merge readinessKeep open. This is a distinct, correctly scoped repair for a current-main cancellation assertion that remains brittle after the earlier polling fix; no blocking code or security finding was found, but exact-head CI is still running. Priority: P2 Review scores
Verification
How this fits togetherA standalone MCP App sends tool calls from its browser host to the Gateway’s view endpoint. The Gateway owns the HTTP disconnect signal that cancels the MCP operation, and this test verifies that boundary while confirming a later control call still completes. flowchart LR
Browser[Standalone MCP App browser]
Call[Tool-call request]
Gateway[Gateway view endpoint]
Observer[HTTP response observer]
Cancel[Abort or page exit]
MCP[MCP tool runtime]
Control[Later control call]
Browser --> Call --> Gateway --> MCP
Observer --> Gateway
Cancel --> Browser
Gateway --> Observer
Control --> Gateway
Before merge
Agent review detailsSecurityNone. PR surfaceSource +23, Tests +11. Total +34 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the boundary-level assertion once the exact reviewed head has green required CI; retain the browser-event diagnostics only as supplemental evidence, not as the cancellation oracle. Do we have a high-confidence way to reproduce the issue? Yes, at high confidence: current main retains the exact brittle assertion and the PR supplies a focused real Gateway/Chromium command and before/after result. This restricted review host could not independently open a loopback listener, so it did not rerun the scenario. Is this the best way to solve the issue? Yes. The Gateway response is the owner of the disconnect fact; polling a browser event is only a partial mitigation because navigation can omit that event entirely. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 811e32c1ca67. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
I independently confirmed the missing-event case with pinned Chromium 151.0.7922.34 and an isolated local HTTP server. A normal explicit fetch abort closed the captured HTTP response unfinished and produced Page, BrowserContext, and CDP failure events. Navigating the same page to That distinguishes this from the delayed-callback interleaving covered by #131690, which I landed earlier. Its polling change is only a partial repair and does not supersede this PR. The exact-response observation here is the correct owner-boundary proof; it also retains the negative control that prevents an independent upstream deadline from masquerading as browser cancellation. I also checked Node 22.22.3's source: the diagnostics payload is published before the real request handler, including its exact request and response objects. The installed Node 24 source has the same ordering. I am taking this existing PR through the mechanical conflict refresh and normal native landing gates, preserving the HTTP-boundary repair rather than creating another replacement. No production change, timeout increase, or approval bypass is needed. Fresh exact-head CI remains required before merge. Land-ready update: the mechanical refresh is pushed as dafd9df3b6e5f07751a7a8813524282f558d6acc, and both changed files remain byte-for-byte identical to the reviewed original. Production LOC +0/-0; tests/support +42/-8. No source edits followed fresh isolated Codex autoreview, which passed with no accepted/actionable findings (default P0 scope). Exact-head CI 33163017681 completed successfully, including every UI E2E shard and the real-Gateway lane. Fresh Blacksmith Testbox proof (owned lease Native review artifacts validated |
dbbae68 to
dafd9df
Compare
|
Merged via squash.
|
What Problem This Solves
Resolves a problem where full release QA reports failed MCP App cancellation when leaving the standalone page, even though the real Gateway has disconnected and the MCP request has been cancelled. Reproduced from the frozen release-QA candidate in the real-Gateway CI job, then locally with unchanged source.
This is a maintainer-requested full release QA repair, assisted by Codex.
Why This Change Was Made
Chromium can omit
requestfailedduring document navigation. A separate real-browser HTTP probe confirmed that neither Playwright page/context events nor CDPNetwork.loadingFailednecessarily report that disconnect, so awaiting the missing event would not fix the evidence.Observe the actual Gateway HTTP response through Node's documented diagnostics channel instead. The observer is restricted to the test Gateway's local port, POST method and standalone view path. Each scenario captures its exact response before performing cancellation, then requires it to close without finishing; the later successful control request must finish normally. The listener is removed in the existing cleanup block. No request headers, bodies or tickets are added to artifacts.
The exact upstream cancellation ID, cooperative/noncooperative behavior, no-late-response checks, successful control call, and fresh-document/history checks remain intact. No product behavior or timeout changes; production LOC delta is zero, with 42 added/8 removed test and test-support lines after the mechanical refresh. The Node diagnostics contract was checked against installed Node 24 source and the supported Node 22.22.3 source/docs.
User Impact
No user-visible behavior changes. Release QA now checks the actual HTTP disconnect without depending on an event Chromium may omit during navigation.
Evidence
871b18dff5039484e86c76d282699a8defcb1654: the full real Chromium/Gateway test failed naturally at the old pagehide POST failure-event assertion. Upstream cancellation still matched the exact call.writableFinished=false, matched upstream cancellation, no late reply, and a successful subsequent control call. Ordinary history back/forward passed; cleanup reported no failures.writableFinished=true, HTTP 403). The independent SDK timeout still emitted cancellation, demonstrating why correlated cancellation alone cannot substitute for transport proof. Mutation restored; no dependency edits retained or made.tbx_01m13rj72df125cwh4a4kssar6: exitCode0 in13m05.99s, including all core-test and UI typechecks, Knip, i18n, lint, formatting and ratchets. Backing run; the one-shot lease stopped after success, so the backing lease workflow may show cancellation during cleanup.Reproduction command:
Named follow-up: sanitized MCP conformance failure-artifact upload. This test writes
.artifacts/control-ui-e2e/mcp-app-request-lifetime, while the existing optional CI proof upload collects only the siblingreal-gatewaydirectory. Keep that CI artifact-routing improvement separate from this cancellation-evidence repair.Refreshed-head verification
Mechanically rebased to resolve the conflict with #131690's partial polling repair. Reviewed/pushed head:
dafd9df3b6e5f07751a7a8813524282f558d6acc. Both resulting files are byte-for-byte identical to the original reviewed headdbbae686193487b967218df005c03fffbfb86c18; the old polling assertion is removed, not retained alongside HTTP observation. Production +0/-0; E2E +19/-8; test support +23/-0.Fresh isolated Codex autoreview on the resolved diff passed with no accepted/actionable findings (default P0 scope). Diff whitespace and patch-equality checks passed. No source edits followed review.
Fresh Linux proof on Blacksmith Testbox
tbx_01m13y6y69pmv7j9anb85rh31b(backing run 33163043879):closed=true, writableFinished=false. Each subsequent control completed normally; request-ID correlation, late-reply suppression and connection reuse assertions passed.failures: []. BFCache restoration remains unproven and is not claimed. This is the real source-mounted component/Gateway/stdio/official App flow, not a full-dashboard smoke test.READY FOR /prepare-pr, andOPENCLAW_TESTBOX=1 scripts/pr prepare-run 131680passed withselection.mode=exact-head, without moving the reviewed SHA.Commands:
The old failed UI shard (33157532185/job/98803949528) actually timed out waiting for
Recovered paragraph 1in the transcript pointer case. The refreshed base contains #131539's repair (90b7950ccdcffbd9a87cec29d44951a9c9a5efce), and the refreshed shard passed. No unrelated repair was added here.ClawSweeper's 09:09 UTC review had no actionable code findings; its
expect_outputdeadline expired at VitestRUNbefore the scenario executed. The fresh real-browser results above address its after-fix proof request and Rank-up move. Its automatic re-review may finish independently; no review placeholder substitutes for the actual CI gate.The refreshed 10:29 UTC ClawSweeper review also found no actionable code/security defect. Its only Rank-up move was green exact-head required CI; that is now satisfied. Native prepare passed; land-ready on the unchanged reviewed head. Live matching rules require GitHub Actions
openclaw/ci-gateand no independent approval rule; no bypass is used.