← Back to PRs

#14944: fix(browser): prefer openclaw profile in headless/noSandbox environments

by BenediktSchackenberg open 2026-02-12 20:09 View on GitHub →
size: S
## Summary Fixes #14895 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. Click the OpenClaw Chrome extension icon on a tab to attach it... ``` ## Solution 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. ## Changes `src/browser/config.ts`: - Added `preferOpenClawProfile` check based on headless/noSandbox settings - Updated `defaultProfile` resolution to prefer `openclaw` in server environments ## Testing - [x] `pnpm build` - ✅ Success - [x] `pnpm check` (format + lint + typecheck) - ✅ Success - [x] `pnpm test` - ✅ 270 tests passed ## AI Disclosure 🤖 AI-assisted (Claude), fully tested locally before submission. <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This change updates browser config resolution so that when running in `browser.headless=true` or `browser.noSandbox=true` environments, the default browser profile prefers the built-in `openclaw` (Playwright/native) profile instead of the `chrome` (extension relay) profile. It does this by introducing a `preferOpenClawProfile` flag and adjusting the `defaultProfile` fallback selection order, while still honoring any explicit `browser.defaultProfile` setting from user config. This integrates with the existing profile auto-creation (`ensureDefaultProfile` / `ensureDefaultChromeExtensionProfile`) and only affects which profile name is chosen by default. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk. - The change is small and localized to default-profile selection logic, preserves explicit user configuration, and relies on existing guarantees that the `openclaw` profile is always present. No behavioral changes occur unless headless/noSandbox is enabled and no explicit default profile is set. - src/browser/config.ts <sub>Last reviewed commit: df0704d</sub> <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> <!-- /greptile_comment -->

Most Similar PRs