Repository navigation
refactor(browser): give owner-initiated CDP aborts typed reasons - #10706
Conversation
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 11a44c3b9b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
[Medium impact] The PR appears safe to merge; the previous request-cancellation failure is fixed. SummaryThe PR adds explicit abort reasons to browser-owned work and removes the remaining bare aborts from the guard baseline.
Reviews (2) · Last reviewed commit: "fix(browser): give the page-side request..." · Reviewed by Greptile |
The request callback runs in the page through page.evaluate and cannot reach REA's modules. Define its deadline and cleanup reasons as DOMExceptions inside the callback, and make the test fake evaluate the callback from its source so module imports are unavailable, as in a page.
…the browser adapters (#10692) * refactor(errors): give owner-initiated aborts a typed reason outside the browser adapters * refactor(verify): keep the abort-reason scan receiver-independent Playwright's route.abort takes a network error code; the one call site now names its default code instead of the guard exempting a variable name. * refactor(browser): give owner-initiated CDP aborts typed reasons (#10706) * refactor(browser): give owner-initiated CDP aborts typed reasons * fix(browser): give the page-side request fetch page-native abort reasons The request callback runs in the page through page.evaluate and cannot reach REA's modules. Define its deadline and cleanup reasons as DOMExceptions inside the callback, and make the test fake evaluate the callback from its source so module imports are unavailable, as in a page.
…the browser adapters (#10692) * refactor(errors): give owner-initiated aborts a typed reason outside the browser adapters * refactor(verify): keep the abort-reason scan receiver-independent Playwright's route.abort takes a network error code; the one call site now names its default code instead of the guard exempting a variable name. * refactor(browser): give owner-initiated CDP aborts typed reasons (#10706) * refactor(browser): give owner-initiated CDP aborts typed reasons * fix(browser): give the page-side request fetch page-native abort reasons The request callback runs in the page through page.evaluate and cannot reach REA's modules. Define its deadline and cleanup reasons as DOMExceptions inside the callback, and make the test fake evaluate the callback from its source so module imports are unavailable, as in a page.
…the browser adapters (#10692) * refactor(errors): give owner-initiated aborts a typed reason outside the browser adapters * refactor(verify): keep the abort-reason scan receiver-independent Playwright's route.abort takes a network error code; the one call site now names its default code instead of the guard exempting a variable name. * refactor(browser): give owner-initiated CDP aborts typed reasons (#10706) * refactor(browser): give owner-initiated CDP aborts typed reasons * fix(browser): give the page-side request fetch page-native abort reasons The request callback runs in the page through page.evaluate and cannot reach REA's modules. Define its deadline and cleanup reasons as DOMExceptions inside the callback, and make the test fake evaluate the callback from its source so module imports are unavailable, as in a page.
…the browser adapters (#10692) * refactor(errors): give owner-initiated aborts a typed reason outside the browser adapters * refactor(verify): keep the abort-reason scan receiver-independent Playwright's route.abort takes a network error code; the one call site now names its default code instead of the guard exempting a variable name. * refactor(browser): give owner-initiated CDP aborts typed reasons (#10706) * refactor(browser): give owner-initiated CDP aborts typed reasons * fix(browser): give the page-side request fetch page-native abort reasons The request callback runs in the page through page.evaluate and cannot reach REA's modules. Define its deadline and cleanup reasons as DOMExceptions inside the callback, and make the test fake evaluate the callback from its source so module imports are unavailable, as in a page.
…the browser adapters (#10692) * refactor(errors): give owner-initiated aborts a typed reason outside the browser adapters * refactor(verify): keep the abort-reason scan receiver-independent Playwright's route.abort takes a network error code; the one call site now names its default code instead of the guard exempting a variable name. * refactor(browser): give owner-initiated CDP aborts typed reasons (#10706) * refactor(browser): give owner-initiated CDP aborts typed reasons * fix(browser): give the page-side request fetch page-native abort reasons The request callback runs in the page through page.evaluate and cannot reach REA's modules. Define its deadline and cleanup reasons as DOMExceptions inside the callback, and make the test fake evaluate the callback from its source so module imports are unavailable, as in a page.
…10633) * refactor(errors): give caller aborts a typed reason at the adapters Squashes 9088135, 87858de (fix(mcp): preserve cancellation reasons in handlers) and fa151dc (test(server): race handler-entry gates against the triggering tool call) onto main without #10566's pre-squash commits. * refactor(errors): give owner-initiated aborts a typed reason outside the browser adapters (#10692) * refactor(errors): give owner-initiated aborts a typed reason outside the browser adapters * refactor(verify): keep the abort-reason scan receiver-independent Playwright's route.abort takes a network error code; the one call site now names its default code instead of the guard exempting a variable name. * refactor(browser): give owner-initiated CDP aborts typed reasons (#10706) * refactor(browser): give owner-initiated CDP aborts typed reasons * fix(browser): give the page-side request fetch page-native abort reasons The request callback runs in the page through page.evaluate and cannot reach REA's modules. Define its deadline and cleanup reasons as DOMExceptions inside the callback, and make the test fake evaluate the callback from its source so module imports are unavailable, as in a page. * test(process): expect the reader close's typed owner reason Closing the Darwin run-token reader aborts its compilation with OwnerCancellation.ownerClosed since the owner-abort change in this PR; the boundary test still expected the default DOMException. * fix(server): report HTTP session replacement and shutdown to pending tools as an owner close
Summary
Gives the 10 remaining bare
AbortController.abort()calls insrc/browsera typedOwnerCancellationreason. Theirabort-without-reasonbaseline drops to zero. Stacked on #10692, which added the guard and left these sites to the browser workstream.Problem and expected behavior
A bare
.abort()makes the signal's reason an anonymous platformAbortError.CdpConnectionandCdpCaptureValuesattachsignal.reasonas the cause ofAnalysisCancelledError. That cause then cannot say who ended the work. Each owner-initiated abort should name its reason.Change and scope
CdpTargetSessioncleanup: 1 s bound / final releasedeadlineElapsed/noLongerNeededCdpRuntimeSession: completion timer, cleanup timer,runtimeDeadlinetimerdeadlineElapsedCdpPageCapture: stop pendingDOM.describeNodebatch after a sibling failednoLongerNeededCdpObservationSession: settled wait stops its timernoLongerNeededPlaywrightScenarioRequest: request deadline / stop after failuredeadlineElapsed/noLongerNeededPlaywrightScenarioServiceWorkers: close aborts setupownerClosedscripts/verify/architecture-guard-baselines.json:abort-without-reasonis now{}. Playwrightroute.abort(errorCode)was already excluded by the guard.Visible effect: when a scenario request times out, its error text is now
An internal REA bound on this operation elapsedinstead of the platform'sThis operation was aborted. No other result or reason changes. Every consumer checkssignal.abortedor wrapssignal.reasonas a cause.Not included: test files, which the guard does not scan.
Contract and boundary impact
None beyond the timed-out scenario request text above.
Evidence and regression coverage
The guard from #10692 with a zero baseline stops new bare aborts in
src/browser.Validation performed
node scripts/verify/architecture-guards.mjs --shrink-baselines: passed and wrote the empty baseline.npm run check:fast: passed.npm run test:focused --withPlaywrightScenarioRequest,PlaywrightBrowserScenarioProvider,PlaywrightScenarioSession, and the CDP lifecycle, cleanup-cancellation, web-runtime, target-deadline, DOM SVG, cleanup-ownership and timeline boundary tests: 10 files, 343 passed.DOMExceptionabort reasons; the test fake now evaluates callbacks from source like Playwright): the fetch-error test and the new deadline-abort test failed on the previous head (ReferenceErrorfor the host import) and pass now;npm run test:local -- src/browser/PlaywrightScenarioRequest.test.ts: 137 passed;node scripts/verify/architecture-guards.mjsandnpm run check:fast: passed.Compatibility
No API change.
Author readiness
Human owner:
Before merge
type(scope): outcome.