feat: forward ignoreDefaultArgs to chrome-launcher#2074
Open
CalebBarnes wants to merge 2 commits intobrowserbase:mainfrom
Open
feat: forward ignoreDefaultArgs to chrome-launcher#2074CalebBarnes wants to merge 2 commits intobrowserbase:mainfrom
CalebBarnes wants to merge 2 commits intobrowserbase:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 1426616 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
This PR is from an external contributor and must be approved by a stagehand team member with write access before CI can run. |
9995492 to
c0a459f
Compare
When localBrowserLaunchOptions.ignoreDefaultArgs is set, pass it through launchLocalChrome to chrome-launcher's ignoreDefaultFlags option. This allows consumers to selectively remove chrome-launcher's built-in default flags (e.g. --disable-extensions) without losing Stagehand's own defaults. - true: drops all chrome-launcher defaults - string[]: drops only the listed flags, keeps the rest Co-Authored-By: Mastra Code (anthropic/claude-opus-4-6) <noreply@mastra.ai>
c0a459f to
e899e32
Compare
Contributor
There was a problem hiding this comment.
No issues found across 2 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Architecture diagram
sequenceDiagram
participant User as Consumer/SDK
participant V3 as V3 Service
participant Local as launchLocalChrome
participant CL as chrome-launcher (Lib)
participant OS as Chrome Process
User->>V3: init(localBrowserLaunchOptions)
Note right of User: Includes NEW: ignoreDefaultArgs
V3->>Local: launchLocalChrome(opts)
Local->>Local: Initialize chromeFlags (Stagehand defaults + User flags)
alt ignoreDefaultArgs is boolean (true)
Note over Local: User wants to drop ALL chrome-launcher defaults
Local->>Local: Set ignoreDefaultFlags = true
else ignoreDefaultArgs is string[]
Note over Local: User wants to selectively remove defaults
Local->>CL: CHANGED: Launcher.defaultFlags()
CL-->>Local: Returns built-in flags (e.g. --disable-extensions)
Local->>Local: Filter defaults based on ignoreDefaultArgs
Local->>Local: Prepend kept defaults to chromeFlags
Local->>Local: Set ignoreDefaultFlags = true
end
Local->>CL: launch({ ..., ignoreDefaultFlags, chromeFlags })
CL->>OS: spawn chrome with final flag set
OS-->>CL: Process started (PID/Port)
CL-->>Local: LaunchedChrome object
Local-->>V3: Connection details
V3-->>User: Browser Instance Ready
Change flag filtering from substring (String.includes) to exact match, consistent with Puppeteer/Playwright behavior. Add tests covering all branches (true, false, string[], empty array), exact-match semantics, Stagehand flag preservation, user flag merging, and duplicate behavior. Update JSDoc and docs to reflect exact matching. Co-Authored-By: Mastra Code (anthropic/claude-opus-4-6) <noreply@mastra.ai>
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.
why
When running Stagehand locally, chrome-launcher adds its own set of default flags (e.g.
--disable-extensions). There's currently no way for consumers to selectively remove these flags —localBrowserLaunchOptions.chromeFlagscan only add flags, not remove chrome-launcher's built-in defaults.This is needed when users want to run Chrome with extensions enabled, or need to remove other chrome-launcher defaults for their use case.
what changed
ignoreDefaultArgsoption toLaunchLocalOptionsinlocal.tslocalBrowserLaunchOptions.ignoreDefaultArgsfromv3.tsthrough tolaunchLocalChrome()true: drops all chrome-launcher defaults (only Stagehand's own flags and user-suppliedchromeFlagsare used)string[]: selectively removes only the listed flags from chrome-launcher defaults, keeping the restThis mirrors the behavior of Playwright's
ignoreDefaultArgsoption.test plan
ignoreDefaultArgs: ["--disable-extensions"]successfully removes the flag from the launched Chrome instance (confirmed viachrome://version/)ignoreDefaultArgs: truedrops all chrome-launcher defaultsSummary by cubic
Adds
ignoreDefaultArgsto local Chrome launch and forwards it tochrome-launcherso users can drop all or selected default flags while keeping Stagehand and user flags.ignoreDefaultArgstoLaunchLocalOptionsand wired it through V3 tolaunchLocalChrome(), mapping tochrome-launcher’signoreDefaultFlags.truedrops allchrome-launcherdefaults;string[]removes only exact-matched defaults and re-adds the rest fromLauncher.defaultFlags(), preserving Stagehand defaults and userchromeFlags.Written for commit 1426616. Summary will update on new commits.