Repository navigation
fix(browser): remote-CDP profiles over Playwright for Browser Sessions - #270
Merged
Merged
Conversation
Boon fork's strict web_fetch ssrfPolicy schema rejected allowedHostnames, so configs written by upstream (e.g. allowedHostnames: [localhost]) fail validation. SsrFPolicy already supports allowedHostnames; pass it through and include it in the fetch cache key.
…attach-only registerRemoteCdpBrowserProfile registered every sibling-plugin profile with the existing-session driver, which routes each command through a Chrome DevTools MCP process and re-polls the page URL after every interaction. Over a remote CDP endpoint that cost ~7-17s per click. Register with the openclaw (Playwright) driver instead, still attach-only so nothing is ever launched.
A loopback cdpUrl was always classified local-managed, so an attach-only ws relay endpoint (e.g. a local app relaying to a cloud browser) had its tabs listed via /json/list on a derived HTTP base, which the relay does not serve (HTTP 404). Treat an attach-only ws(s) URL with a non-devtools path as remote CDP; bare Chrome debug sockets keep local behavior.
…nclaw#96178) * fix(browser): resolve act targetId aliases before mismatch check The /act top-level and batch targetId guards compared the caller-supplied targetId against the resolved canonical tab.targetId with raw string equality. Any supported alias form (tabId, label, suggestedTargetId, or a unique id prefix) resolves to a different canonical id, so act requests that followed the documented 'prefer suggestedTargetId/tabId/label' guidance were rejected with 403 ACT_TARGET_ID_MISMATCH even though they named the correct tab. snapshot/open/close/tabs lack this guard and kept working, matching the reported symptom matrix. Resolve the action targetId through the same tab alias resolution the route used and reject only ids that resolve to a different tab. * fix(browser): canonicalize act targetId aliases before Playwright dispatch The /act gate accepted tabId/label/suggested/prefix aliases of the request tab but left them on action.targetId. The managed executor reads action.targetId ?? targetId for an exact page lookup (executeSingleAction -> getPageForTargetId), so an alias missed the lookup and broke the action at runtime whenever more than one page was open (single-page masked it via the pages.length===1 fallback). Canonicalize the action targetId (top-level and nested batch sub-actions) to the resolved tab id before dispatch; reject ids that resolve to a different tab. Replace the mock-masked contract assertions with executor-action assertions plus direct canonicalizer unit tests. * test(browser): brace act-targetId guard clauses for curly lint * docs(changelog): note browser target alias fix * docs(changelog): note browser target alias fix * fix(browser): reject ambiguous batch target aliases * test(browser): type targetless act fixture * docs(changelog): move browser alias fix to unreleased * chore: drop nonessential browser changelog entry --------- Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: Peter Steinberger <[email protected]> (cherry picked from commit d405cda)
There was a problem hiding this comment.
1 issue found across 16 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="extensions/browser/src/browser/routes/agent.act.ts">
<violation number="1" location="extensions/browser/src/browser/routes/agent.act.ts:451">
P3: Moving target-ID validation before the `isExistingSession` branch changes the error precedence for existing-session (Chrome MCP) batch actions: a batch with a mismatched nested `targetId` now returns 403 `targetIdMismatch` instead of the previous 501 "batch is not supported for existing-session profiles". Both are errors, but clients keying on the 501 to detect unsupported batch on existing-session profiles no longer see it, and nested target-ID validation now runs for a driver the route otherwise considers fully unsupported for batch. Consider running `getExistingSessionUnsupportedMessage` first or gating nested batch validation to the non-existing-session path.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
…ostnames (cubic) - web_fetch cache key serializes allowedHostnames with JSON (no comma collisions across differently-allowed lists) - allowedHostnames entries must be bare hostnames/IPs (no blank, wildcard, URL or path that would silently never match) - a root attach-only ws relay URL with a query is remote CDP too - attachOnly is persisted for allocated-port profiles as well - profile-mutations test clears mock history before asserting
There was a problem hiding this comment.
Code Review: APPROVE
LGTM! Remote-CDP browser profiles driven by Playwright over CDP directly instead of Chrome MCP existing-session bridge, eliminating 7-17s re-polling latency per interaction.
Key Changes
- Playwright Driver for Remote CDP (
extensions/browser/browser-profile-mutations.ts,config-mutations.ts):registerRemoteCdpBrowserProfilenow configuresdriver: "openclaw"andattachOnly: true(instead ofexisting-session).- Persists
attachOnlyfor allocated-port and custom profiles.
- Loopback Relay Detection (
extensions/browser/src/browser/profile-capabilities.ts):- Attach-only
ws(s)://endpoints with a non-/devtools/path or query are classified asmode: "remote-cdp", driving them via persistent Playwright instead of failing on local/json/listendpoints.
- Attach-only
- Target ID Alias Canonicalization (
extensions/browser/src/browser/routes/agent.act.ts,agent.act.normalize.ts):- Resolves tab aliases (unique prefixes, labels, suggestedTargetId, tabId) to the canonical targetId before mismatch checks and Playwright dispatch, preventing 403
ACT_TARGET_ID_MISMATCHand page lookup misses. - Recursively normalizes batched sub-actions.
- Resolves tab aliases (unique prefixes, labels, suggestedTargetId, tabId) to the canonical targetId before mismatch checks and Playwright dispatch, preventing 403
- SSRF Allowed Hostnames for Web Fetch (
src/agents/tools/web-fetch.ts, config schemas):- Adds
ssrfPolicy.allowedHostnamessupport toweb_fetch. - Strict regex validation enforces bare hostnames or IPs.
- Includes JSON-serialized allowedHostnames in the cache key to avoid cache collisions.
- Adds
Verification & Testing
- Unit tests added across all components (
browser-profile-mutations.test.ts,config-mutations.test.ts,config.test.ts,agent.act.normalize.test.ts,server.agent-contract-core.test.ts,web-fetch.ssrf.test.ts,schema.test.ts). - Upstream tests passing; CI suites passing.
Verdict: APPROVE
insomnius
enabled auto-merge (squash)
October 8, 2026 08:39
orswn
approved these changes
Oct 8, 2026
orswn
added a commit
that referenced
this pull request
Oct 9, 2026
…-> 2026.6.34-boon.4 (#274) Cut the fork release that ships the three commits on boon since v2026.6.34-boon.3. /stop now also ends the shell commands of the session and its sub-agents (#272, ENG-16829). Registered remote-CDP browser profiles run over Playwright for Browser Sessions (#270, ENG-21111). @modelcontextprotocol/sdk moves to 1.31.0 (#268). Bump root package.json and npm-shrinkwrap.json, all 135 plugin manifests, and the version and openclaw peer floor in every extension npm-shrinkwrap.json. Add the 2026.6.34-boon.4 CHANGELOG.md section. #268 changed pnpm-lock.yaml but not the npm shrinkwraps, so the root, acpx, slack and msteams shrinkwraps still pinned the old @modelcontextprotocol/sdk tree and the shrinkwrap lock graph test failed on boon. Move those entries to the pnpm-lock.yaml versions: @modelcontextprotocol/sdk 1.31.0, express-rate-limit 8.7.1, eventsource-parser 3.1.1, content-type 2.1.0 and iconv-lite 0.7.3. The shrinkwraps were generated with a temporary npm-only override for the @opentelemetry packages under @sentry/node; the override is not committed. No other dependency changes.
orswn
added a commit
that referenced
this pull request
Oct 10, 2026
…ep-extension boon moved to 2026.6.34-boon.4 (#274), which bumped every plugin manifest. The new boon-pdf-prep manifest still said boon.3, so the release preflight would fail on the next version bump: plugins:sync:check reported "update required: @openclaw/boon-pdf-prep". Align it with pnpm plugins:sync. Regenerate the plugin inventory, the plugin reference page and the config baseline, which the new plugin changes and which plugins:inventory:check and config:docs:check reported as stale. The baseline also picks up tools.web.fetch.ssrfPolicy.allowedHostnames from #270, which boon did not regenerate. The remaining preflight drift is the npm shrinkwrap check on the @opentelemetry packages under @sentry/node. It is the same on boon.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OpenClaw fork changes needed by Browser Sessions (anychat-boon-web#158, getboon/boon#15419 / openclaw#15420). The anychat-boon-web plugin now relays CDP to the user's cloud browser (Browser Use) through a loopback proxy and registers it as a remote-CDP profile; these make that path work and fast.
89e7b362555) —registerRemoteCdpBrowserProfilehardcoded theexisting-session(Chrome DevTools MCP) driver, which re-polls the URL after every interaction; over a remote endpoint that cost ~7-17s per click. Profiles now use theopenclaw(Playwright) driver, stillattachOnly. Also affectsbrowser-handoffprofiles (that path is not live yet).d6e12f448b1) — a loopbackcdpUrlwas always classifiedlocal-managed, so an attach-onlyws://127.0.0.1:<port>/<path>relay had its tabs listed via/json/liston a derived HTTP base →HTTP 404on every snapshot. An attach-only ws(s) URL with a non-/devtools/path is nowremote-cdp; bare Chrome debug sockets keep local behavior.44eab86a921) — cherry-pick of upstream fix(browser): resolve act targetId aliases before mismatch check openclaw/openclaw#96178 (d405cda95ac);actwith a tab label astargetIdreturned 403ACT_TARGET_ID_MISMATCH.af7d02c2e85) — configs written by upstream (allowedHostnames: [localhost]) failed strict validation;SsrFPolicyalready supports it, now passed through and included in the fetch cache key.Test plan
browser-profile-mutations.test.ts,config.test.ts,web-fetch.ssrf.test.ts,schema.test.ts; upstream tests for fix(browser): resolve act targetId aliases before mismatch check openclaw/openclaw#96178: 31/31)extensions/browsersuite: 1399 pass; 1 pre-existing failure (cdp.helpers.internal.test.ts"rejects and rethrows when the WebSocket fails to open", also red on base)/json/list404sSummary by cubic
Makes remote-CDP browser profiles (used by Browser Sessions' cloud browser relay) run over Playwright instead of the Chrome DevTools MCP bridge, cutting per-action latency from ~7-17s to ~1-4s and fixing
/json/list404s on loopback relays. Also fixesacttargetId alias mismatches and letsweb_fetchaccept hostname allowlists.openclawdriver, attach-only, instead ofexisting-session, which re-polled the URL after every interaction.ws(s)://URLs with a non-/devtools/path, or a root path with a query, are treated as remote CDP relays; bare Chrome debug sockets keep local behavior.actrequests resolve tab aliases (tabId, label, suggestedTargetId, id prefix) to the canonical targetId before the mismatch check and before Playwright dispatch, fixing 403ACT_TARGET_ID_MISMATCHand runtime page-lookup misses.web_fetchconfig now acceptsssrfPolicy.allowedHostnames; entries must be bare hostnames/IPs, are passed to the SSRF policy, and are JSON-serialized into the fetch cache key.attachOnlyis now persisted for allocated-port profiles too.Written for commit 54790a3. Summary will update on new commits.