browser: allow wss:// profiles to connect lazily in ensureBrowserAvailable

Cloud WebSocket endpoints like Browser Use provision sessions on demand.
Skip the up-front reachability gate so the first tab operation triggers
the Playwright connectOverCDP call instead of erroring with unreachable.
This commit is contained in:
ShawnPana 2026-03-10 20:39:21 -07:00
parent db2993ca92
commit 5c85f24d4b

View File

@ -180,6 +180,12 @@ export function createProfileAvailability({
}
if (!httpReachable) {
// Direct WebSocket endpoints (e.g. Browser Use) are on-demand — no need to probe
// reachability up front. The Playwright connection is established lazily in
// connectBrowser when a tab operation actually needs it.
if (isWebSocketUrl(profile.cdpUrl)) {
return;
}
if ((attachOnly || remoteCdp) && opts.onEnsureAttachTarget) {
await opts.onEnsureAttachTarget(profile);
if (await isHttpReachable(PROFILE_ATTACH_RETRY_TIMEOUT_MS)) {