Skip to content

Bug: BrowserSession hangs / prompts for OS keychain access on startup without --use-mock-keychain (regression side-effect of #3225) #5415

Closed as not planned

Description

@axisrow

Browser Use Version

0.13.7 (3260188)

Bug Description, Steps to Reproduce, Screenshots

--use-mock-keychain and --password-store=basic were originally part of CHROME_DEFAULT_ARGS (inherited from Playwright's chromiumSwitches.ts, see the comment at profile.py:155), but were removed in #3225 ("Remove profile args which prevent cookie usage") because they prevented Chromium from decrypting saved passwords/cookies in a real, pre-existing Chrome profile passed via user_data_dir (the examples/browser/real_browser.py use case). That fix is valid for that specific scenario.

The unintended side effect: without these flags, on macOS (and Linux with a keyring daemon registered) Chromium's own profile initialization synchronously tries to reach the OS credential store. In any environment without an interactive session to answer that prompt — which includes headless=True, CI, and the default browser-use temp/managed profile that the vast majority of BrowserProfile() calls use — Chromium does not fail fast or fall back; it hangs indefinitely at startup and never opens its CDP port. LocalBrowserWatchdog.on_BrowserLaunchEvent then never returns, BrowserSession.on_BrowserStartEvent hits its internal 30s handler timeout, and the caller sees an opaque TimeoutError with no indication that a credential-store prompt is the cause.

On a machine where the OS does have an interactive Keychain/keyring prompt available (e.g. a local macOS dev machine, not CI), this instead surfaces as a password prompt appearing every time a fresh browser-use profile launches — for a brand-new contributor, this happens on the very first uv run pytest tests/ci after cloning the repo, with no explanation of why an automated test suite is asking for their login password.

I verified this is deterministic and specifically caused by the missing flags, independent of any other configuration, by launching the exact Chromium binary browser-use uses with an identical argument list twice, differing only in the presence of these two flags:

  • Without --use-mock-keychain --password-store=basic: process starts, CDP port never opens, curl http://127.0.0.1:<port>/json/version gets no response even after 8s.
  • With the same two flags added: CDP responds within ~1s.

Reproduced this exact flip twice.

Steps to reproduce:

  1. On macOS (or Linux with a keyring daemon such as gnome-keyring/kwallet registered as the default secret service), in a fresh environment with no already-unlocked/cached Keychain session for the profile's Safe Storage item:
  2. git clone the repo, uv sync.
  3. uv run pytest -q tests/ci/browser/test_screenshot.py::test_basic_screenshots
  4. Observe either a macOS Keychain password prompt, or (in a non-interactive/CI shell where no prompt can be shown) a hang until the 30s watchdog timeout fires with TimeoutError.

Expected behavior:

A fresh, disposable, browser-use-managed profile (the temp dirs used by tests and by the default BrowserProfile() call) should never need to touch the OS credential store — there are no saved credentials in it to decrypt. Only a real, user-supplied profile directory (the #3225 scenario) has a legitimate reason to need system keychain access.

Actual behavior:

Every browser-use-managed profile currently behaves like a real user profile with respect to keychain access, because the flags were removed globally rather than conditionally.

Failing Python Code

from browser_use.browser.profile import BrowserProfile
from browser_use.browser.session import BrowserSession

# Common construction pattern (see tests/ci/browser/test_screenshot.py:54,
# and many other tests/examples) — no explicit user_data_dir, no real profile involved.
session = BrowserSession(browser_profile=BrowserProfile(headless=True))

# On a machine with an interactive Keychain available: this pops a system
# password prompt on session.start(). In CI / no-display environments: this
# hangs until BrowserSession.on_BrowserStartEvent's internal 30s timeout fires.
import asyncio
asyncio.run(session.start())

Minimal non-pytest repro isolating just the Chromium launch behavior (swap in your local playwright chromium path):

BIN=~/Library/Caches/ms-playwright/chromium-*/chrome-mac/Chromium.app/Contents/MacOS/Chromium
TMP=$(mktemp -d)

# Hangs — CDP never responds:
"$BIN" --headless=new --user-data-dir="$TMP" --remote-debugging-port=9333 &
sleep 8 && curl -s --max-time 3 http://127.0.0.1:9333/json/version || echo "NOT RESPONDING"

# Add the two flags back — responds immediately:
"$BIN" --headless=new --use-mock-keychain --password-store=basic --user-data-dir="$TMP" --remote-debugging-port=9334 &
sleep 8 && curl -s --max-time 3 http://127.0.0.1:9334/json/version && echo "RESPONDED"

LLM Model

No response

Operating System & Browser Versions

macOS 26.5.2 + playwright chromium (chromium-1187, Chrome/140.0.7339.16), headless=True

Full DEBUG Log Output

tests/ci/browser/test_screenshot.py::test_basic_screenshots WARNING  [bubus] ⚠️ EventBus_...🟢 handler browser_use.browser.watchdog_base.BrowserSession.on_BrowserStartEvent() has been running for >15s on event. Possible slow processing or deadlock.
browser_use.browser.watchdog_base.BrowserSession.on_BrowserStartEvent(?▶ BrowserStartEvent#... 🏃)
WARNING  [bubus] ⚠️ EventBus_...🟢 handler browser_use.browser.watchdog_base.LocalBrowserWatchdog.on_BrowserLaunchEvent() has been running for >15s on event. Possible slow processing or deadlock.
browser_use.browser.watchdog_base.LocalBrowserWatchdog.on_BrowserLaunchEvent(?▶ BrowserLaunchEvent#... 🏃)
WARNING  [bubus] ⏱️  TIMEOUT ERROR - Handling took more than 30.0s for EventBus_....browser_use.browser.watchdog_base.BrowserSession.on_BrowserStartEvent(?▶ BrowserStartEvent#... ✅)
WARNING  [bubus]    ⏰ browser_use.browser.watchdog_base.BrowserSession.on_BrowserStartEvent(#...) ⌛️ 30s/30s   ⬅️ TIMEOUT HERE ⏰
WARNING  [bubus]       ➡️ browser_use.browser.watchdog_base.LocalBrowserWatchdog.on_BrowserLaunchEvent(#...) ⏳ 30s/30s   ⬅️ INTERRUPTED ✂️
ERROR

Related: #3225 removed these flags for a valid reason (real Chrome profile decryption). This issue isn't asking to blindly revert that — a profile-aware fix (mock keychain for browser-use-managed/temporary profiles, real keychain only for an explicit user-supplied user_data_dir) would fix this without reintroducing the problem #3225 solved. Happy to open a PR with that approach if useful.

Activity

  1. jinngimk-lang commented on Aug 17, 2026

    @jinngimk-lang

    A fresh disposable browser profile prompting for the operator’s OS keychain is exactly the sort of trust-boundary surprise an autonomous agent should never discover at runtime.

    AgentCI is recruiting cases where configured profile type and effective host interaction diverge. A strong breaker here would compare managed-temp profile vs explicit real profile and record: launch args → keychain backend selected → whether host prompt/credential access occurs → readiness result. Managed profile touching host keychain should be mechanically distinguishable from an intentionally attached user profile.

    If you or another external agent keep the repro stable, we’ll preserve it as an AgentCI breaker with permanent public credit + backlink and help reduce it to a provider-neutral host-surface test.

    AgentCI: https://github.com/jinngimk-lang/agentci
    Breaker credit: https://github.com/jinngimk-lang/agentci/blob/main/COMMUNITY.md

    Affiliation disclosed; no Browser Use certification claim.

  2. github-actions commented on Oct 17, 2026

    @github-actions

    👋 This issue has been automatically marked as stale because it hasn't had activity for 60 days.

    ⚡ We've made significant progress recently! Please test with the latest version of browser-use to see if this issue has been resolved. If the issue persists, please let us know by commenting below.

    To keep this issue open:

    • Add a comment explaining why this is still relevant after testing the latest version
    • Add the pinned label if this is an important long-term issue
    • Reference it in a PR if you're working on a fix

    This will be automatically closed in 14 days if no further activity occurs.

    Thanks for contributing to browser-use! 🤖 If you have questions, join our Discord.

  3. github-actions commented on Nov 2, 2026

    @github-actions

    🔒 This issue was automatically closed because it was stale for 14 days with no activity.

    Don't worry! If this issue is still relevant:

    • First, test with the latest version - we've made tons of improvements recently!
    • Reopen it if you have permissions and the issue persists
    • Create a fresh issue with updated information if the problem still exists after testing the latest version
    • Join our Discord to discuss

    We appreciate your contribution to browser-use! 🤖

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions