fix(connect): honor timeoutMs on profileDir poll; re-rank Way 2 docs (Chrome 147 DevToolsActivePort regression)#48
Merged
Alezander9 merged 1 commit intomainfrom May 9, 2026
Conversation
…fy Way 2 docs
Mac (Chrome 147.0.7727.138) and Windows (Chrome 147.0.7727.139) testers
both report that Chrome 147 does not write `DevToolsActivePort` when
launched with a custom `--user-data-dir`, so `session.connect({ profileDir })`
fails for Way 2 on modern Chrome. Way 1 (user's existing profile) is
unaffected — that path's user-data-dir is the platform default and the
file is written there as expected.
- session.ts: `readDevToolsActivePort` now honors caller's `timeoutMs`
instead of a hardcoded 30s deadline (was the visible bug — caller
passed 5s, error said 30s). Error message reports the path polled,
the actual elapsed time, and the timeout asked for, plus a hint to
fall back to /json/version.
- BROWSER.md Way 2: lead with `/json/version` -> `wsUrl` (the path that
actually works on Chrome 147+); demote `{ profileDir }` to an alternate
for older Chrome / chrome://inspect Way 1. Replace `/tmp/bcode-chrome`
example with `./.bcode/way2-chrome` (any writable path is fine, this
one's safe in sandboxed agent envs). Add troubleshooting bullets:
the 'DevTools listening on …' log line prints before the bind succeeds
and is not a readiness signal; on Windows, launching while another
Chrome is running silently no-ops the debug flags.
- BROWSER.md Way 3 / cloud-browser.md: note the resolved URL is wss://,
the provision endpoint returns 201, and surface the extra response
fields (timeoutAt for lifecycle awareness, recordingUrl for playback).
Source: Mac + Windows tester reports, thread C0ADZBZHW2V
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
Two independent fact-check reports (macOS Chrome 147.0.7727.138, Windows Chrome 147.0.7727.139) revealed the same Chrome 147 behavior change:
DevToolsActivePortis not written when Chrome is launched with a custom--user-data-dir. Our docs led withsession.connect({ profileDir })for Way 2, which now ENOENTs on every Chrome 147+. The/json/version->wsUrlroute still works on every Chrome version that supports remote debugging.This PR re-ranks the Way 2 docs to lead with what works, fixes the visible
timeoutMsbug the testers spotted, and absorbs the smaller doc nits.Changes
session.ts— real bug fix:readDevToolsActivePortnow honors the caller'stimeoutMsinstead of a hardcoded 30 s deadline. The Mac tester passedtimeoutMs: 5000, the error said "after 30s" — that mismatch is gone./json/version. Per the Mac tester's ask: future agents debugging this can catch the bug from the message alone.skills/BROWSER.md:fetch("http://127.0.0.1:9222/json/version") -> webSocketDebuggerUrl -> session.connect({ wsUrl }).{ profileDir }is demoted to "older Chrome / chrome://inspect Way 1 path" with an explicit note that Chrome 147+ doesn't write the file under custom--user-data-dir./tmp/bcode-chromeexample with./.bcode/way2-chromeand noted any writable path works.{ profileDir }ENOENT on Chrome 147+.skills/cloud-browser.md/ Way 3 example inBROWSER.md:wss://, the provision endpoint returns 201, and surfaced the extra response fields — particularlytimeoutAt(lifecycle) andrecordingUrl(playback).What we're NOT changing
Way 1 (user's existing profile via
chrome://inspect) is unaffected on every reported platform. TheDevToolsActivePortreads on Way 1 work fine because the user-data-dir is Chrome's platform default — Chrome only suppresses the file on custom dirs.Verification
@browser-use/bcode-browser, full root filtered).connect-env.test.ts,skills.test.tspass.readDevToolsActivePort-> takestimeoutMs;resolveWsUrl-> takestimeoutMs). PublicSession.connect()signature unchanged.Sources
C0ADZBZHW2V. Both confirm the Chrome 147DevToolsActivePortregression and the listed doc nits.