[PR #218] [MERGED] fix(browser): support page-scoped CDP transports #1868

Closed
opened 2026-10-16 21:11:58 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/218
Author: @N0zoM1z0
Created: 7/14/2026
Status: ✅ Merged
Merged: 7/14/2026
Merged by: @morluto

Base: main ← Head: agent/browser-page-transports


📝 Commits (7)

  • bf96192 fix(browser): support page-scoped CDP transports
  • 3743962 fix(browser): keep page endpoint type internal
  • 0aac8aa fix(browser): preserve operation-aware cancellation errors
  • 9be24f8 fix(browser): observe direct target disconnects
  • c252536 test(browser): verify page-scoped Chrome transport
  • 74c5121 test(browser): harden Chrome startup on CI
  • e363f0e test(browser): route discovery sockets through proxy

📊 Changes

24 files changed (+1050 additions, -236 deletions)

View changed files

➕ .github/workflows/real-browser.yml (+33 -0)
➕ scripts/fixtures/page-cdp-proxy.mjs (+126 -0)
📝 scripts/verify-real-browser.mjs (+67 -1)
📝 src/application/BrowserObservationService.ts (+5 -4)
📝 src/browser/CdpBrowserProvider.ts (+67 -110)
📝 src/browser/CdpCaptureStorage.ts (+1 -1)
📝 src/browser/CdpCaptureValues.ts (+4 -3)
📝 src/browser/CdpConnection.ts (+49 -29)
📝 src/browser/CdpElectronInspection.ts (+6 -2)
📝 src/browser/CdpElectronProvider.ts (+31 -50)
📝 src/browser/CdpEndpoint.ts (+113 -8)
📝 src/browser/CdpObservationSession.ts (+32 -7)
📝 src/browser/CdpPageCapture.ts (+16 -5)
📝 src/browser/CdpScreenshot.ts (+1 -1)
➕ src/browser/CdpTargetSession.ts (+81 -0)
📝 src/browser/CdpWebMcpDiscovery.ts (+2 -1)
📝 src/config.ts (+2 -1)
📝 src/domain/browserObservation.ts (+3 -2)
📝 tests/browserObservation.test.ts (+50 -0)
📝 tests/cdpBrowserProvider.test.ts (+209 -1)

...and 4 more files

📄 Description

Summary

  • distinguish browser-scoped and page-scoped CDP WebSocket discovery results
  • keep the flat Target.attachToTarget flow only for browser sockets
  • use a direct target session for page sockets, without browser-only attach/detach commands or session IDs
  • preserve operation-aware cancellation errors across both transport scopes
  • turn direct socket closure and matching flat-session detach events into deterministic target-terminated failures
  • validate every reported socket against the approved loopback endpoint and exact target ID
  • exclude otherwise-authorized targets that have no usable transport and report that limitation truthfully
  • centralize literal IPv4/IPv6 loopback classification

DeepWiki review of Chromium and the DevTools protocol confirmed that browser and page WebSockets are distinct command-routing scopes. The root fix models both transports explicitly and gives each one equivalent cancellation and disconnect semantics.

Closes #194

Verification

  • npm run typecheck
  • npm run knip
  • scoped npx oxlint (existing warnings only)
  • scoped npx prettier --check
  • 78 browser, Electron, contract, and configuration tests passed

Real Chrome verification was not performed in this environment.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/218 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 7/14/2026 **Status:** ✅ Merged **Merged:** 7/14/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `agent/browser-page-transports` --- ### 📝 Commits (7) - [`bf96192`](https://github.com/morluto/rea/commit/bf9619267b45f2383ebdd648dea05a7d2e3945a6) fix(browser): support page-scoped CDP transports - [`3743962`](https://github.com/morluto/rea/commit/37439620710d4c47bf48f1df0b099eab0c115446) fix(browser): keep page endpoint type internal - [`0aac8aa`](https://github.com/morluto/rea/commit/0aac8aaba5a5097d99277d7501dae6fdd017f2d0) fix(browser): preserve operation-aware cancellation errors - [`9be24f8`](https://github.com/morluto/rea/commit/9be24f8de14edc04cdd3649e0ea66d53edb72328) fix(browser): observe direct target disconnects - [`c252536`](https://github.com/morluto/rea/commit/c252536494c15f36e69978eaf068eae176e71688) test(browser): verify page-scoped Chrome transport - [`74c5121`](https://github.com/morluto/rea/commit/74c512130c5bc25d6c119eda72a86e73fcc9f1ff) test(browser): harden Chrome startup on CI - [`e363f0e`](https://github.com/morluto/rea/commit/e363f0eab8325a9f83568295d4669d70e7d47a2d) test(browser): route discovery sockets through proxy ### 📊 Changes **24 files changed** (+1050 additions, -236 deletions) <details> <summary>View changed files</summary> ➕ `.github/workflows/real-browser.yml` (+33 -0) ➕ `scripts/fixtures/page-cdp-proxy.mjs` (+126 -0) 📝 `scripts/verify-real-browser.mjs` (+67 -1) 📝 `src/application/BrowserObservationService.ts` (+5 -4) 📝 `src/browser/CdpBrowserProvider.ts` (+67 -110) 📝 `src/browser/CdpCaptureStorage.ts` (+1 -1) 📝 `src/browser/CdpCaptureValues.ts` (+4 -3) 📝 `src/browser/CdpConnection.ts` (+49 -29) 📝 `src/browser/CdpElectronInspection.ts` (+6 -2) 📝 `src/browser/CdpElectronProvider.ts` (+31 -50) 📝 `src/browser/CdpEndpoint.ts` (+113 -8) 📝 `src/browser/CdpObservationSession.ts` (+32 -7) 📝 `src/browser/CdpPageCapture.ts` (+16 -5) 📝 `src/browser/CdpScreenshot.ts` (+1 -1) ➕ `src/browser/CdpTargetSession.ts` (+81 -0) 📝 `src/browser/CdpWebMcpDiscovery.ts` (+2 -1) 📝 `src/config.ts` (+2 -1) 📝 `src/domain/browserObservation.ts` (+3 -2) 📝 `tests/browserObservation.test.ts` (+50 -0) 📝 `tests/cdpBrowserProvider.test.ts` (+209 -1) _...and 4 more files_ </details> ### 📄 Description ## Summary - distinguish browser-scoped and page-scoped CDP WebSocket discovery results - keep the flat `Target.attachToTarget` flow only for browser sockets - use a direct target session for page sockets, without browser-only attach/detach commands or session IDs - preserve operation-aware cancellation errors across both transport scopes - turn direct socket closure and matching flat-session detach events into deterministic target-terminated failures - validate every reported socket against the approved loopback endpoint and exact target ID - exclude otherwise-authorized targets that have no usable transport and report that limitation truthfully - centralize literal IPv4/IPv6 loopback classification DeepWiki review of Chromium and the DevTools protocol confirmed that browser and page WebSockets are distinct command-routing scopes. The root fix models both transports explicitly and gives each one equivalent cancellation and disconnect semantics. Closes #194 ## Verification - `npm run typecheck` - `npm run knip` - scoped `npx oxlint` (existing warnings only) - scoped `npx prettier --check` - 78 browser, Electron, contract, and configuration tests passed Real Chrome verification was not performed in this environment. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:11:58 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#1868
No description provided.