Repository navigation
Accept js-debug target-closed reply to Blazor hosted-global Page.close - #21938
David Fowler (davidfowl) merged 1 commit into
Conversation
When the hosted-global Blazor proof closes the browser page through the
js-debug CDP proxy, the page target can detach before Page.close is
answered. js-debug then rejects the pending call with
{"code":0,"message":"Connection is closed"} and relays it to the proxy
client. Treat that reply like the existing socket-close case; the caller
still requires every proof session to terminate and the debug-in-browser
command to reset.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21938Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21938" |
Tests selector0 / 101 PR test projects · 2 PR jobs, from 2 changed files. Selected PR test projects (0 / 101)none — no PR-gated .NET test projects run for this change. Selected PR jobs (2)
How these were chosen — grouped by what changedJob reasons
Selection computed for commit |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the targeted debugger-disconnection handling change.
No open issues 🎉
What changed in this PR
This PR addresses a Blazor hosted-global debugger E2E flake in the Aspire VS Code extension’s test harness. It accepts js-debug’s exact target-closed reply to Page.close while preserving session-termination and command-reset requirements.
Changes:
- Recognizes
code: 0withmessage: 'Connection is closed'as target disconnection; other errors still fail. - Extends regression tests to cover both disconnection forms and rejection when a managed session remains active.
| File | Description |
|---|---|
extension/src/testing/e2eStateFileBridge.ts |
Handles the target-closed CDP reply and documents its meaning. |
extension/src/test/e2eStateFileBridge.test.ts |
Tests accepted disconnections, cleanup, and active-session rejection. |
Review effort: Balanced
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
James Newton-King (JamesNK)
left a comment
There was a problem hiding this comment.
Findings: 0 correctness, 0 security, and 0 test coverage issues.
|
✅ No documentation update needed. docs_optional → internal_refactor (proven false positive). Triggered signal: |
Description
What failed:
[vscode] Aspire Blazor browser debugger E2E > hits a managed breakpoint for hosted-globalin VS Code extension E2E (Windows, browser-debugger), on main in run 42413925421 (job) and on a PR branch in run 42312596518 (job). The test reported only the masked bridge errorFailed to apply E2E control revision …: E2E control command failed.Why:
hosted-globalis the only Blazor scenario that usescloseMode: 'natural'. The proof continues the breakpoint, asks js-debug for its CDP proxy and sendsPage.closeover that socket. The js-debug traces in both failing runs' diagnostics artifacts (blazor-debugadapter-*.json,proxyActivity) show the page target detaching before the browser answered. js-debug v1.117.0'sCDPSession._onClose(connection.ts#L385-L388) rejects the pending call withsetCause(0, 'Connection is closed'), and the proxy (sendOrDie) relays it to the client as{"id":1,"error":{"code":0,"message":"Connection is closed"}}, keeping the proxy socket open. Passing runs get{"id":1,"result":{}}.closeBrowserPageThroughCdpalready accepted a socket close afterPage.closeas "target gone", but treated this equivalent error reply asBrowser CDP Page.close failed, which fails the proof even though the page, Mono and root sessions then terminate normally (they do in both traces).Fix:
closeBrowserPageThroughCdpnow treats the js-debug target-closed reply (code === 0 && message === 'Connection is closed') the same as the socket-close case. This doesn't weaken the proof: the caller still requires every proof session (root, browser, managed) to terminate anddebug-in-browserto return toEnabled. Any otherPage.closeerror (e.g.-32601 Method not found) still fails.Regression tests (
extension/src/test/e2eStateFileBridge.test.ts, run against the realexecuteE2eControlCommandproduct path):accepts target disconnection (target-closed reply) during Page.close only after all proof sessions terminate: the CI failure, which fails without the fix with the exact CI errorBrowser CDP Page.close failed: {"code":0,"message":"Connection is closed"}.rejects a target-closed Page.close reply while a proof session remains active: shows the reply is not a bypass, because the proof still fails if the managed session stays alive.Dedupe: no open issue or PR covers
hosted-global. #21912 covers a different browser-debugger failure (themaps managed Edge debuggingbefore-all hook CLI--versionprobe), and none of the AspireAgent PRs #21911–#21932 touch this test. Tracker: #21600.Confidence
Paired local runs of
e2eStateFileBridge.test.jsunder VS Code 1.131.0 (vscode-test, xvfb), same machine and commit, toggling only the product change:yarn lintandyarn compile-testspass. This is a test-harness change only (extension/src/testing), so there's no product behavior change and no E2E behavior evidence beyond the CIbrowser-debuggershards on this PR.Failure stats (14d, attempt 1)
Window 2026-10-25 12:00 → 2026-11-08 12:00 UTC,
ci.yml, attempt-1 jobs only. The denominator is decided attempt-1 runs (same definition as #21600). Hits are verified from each failedVS Code extension E2E (Windows, browser-debugger)job's mocha failure line (48 failed jobs scanned over 30d).hits a managed breakpoint for hosted-global→Page.closetarget-closed reply): 3/1157 decided runs, 2 main / 1 PR (main 2/160, PR 1/997).hosted-globalfailure: 4/1157. The extra one (run 40728167754) is a different cause,Timed out after 300000ms waiting for browser navigation to 'counter', which this PR does not claim to fix.E2E control command failed.; the js-debug traces in their diagnostics artifacts show the{"code":0,"message":"Connection is closed"}proxy reply. The 10-28 main failure predates the masking and prints the exact error.Browser CDP Page.close failed: {"code":0,"message":"Connection is closed"}Verdict
STRONG: the failure was reproduced deterministically through the product code path, and the before-fix run fails with the exact CI error string (0/10 → 10/10). js-debug traces from both recent failures and the unmasked 10-28 main error point to the same cause. The frequency is low (3/1157), so CI alone will take time to confirm the absence of hits.
This PR's own CI (head
bbb5a79f) was green on bothbrowser-debuggershards on attempt 1. The attempt-1 rerun was only for the unrelatedtree-actionsflake (#21796, fix in #21914).How we stop this recurring: CDP proxy transport outcomes after
Page.close(socket close or js-debug's target-closed reply) are now classified in one place,isCdpProxyTargetClosedError, with unit tests pinning both forms. The proof's real gate stays session termination plus command reset, so future js-debug transport variations can't silently mask a real leak.Checklist
🤖 Posted by AspireAgent (AI Agent)