Skip to content

fix(core): pass local profile dir as Chrome flag#2237

Open
luochen211 wants to merge 1 commit into
browserbase:mainfrom
luochen211:fix-local-user-data-dir-flag
Open

fix(core): pass local profile dir as Chrome flag#2237
luochen211 wants to merge 1 commit into
browserbase:mainfrom
luochen211:fix-local-user-data-dir-flag

Conversation

@luochen211

@luochen211 luochen211 commented Jun 11, 2026

Copy link
Copy Markdown

Summary

  • pass local browser userDataDir as a Chrome flag instead of a chrome-launcher option
  • keep chrome-launcher from converting the profile path before Node filesystem operations
  • add a regression test around launchLocalChrome arguments

Fixes #1503

Tests

  • pnpm --dir packages/core run build:esm && pnpm --dir packages/core exec vitest run --config vitest.esm.config.mjs dist/esm/tests/unit/launch-local-ignore-default-args.test.js
  • pnpm --dir packages/core run lint
  • pnpm exec prettier --check packages/core/lib/v3/launch/local.ts packages/core/tests/unit/launch-local-ignore-default-args.test.ts
  • git diff --check

Summary by cubic

Fix local Chrome profile handling by passing --user-data-dir directly to Chrome instead of via chrome-launcher, avoiding path conversion and making local profiles work reliably. Fixes #1503.

  • Bug Fixes
    • Add --user-data-dir=<path> to Chrome flags; stop sending userDataDir to chrome-launcher.
    • Add a regression test to assert the flag is used and the option is omitted.

Written for commit 8d04ca6. Summary will update on new commits.

Review in cubic

@changeset-bot

changeset-bot Bot commented Jun 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8d04ca6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@browserbasehq/stagehand Patch
@browserbasehq/stagehand-evals Patch
@browserbasehq/stagehand-server-v3 Patch

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

@github-actions

Copy link
Copy Markdown
Contributor

This PR is from an external contributor and must be approved by a stagehand team member with write access before CI can run.
Approving the latest commit mirrors it into an internal PR owned by the approver.
If new commits are pushed later, the internal PR stays open but is marked stale until someone approves the latest external commit and refreshes it.

@github-actions github-actions Bot added external-contributor Tracks PRs mirrored from external contributor forks. external-contributor:awaiting-approval Waiting for a stagehand team member to approve the latest external commit. labels Jun 11, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.
Architecture diagram
sequenceDiagram
    participant Test as Regression Test
    participant Launch as launchLocalChrome()
    participant Flags as ChromeFlags Builder
    participant Launcher as chrome-launcher

    Note over Test,Launcher: Launch flow

    Test->>Launch: call with userDataDir option
    Launch->>Flags: build chromeFlags array
    Flags->>Flags: append "--user-data-dir=<path>"
    Flags-->>Launch: chromeFlags list
    Launch->>Launcher: launch({ chromeFlags, ignoreDefaultFlags })
    Note over Launch,Launcher: userDataDir NOT passed to launcher
    Launcher->>Launcher: start Chrome with flags
    Launcher-->>Launch: browser instance

    Note over Test,Launcher: Assertion path

    Test->>Launch: getLaunchArgs() captures launcher options
    alt userDataDir option absent from launcher
        Test-->>Test: expect args.userDataDir to be undefined
    end
    alt chromeFlags contains user-data-dir
        Test-->>Test: expect "--user-data-dir=<path>" in flags
    end
Loading

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contributor:awaiting-approval Waiting for a stagehand team member to approve the latest external commit. external-contributor Tracks PRs mirrored from external contributor forks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WSL2] userDataDir path converted to Windows format causes directory creation with literal backslashes on Linux

1 participant