fix(browser): avoid extension profile startup deadlock in browser start

browser start for driver=extension required websocket tab attachment during
ensureBrowserAvailable, which can deadlock startup because tabs can only
attach after relay startup succeeds.

For extension profiles, only require relay HTTP reachability in startup and
leave tab attachment checks to ensureTabAvailable when a concrete tab action
is requested.

Closes #28701
This commit is contained in:
SidQin-cyber
2026-02-27 23:19:18 +08:00
committed by Peter Steinberger
parent 5b8f492a48
commit 821b7c80a6

View File

@@ -291,22 +291,15 @@ function createProfileContext(
if (isExtension) {
if (!httpReachable) {
await ensureChromeExtensionRelayServer({ cdpUrl: profile.cdpUrl });
if (await isHttpReachable(1200)) {
// continue: we still need the extension to connect for CDP websocket.
} else {
if (!(await isHttpReachable(1200))) {
throw new Error(
`Chrome extension relay for profile "${profile.name}" is not reachable at ${profile.cdpUrl}.`,
);
}
}
if (await isReachable(600)) {
return;
}
// Relay server is up, but no attached tab yet. Prompt user to attach.
throw new Error(
`Chrome extension relay is running, but no tab is connected. Click the OpenClaw Chrome extension icon on a tab to attach it (profile "${profile.name}").`,
);
// Browser startup should only ensure relay availability.
// Tab attachment is checked when a tab is actually required.
return;
}
if (!httpReachable) {