Cold-start auto-launch fails: daemon exits before the chrome-not-running rescue branch can fire
Summary
When Chrome has zero running processes (a true cold start — not just "CDP port not up yet"), browser-harness fails outright with daemon default didn't come up, instead of auto-launching Chrome as advertised since v0.1.8 ("If no Chromium-family browser is running, the harness launches one for you").
Confirmed regression between 0.1.9 and 0.1.13 (0.1.9 auto-launched correctly in this exact scenario, verified twice against real automated worker processes before upgrading; 0.1.13 fails immediately, reproduced 3 times in a row with a clean environment — Chrome fully quit, no stale singleton lock files, fresh daemon log each time).
Environment
- macOS (Darwin 25.6.0)
- browser-harness 0.1.13 (pypi install)
- Python 3.11.15
Reproduction
osascript -e 'quit app "Google Chrome"'
# confirm zero Chrome processes: ps aux | grep "Google Chrome.app/Contents/MacOS/Google Chrome "
rm -f ~/.config/browser-harness/tmp/bu-default.log
browser-harness <<'PY'
new_tab("https://example.com")
print(page_info())
PY
Actual: immediate failure —
browser-harness: daemon default didn't come up -- check ~/.config/browser-harness/tmp/bu-default.log
with bu-default.log containing exactly one line:
fatal: chrome-not-running: no supported Chromium-family browser is running -- start Chrome, then retry
No "Chrome isn't running — launching it" message is ever printed, and no Chrome process is spawned.
Expected: the harness launches Chrome automatically (per the v0.1.8 auto-launch feature) and proceeds normally.
Root cause (traced in the installed package source)
In browser_harness/daemon.py, the daemon subprocess's own connect-wait loop:
if now >= next_liveness_check:
if not supported_browser_running():
raise RuntimeError(
"chrome-not-running: no supported Chromium-family browser is running -- start Chrome, then retry"
)
next_liveness_check = now + 2
raises and lets the daemon subprocess exit almost immediately when Chrome isn't running at all (no 30s grace — the first liveness check trips it).
Back in browser_harness/admin.py, the higher-level orchestrator that's supposed to catch this and auto-launch Chrome only does so on this branch:
if local and launched_browser is None and _chrome_not_running(msg):
# Chrome is closed — launch the browser and retry
restart_daemon(name)
launched_browser = _launch_browser()
...
But that branch is only reached if the daemon subprocess is still alive while its log reports chrome-not-running (i.e. pending_died is False). Since the daemon subprocess actually exits immediately in the true-cold-start case, the orchestrator instead takes the earlier pending_died branch:
if local and pending_died:
...
if permission_wait:
raise RuntimeError("permission-blocked: ...")
continue # <-- just respawns the SAME daemon again, up to 3x, never calling _launch_browser()
permission_wait is False for this message (it only checks for handshake-wait / permission-popup prefixes), so it falls through to continue, which just retries spawning the daemon from scratch — without ever calling _launch_browser(). After 3 identical failed attempts it gives up with daemon default didn't come up.
Auto-launch still works fine for the other chrome-not-running-ish case (Chrome running but CDP port not up yet, e.g. right after a fresh launch by something else) — that path polls _log_tail while the daemon subprocess is still looping, so the daemon-alive branch is reached correctly. It's specifically the "daemon dies immediately because zero Chrome processes exist" case that breaks the auto-launch rescue.
Suggested fix
Either:
- Have the
daemon.pyconnect-wait loop not immediately exit on the very first failed liveness check when Chrome is fully absent — give the orchestrator's own launch-and-retry a chance to run first, or - Have
admin.py'spending_diedbranch also check_chrome_not_running(msg)and call_launch_browser()before falling through to a barecontinue, matching what the still-alive branch already does.
Also observed (may be unrelated, noting for completeness)
browser-harness --doctor's "chrome running" check (_chrome_running() in admin.py) does a naive case-insensitive substring match against ps -A -o comm= output for names like "chrome". This produces false positives against unrelated processes that merely contain "chrome" in their path, e.g. Electron apps' own chrome_crashpad_handler helper (observed here from an unrelated app, not Google Chrome itself). Doctor reported chrome running: ok while the real Google Chrome.app process count was zero. Worth a more precise check (e.g. matching on the actual browser binary path/bundle id) if this hasn't already been fixed elsewhere.
AI-assisted paid-fix proposal — $75 fixed price.
I can implement the pending_died recovery path so a chrome-not-running daemon exit launches Chrome before retrying, while preserving the existing permission-blocked behavior. I would include a regression test that simulates the daemon exiting with that log message and verifies _launch_browser() is called exactly once before the retry.
Payment can be funded through Algora, Opire, or another maintainer-approved tracked method. I will not treat this as authorized work or payment until a maintainer confirms the scope and funding. Any submitted code will be clearly disclosed as AI-assisted. If this is useful, reply here and I can start immediately.
I'd like to take this one — starting work now.
I've confirmed the analysis against current main: with zero browser processes the daemon's first liveness check raises and the subprocess exits immediately, so _wait_for_daemon takes the pending_died branch and falls through to the bare continue. The chrome-not-running rescue that calls _launch_browser() is only reachable while the daemon subprocess is still alive — exactly the regression window described.
Planned fix (option 2 from the report, smallest diff): in the pending_died branch of admin.py, check _chrome_not_running(msg) before the permission_wait handling and mirror the existing launch-and-retry (restart_daemon() + _launch_browser() + continue), leaving permission-blocked behavior untouched.
Test plan: add a regression test in tests/unit/test_admin.py that simulates a daemon exiting immediately with a chrome-not-running log tail and asserts _launch_browser() is called exactly once before the retry.
Work is AI-assisted (disclosed per house norms). PR up shortly — happy to switch to the daemon-side fix (option 1) if maintainers prefer that shape.
Confirming this on Windows 11 too (browser-harness 0.1.13 from PyPI, Python 3.12.10, Chrome stable, code piped via a Git Bash heredoc).
With Chrome fully closed, the first call fails with
browser-harness: daemon default didn't come up -- check ...\bu-default.log
and the log holds only
fatal: chrome-not-running: no supported Chromium-family browser is running -- start Chrome, then retry
--doctor shows [FAIL] chrome running. The "Chrome isn't running — launching it" line never appears and no Chrome process is started. Starting Chrome by hand and re-running works.
Same control flow as described above: the daemon raises chrome-not-running on its first liveness check and exits, _wait_for_daemon takes the pending_died branch and hits the bare continue, so the _chrome_not_running(msg) rescue branch is never reached. So this is not macOS-specific; the Windows launch path is simply never called. Looking forward to one of the open fixes (#771 / #787 / #912) landing.
Confirmed — #912 covers the Windows path and now has a regression test pinning the stderr hint.
At 2026-11-08 20:01:05, "grzesioc" @.***> wrote:
grzesioc left a comment (browser-use/browser-harness#786)
Confirming this on Windows 11 too (browser-harness 0.1.13 from PyPI, Python 3.12.10, Chrome stable, code piped via a Git Bash heredoc).
With Chrome fully closed, the first call fails with
browser-harness: daemon default didn't come up -- check ...\bu-default.log
and the log holds only
fatal: chrome-not-running: no supported Chromium-family browser is running -- start Chrome, then retry
--doctor shows [FAIL] chrome running. The "Chrome isn't running — launching it" line never appears and no Chrome process is started. Starting Chrome by hand and re-running works.
Same control flow as described above: the daemon raises chrome-not-running on its first liveness check and exits, _wait_for_daemon takes the pending_died branch and hits the bare continue, so the _chrome_not_running(msg) rescue branch is never reached. So this is not macOS-specific; the Windows launch path is simply never called. Looking forward to one of the open fixes (#771 / #787 / #912) landing.
— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today! You are receiving this because you commented.Message ID: @.***>