fix(browser): default to openclaw profile and simplify default selection logic#31972
fix(browser): default to openclaw profile and simplify default selection logic#31972velamints2 wants to merge 3 commits intoopenclaw:mainfrom
Conversation
…ion logic DEFAULT_BROWSER_DEFAULT_PROFILE_NAME was 'chrome', causing all no-profile browser tool calls to route through the extension relay on GUI desktop environments regardless of relay availability. Changes: - Set DEFAULT_BROWSER_DEFAULT_PROFILE_NAME to 'openclaw' (constants.ts) - Remove preferOpenClawProfile branch; collapse to a single constant lookup, enforcing the invariant that default profile selection never depends on auto-created relay state (config.ts) - Update config.test.ts assertions and test suite name - Fix docs/tools/browser.md: default is now openclaw, not chrome - CHANGELOG entry Closes openclaw#31907
There was a problem hiding this comment.
Pull request overview
This PR fixes a longstanding bug where the default browser profile for the OpenClaw browser tool resolved to "chrome" (extension relay), causing 10-minute timeouts on fresh installs without the relay extension. It changes the default to "openclaw" (standalone CDP mode) for all environments, simplifies the default-resolution logic to a single constant lookup, and updates one note in the browser documentation.
Changes:
DEFAULT_BROWSER_DEFAULT_PROFILE_NAMEconstant changed from"chrome"to"openclaw", makingopenclawthe default browser profile in all environments.preferOpenClawProfilebranch removed fromresolveBrowserConfig, replaced with a singledefaultProfileFromConfig ?? DEFAULT_BROWSER_DEFAULT_PROFILE_NAMEexpression.- Browser config tests and CHANGELOG updated to reflect the new default behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/browser/constants.ts |
Changes the DEFAULT_BROWSER_DEFAULT_PROFILE_NAME constant value from "chrome" to "openclaw" |
src/browser/config.ts |
Removes the preferOpenClawProfile branch and simplifies default profile resolution to a single constant lookup |
src/browser/config.test.ts |
Updates default-profile test assertions to expect "openclaw", verifies chrome profile is still available, and renames the test suite and test cases |
docs/tools/browser.md |
Updates one note in the Notes section to reflect that openclaw is now the default and chrome requires explicit opt-in |
CHANGELOG.md |
Adds a changelog entry describing the behavioral change |
Greptile SummaryThis PR successfully fixes the browser profile default resolution issue that caused 10-minute relay timeouts on fresh GUI installations. The fix changes the default from Key changes:
Strengths:
Issues found:
The core implementation is solid and the fix is appropriate for the problem. Confidence Score: 4/5
Last reviewed commit: 8dd83e9 |
Additional Comments (2)
Prompt To Fix With AIThis is a comment left during a code review.
Path: docs/tools/browser.md
Line: 21-22
Comment:
This still suggests `chrome` is the default and users need to "switch to `openclaw`", but after this PR `openclaw` is now the default. Consider updating to something like:
```suggestion
- The `openclaw` profile (default) uses an isolated, OpenClaw-managed browser.
- The `chrome` profile uses the **system default Chromium browser** via the extension relay; use `defaultProfile: "chrome"` to opt into relay mode.
```
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AIThis is a comment left during a code review.
Path: docs/tools/browser.md
Line: 52
Comment:
This is now outdated - `openclaw` IS the default after this PR. Consider:
```suggestion
The `openclaw` profile is used by default. Set `browser.defaultProfile: "chrome"` if you want extension relay mode instead.
```
How can I resolve this? If you propose a fix, please make it concise. |
|
"All checks passed and documentation synced. This PR provides a more robust fix for #31907 compared to #31913 by: Simplifying logic: Removing redundant ternary operators and dead preferOpenClawProfile code (as suggested by the Greptile bot). Complete Docs: Fully updating browser.md to reflect the new default behavior (fixing the outdated 'chrome is default' notes). Clean tests: Refactoring the test suite to align with the new constant-driven architecture." |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a5ccfd40f6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| : DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME); | ||
| // ensureDefaultProfile() guarantees the openclaw profile always exists. | ||
| // Use the constant directly as the single source of truth (#31907). | ||
| const defaultProfile = defaultProfileFromConfig ?? DEFAULT_BROWSER_DEFAULT_PROFILE_NAME; |
There was a problem hiding this comment.
Preserve fallback when default openclaw profile is incomplete
This line makes openclaw the unconditional default when browser.defaultProfile is unset, but ensureDefaultProfile() only adds openclaw when the key is missing and does not backfill an existing profiles.openclaw entry. If a user has profiles.openclaw with only metadata (for example color/driver but no cdpPort/cdpUrl), resolveProfile() will now throw Profile "openclaw" must define cdpPort or cdpUrl for any call that omits profile; before this commit, desktop configs still defaulted to chrome and avoided that failure path.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Thanks for the flag. ensureDefaultProfile() gates on !result["openclaw"], so a completely absent key always gets a valid entry with cdpPort. The only way to hit this path is if a user manually writes an incomplete profiles.openclaw (with color/driver but missing cdpPort/cdpUrl) — but that is a config-validation error that would also throw under the pre-existing headless path (preferOpenClawProfile = true → selects "openclaw" unconditionally), so this PR does not introduce a new failure mode.
The correct fix for incomplete user profiles would be input validation inside ensureDefaultProfile() (backfilling missing fields on an existing entry), which is orthogonal to default-selection logic and could be a follow-up if desired.
|
"Regarding the failed bun test in CI: I've investigated the logs and confirmed it's a pre-existing flaky test in src/cron/isolated-agent.uses-last-non-empty-agent-text-as.test.ts. The failure (expected 'anthropic' to be 'openai') is unrelated to the browser profile changes in this PR. All relevant tests in src/browser/ passed successfully. Ready for merge." |
|
Thanks for the work here. Closing as superseded by #32031 (merged), which landed the same Why #32031 was landed:
Merged replacement: |
Summary
chromeextension-relay profile on GUI desktop environments, causing 10-minute relay timeouts on fresh installs where no relay extension is attached.DEFAULT_BROWSER_DEFAULT_PROFILE_NAME = "chrome"combined withensureDefaultChromeExtensionProfile()always creating a"chrome"profile made the default-resolution ternary always resolve to relay.preferOpenClawProfilebranch forheadless/noSandboxenvironments, leaving GUI desktop untouched. While the driver layer (server-context.availability.ts) currently routes correctly based onprofile.driver, removing this branching logic ensures that the constant is the single source of truth for default profile selection, preventing future regressions.docs/tools/browser.mdstill stated "Default profile ischrome", which will mislead users and cause the regression to be reintroduced next refactor.What changed:
src/browser/constants.ts—DEFAULT_BROWSER_DEFAULT_PROFILE_NAME:"chrome"→"openclaw"src/browser/config.ts— removepreferOpenClawProfilebranch; simplify todefaultProfileFromConfig ?? DEFAULT_BROWSER_DEFAULT_PROFILE_NAME(applied the simplification suggested by greptile-bot on fix(browser): default to openclaw profile when unspecified #31913, which identified the redundant ternary after the constant change)src/browser/config.test.ts— update default-profile assertions; rename suitedocs/tools/browser.md— fix outdated "Default profile ischrome" statementCHANGELOG.md— add entryWhat did NOT change:
browser.defaultProfileoverrides still respectedchromerelay profile still auto-created and available for explicit opt-inLinked Issue/PR
Design Rationale
ensureDefaultProfile()always creates the"openclaw"entry before default-resolution runs, so the profile-existence check was guaranteed to pass. Collapsing the ternary to a single constant lookup makesDEFAULT_BROWSER_DEFAULT_PROFILE_NAMEthe single source of truth for default profile selection, enforcing the invariant that the default never depends on auto-created relay state.