From 5c85f24d4be06e2f1f6d46dd168e0336394e4901 Mon Sep 17 00:00:00 2001 From: ShawnPana Date: Tue, 10 Mar 2026 20:39:21 -0700 Subject: [PATCH] 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. --- src/browser/server-context.availability.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/browser/server-context.availability.ts b/src/browser/server-context.availability.ts index b8d617867ea..5fd3d28d28d 100644 --- a/src/browser/server-context.availability.ts +++ b/src/browser/server-context.availability.ts @@ -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)) {