fix(browser): prefer openclaw profile in headless/noSandbox environments#14944
Merged
steipete merged 4 commits intoopenclaw:mainfrom Mar 2, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes browser snapshot/screenshot failures in headless or noSandbox server environments (e.g., Ubuntu Server) by automatically preferring the openclaw profile over the chrome extension relay profile when either browser.headless=true or browser.noSandbox=true.
Changes:
- Modified default profile resolution logic to prefer
openclawin headless/noSandbox environments - Preserves
chromeas default for GUI environments where extension relay works - User-configured
defaultProfilestill takes precedence over automatic selection
Comment on lines
+197
to
+204
| 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); |
There was a problem hiding this comment.
The new profile preference logic for headless/noSandbox environments lacks test coverage. Consider adding test cases to verify:
- When headless=true, defaultProfile should be "openclaw"
- When noSandbox=true, defaultProfile should be "openclaw"
- When both are false, defaultProfile should remain "chrome" (existing behavior)
- When defaultProfile is explicitly set in config, it should override the preference logic
This will ensure the fix for issue #14895 is properly validated and prevent future regressions.
bfc1ccb to
f92900f
Compare
6d58130 to
90841c3
Compare
|
这个合并进去了么? |
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: openclaw#14895 🤖 AI-assisted (Claude), fully tested: pnpm build && pnpm check && pnpm test
Cover all cases requested in review: 1. headless=true → defaultProfile = 'openclaw' 2. noSandbox=true → defaultProfile = 'openclaw' 3. both false → defaultProfile = 'chrome' (existing behavior) 4. explicit defaultProfile config overrides preference logic 5. custom profiles work in headless mode Fixes: openclaw#14895
90841c3 to
c5b2746
Compare
steipete
added a commit
that referenced
this pull request
Mar 2, 2026
Contributor
|
Landed via temp rebase onto main.
Thanks @BenediktSchackenberg! |
1 task
|
in which version this went live? |
robertchang-ga
pushed a commit
to robertchang-ga/openclaw
that referenced
this pull request
Mar 2, 2026
hanqizheng
pushed a commit
to hanqizheng/openclaw
that referenced
this pull request
Mar 2, 2026
execute008
pushed a commit
to execute008/openclaw
that referenced
this pull request
Mar 2, 2026
dawi369
pushed a commit
to dawi369/davis
that referenced
this pull request
Mar 3, 2026
OWALabuy
pushed a commit
to kcinzgg/openclaw
that referenced
this pull request
Mar 4, 2026
dawi369
pushed a commit
to dawi369/davis
that referenced
this pull request
Mar 3, 2026
OWALabuy
pushed a commit
to kcinzgg/openclaw
that referenced
this pull request
Mar 4, 2026
sachinkundu
pushed a commit
to sachinkundu/openclaw
that referenced
this pull request
Mar 6, 2026
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
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
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:Solution
This fix prefers the
openclawprofile (Playwright native mode) when:browser.headless=true, orbrowser.noSandbox=trueWhile preserving the
chromedefault for GUI environments where extension relay works.Changes
src/browser/config.ts:preferOpenClawProfilecheck based on headless/noSandbox settingsdefaultProfileresolution to preferopenclawin server environmentsTesting
pnpm build- ✅ Successpnpm check(format + lint + typecheck) - ✅ Successpnpm test- ✅ 270 tests passedAI Disclosure
🤖 AI-assisted (Claude), fully tested locally before submission.
Greptile Overview
Greptile Summary
This change updates browser config resolution so that when running in
browser.headless=trueorbrowser.noSandbox=trueenvironments, the default browser profile prefers the built-inopenclaw(Playwright/native) profile instead of thechrome(extension relay) profile.It does this by introducing a
preferOpenClawProfileflag and adjusting thedefaultProfilefallback selection order, while still honoring any explicitbrowser.defaultProfilesetting from user config. This integrates with the existing profile auto-creation (ensureDefaultProfile/ensureDefaultChromeExtensionProfile) and only affects which profile name is chosen by default.Confidence Score: 5/5
openclawprofile is always present. No behavioral changes occur unless headless/noSandbox is enabled and no explicit default profile is set.Last reviewed commit: df0704d
(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!