mirror of
https://github.com/moltbot/moltbot.git
synced 2026-03-30 01:06:11 +00:00
fix(browser): prefer openclaw profile in headless/noSandbox environments
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
This commit is contained in:
committed by
Peter Steinberger
parent
d0ac1b0195
commit
3e3b49cb94
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user