From 3e3b49cb94153197f6d7b598ef78b7bbcec08b38 Mon Sep 17 00:00:00 2001 From: Benedikt Schackenberg Date: Thu, 12 Feb 2026 20:09:23 +0000 Subject: [PATCH] fix(browser): prefer openclaw profile in headless/noSandbox environments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In headless or noSandbox server environments (like Ubuntu Server), the Chrome extension relay cannot work because there is no GUI browser to attach to. Previously, the default profile was 'chrome' (extension relay) which caused snapshot/screenshot operations to fail with: 'Chrome extension relay is running, but no tab is connected...' This fix prefers the 'openclaw' profile (Playwright native mode) when browser.headless=true or browser.noSandbox=true, while preserving the 'chrome' default for GUI environments where extension relay works. Fixes: https://github.com/openclaw/openclaw/issues/14895 🤖 AI-assisted (Claude), fully tested: pnpm build && pnpm check && pnpm test --- src/browser/config.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/browser/config.ts b/src/browser/config.ts index c1e6cdc162f..3c066b4a699 100644 --- a/src/browser/config.ts +++ b/src/browser/config.ts @@ -232,11 +232,18 @@ export function resolveBrowserConfig( controlPort, ); const cdpProtocol = cdpInfo.parsed.protocol === "https:" ? "https" : "http"; + + // In headless/noSandbox environments (servers), prefer "openclaw" profile over "chrome" + // because Chrome extension relay requires a GUI browser which isn't available headless. + // Issue: https://github.com/openclaw/openclaw/issues/14895 + const preferOpenClawProfile = headless || noSandbox; const defaultProfile = defaultProfileFromConfig ?? - (profiles[DEFAULT_BROWSER_DEFAULT_PROFILE_NAME] - ? DEFAULT_BROWSER_DEFAULT_PROFILE_NAME - : DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME); + (preferOpenClawProfile && profiles[DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME] + ? DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME + : profiles[DEFAULT_BROWSER_DEFAULT_PROFILE_NAME] + ? DEFAULT_BROWSER_DEFAULT_PROFILE_NAME + : DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME); const extraArgs = Array.isArray(cfg?.extraArgs) ? cfg.extraArgs.filter((a): a is string => typeof a === "string" && a.trim().length > 0)