Skip to content

refactor(browser): give owner-initiated CDP aborts typed reasons - #10706

Merged
morluto merged 2 commits into
refactor/abort-reasonsfrom
refactor/browser-abort-reasons
Nov 15, 2026
Merged

morluto merged 2 commits into
refactor/abort-reasonsfrom
refactor/browser-abort-reasons

Conversation

@morluto

@morluto morluto commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Gives the 10 remaining bare AbortController.abort() calls in src/browser a typed OwnerCancellation reason. Their abort-without-reason baseline 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 platform AbortError. CdpConnection and CdpCaptureValues attach signal.reason as the cause of AnalysisCancelledError. That cause then cannot say who ended the work. Each owner-initiated abort should name its reason.

Change and scope

Site Reason
CdpTargetSession cleanup: 1 s bound / final release deadlineElapsed / noLongerNeeded
CdpRuntimeSession: completion timer, cleanup timer, runtimeDeadline timer deadlineElapsed
CdpPageCapture: stop pending DOM.describeNode batch after a sibling failed noLongerNeeded
CdpObservationSession: settled wait stops its timer noLongerNeeded
PlaywrightScenarioRequest: request deadline / stop after failure deadlineElapsed / noLongerNeeded
PlaywrightScenarioServiceWorkers: close aborts setup ownerClosed

scripts/verify/architecture-guard-baselines.json: abort-without-reason is now {}. Playwright route.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 elapsed instead of the platform's This operation was aborted. No other result or reason changes. Every consumer checks signal.aborted or wraps signal.reason as 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 -- with PlaywrightScenarioRequest, PlaywrightBrowserScenarioProvider, PlaywrightScenarioSession, and the CDP lifecycle, cleanup-cancellation, web-runtime, target-deadline, DOM SVG, cleanup-ownership and timeline boundary tests: 10 files, 343 passed.
  • Review follow-up (15b9d11: the page-side request callback uses page-native DOMException abort 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 (ReferenceError for the host import) and pass now; npm run test:local -- src/browser/PlaywrightScenarioRequest.test.ts: 137 passed; node scripts/verify/architecture-guards.mjs and npm run check:fast: passed.

Compatibility

No API change.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T01:07:07.464380Z 15b9d11 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous request-cancellation failure is fixed.

Summary

The PR adds explicit abort reasons to browser-owned work and removes the remaining bare aborts from the guard baseline.

  • CDP work now records why its owner stopped it.
  • Scenario request timeouts now say when REA’s bound elapsed.

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.
@morluto
morluto merged commit 4ba1460 into refactor/abort-reasons Nov 15, 2026
1 check passed
@morluto
morluto deleted the refactor/browser-abort-reasons branch November 15, 2026 02:18
morluto added a commit that referenced this pull request Nov 15, 2026
…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.
morluto added a commit that referenced this pull request Nov 15, 2026
…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.
morluto added a commit that referenced this pull request Nov 15, 2026
…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.
morluto added a commit that referenced this pull request Nov 15, 2026
…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.
morluto added a commit that referenced this pull request Nov 15, 2026
…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.
morluto added a commit that referenced this pull request Nov 15, 2026
…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
@morluto morluto added the area: runtime Process capture and runtime observation label Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant