diff --git a/docs/gateway/troubleshooting.md b/docs/gateway/troubleshooting.md index f5829454e57..41c697a67f1 100644 --- a/docs/gateway/troubleshooting.md +++ b/docs/gateway/troubleshooting.md @@ -289,7 +289,7 @@ Look for: - Valid browser executable path. - CDP profile reachability. -- Extension relay tab attachment for `profile="chrome-relay"`. +- Extension relay tab attachment (if an extension relay profile is configured). Common signatures: diff --git a/docs/tools/browser-linux-troubleshooting.md b/docs/tools/browser-linux-troubleshooting.md index 1ab51657044..6f9940c1c67 100644 --- a/docs/tools/browser-linux-troubleshooting.md +++ b/docs/tools/browser-linux-troubleshooting.md @@ -25,7 +25,7 @@ Note, selecting 'chromium-browser' instead of 'chromium' chromium-browser is already the newest version (2:1snap1-0ubuntu2). ``` -This is NOT a real browser — it's just a wrapper. +This is NOT a real browser - it's just a wrapper. ### Solution 1: Install Google Chrome (Recommended) @@ -123,7 +123,7 @@ curl -s http://127.0.0.1:18791/tabs ### Problem: "Chrome extension relay is running, but no tab is connected" -You’re using the `chrome-relay` profile (extension relay). It expects the OpenClaw +You're using an extension relay profile. It expects the OpenClaw browser extension to be attached to a live tab. Fix options: diff --git a/docs/tools/chrome-extension.md b/docs/tools/chrome-extension.md index 91a6c1240f1..831897b9bde 100644 --- a/docs/tools/chrome-extension.md +++ b/docs/tools/chrome-extension.md @@ -62,19 +62,14 @@ After upgrading OpenClaw: ## Use it (set gateway token once) -OpenClaw ships with a built-in browser profile named `chrome-relay` that targets the extension relay on the default port. +To use the extension relay, create a browser profile for it: Before first attach, open extension Options and set: - `Port` (default `18792`) - `Gateway token` (must match `gateway.auth.token` / `OPENCLAW_GATEWAY_TOKEN`) -Use it: - -- CLI: `openclaw browser --browser-profile chrome-relay tabs` -- Agent tool: `browser` with `profile="chrome-relay"` - -If you want a different name or a different relay port, create your own profile: +Then create a profile: ```bash openclaw browser create-profile \ @@ -84,6 +79,11 @@ openclaw browser create-profile \ --color "#00AA00" ``` +Use it: + +- CLI: `openclaw browser --browser-profile my-chrome tabs` +- Agent tool: `browser` with `profile="my-chrome"` + ### Custom Gateway ports If you're using a custom gateway port, the extension relay port is automatically derived: diff --git a/src/agents/tools/browser-tool.ts b/src/agents/tools/browser-tool.ts index 8b6556fd55a..54ddab2cb1f 100644 --- a/src/agents/tools/browser-tool.ts +++ b/src/agents/tools/browser-tool.ts @@ -293,11 +293,6 @@ function shouldPreferHostForProfile(profileName: string | undefined) { return capabilities.requiresRelay || capabilities.usesChromeMcp; } -function isHostOnlyProfileName(profileName: string | undefined) { - // User-browser profiles (existing-session, extension relay) are host-only. - return shouldPreferHostForProfile(profileName); -} - export function createBrowserTool(opts?: { sandboxBridgeUrl?: string; allowHostControl?: boolean; @@ -331,7 +326,9 @@ export function createBrowserTool(opts?: { if (requestedNode && target && target !== "node") { throw new Error('node is only supported with target="node".'); } - if (isHostOnlyProfileName(profile)) { + // User-browser profiles (existing-session, extension relay) are host-only. + const isUserBrowserProfile = shouldPreferHostForProfile(profile); + if (isUserBrowserProfile) { if (requestedNode || target === "node") { throw new Error(`profile="${profile}" only supports the local host browser.`); } @@ -340,10 +337,9 @@ export function createBrowserTool(opts?: { `profile="${profile}" cannot use the sandbox browser; use target="host" or omit target.`, ); } - } - if (!target && !requestedNode && shouldPreferHostForProfile(profile)) { - // Local host user-browser profiles should not silently bind to sandbox/node browsers. - target = "host"; + if (!target && !requestedNode) { + target = "host"; + } } const nodeTarget = await resolveBrowserNodeTarget({