feat(browser): add extraArgs config for custom Chrome launch args#18443
Merged
steipete merged 4 commits intoopenclaw:mainfrom Feb 16, 2026
Merged
feat(browser): add extraArgs config for custom Chrome launch args#18443steipete merged 4 commits intoopenclaw:mainfrom
steipete merged 4 commits intoopenclaw:mainfrom
Conversation
Adds a `browser.extraArgs` config option (string array) that is appended to Chrome's launch arguments. This enables users to add stealth flags, window size overrides, custom user-agent strings, or other Chrome flags without patching the source code. Example config: browser.extraArgs: ["--window-size=1920,1080", "--disable-infobars"] Co-Authored-By: Claude Opus 4.6 <[email protected]>
Comment on lines
+200
to
+202
| const extraArgs = Array.isArray(cfg?.extraArgs) | ||
| ? cfg.extraArgs.filter((a): a is string => typeof a === "string" && a.trim().length > 0) | ||
| : []; |
Contributor
There was a problem hiding this comment.
Consider adding tests for extraArgs filtering logic (empty strings, non-strings, mixed arrays)
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 AI
This is a comment left during a code review.
Path: src/browser/config.ts
Line: 200:202
Comment:
Consider adding tests for `extraArgs` filtering logic (empty strings, non-strings, mixed arrays)
<sub>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!</sub>
How can I resolve this? If you propose a fix, please make it concise.Add the missing extraArgs property to buildSandboxBrowserResolvedConfig to satisfy the ResolvedBrowserConfig type, and fix import ordering. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Address review feedback: add tests covering empty strings, non-strings, mixed arrays, and non-array inputs for extraArgs. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Member
|
Please don't revert as this is a very useful feature. |
18 tasks
18 tasks
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
browser.extraArgsconfig option (string array) for custom Chrome launch argumentsabout:blankargumentContext
When using OpenClaw's browser for automation tasks (e.g., social media, web scraping), sites often detect default Chrome automation signatures. Currently the only way to add stealth flags like
--window-size,--disable-infobars, or custom--user-agentis to patch the compiled source code on every container start.This config option makes it declarative:
{ "browser": { "extraArgs": [ "--window-size=1920,1080", "--disable-infobars", "--user-agent=Mozilla/5.0 ..." ] } }Changes
src/config/types.browser.ts: AddedextraArgs?: string[]toBrowserConfigsrc/browser/config.ts: AddedextraArgstoResolvedBrowserConfig, parsed from configsrc/browser/chrome.ts: AppendsextraArgsto Chrome launch argsTest plan
browser.extraArgs: ["--window-size=1920,1080"]→ verify Chrome launches with flagextraArgs→ no change in behavior (backward compatible)🤖 Generated with Claude Code
Greptile Summary
Adds a new
browser.extraArgsconfiguration option that allows users to pass custom Chrome launch arguments. This enables declarative configuration of stealth flags, window sizing, and user-agent overrides without patching source code. The implementation correctly filters non-string and empty values, uses secure spawn with array arguments, and places extra args before the finalabout:blankargument. The feature is backward compatible and follows existing config patterns.Confidence Score: 4/5
Last reviewed commit: 1495d95