Skip to content

Commit 5bb26bf

Browse files
stubbivincentkoc
andauthored
fix(browser): skip port ownership check for remote CDP profiles (openclaw#28780)
* fix(browser): skip port ownership check for remote CDP profiles When a browser profile has a non-loopback cdpUrl (e.g. Browserless, Kubernetes sidecar, or any external CDP service), the port-ownership check incorrectly fires because we don't "own" the remote process. This causes "Port is in use but not by openclaw" even though the remote CDP service is working and reachable. Guard the ownership error with !remoteCdp so remote profiles fall through to the WebSocket retry/attach logic instead. Fixes openclaw#15582 * fix: add TypeScript null guard for profileState.running * chore(changelog): note remote CDP ownership fix credits Refs openclaw#15582 * Update CHANGELOG.md --------- Co-authored-by: Vincent Koc <[email protected]>
1 parent cda119b commit 5bb26bf

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Docs: https://docs.openclaw.ai
3838

3939
### Fixes
4040

41+
- Browser/Remote CDP ownership checks: skip local-process ownership errors for non-loopback remote CDP profiles when HTTP is reachable but the websocket handshake fails, and surface the remote websocket attach/retry path instead. (#15582) Landed from contributor (#28780) Thanks @stubbi, @bsormagec, @unblockedgamesstudio and @vincentkoc.
4142
- Docker/Image health checks: add Dockerfile `HEALTHCHECK` that probes gateway `GET /healthz` so container runtimes can mark unhealthy instances without requiring auth credentials in the probe command. (#11478) Thanks @U-C4N and @vincentkoc.
4243
- Daemon/systemd checks in containers: treat missing `systemctl` invocations (including `spawn systemctl ENOENT`/`EACCES`) as unavailable service state during `is-enabled` checks, preventing container flows from failing with `Gateway service check failed` before install/status handling can continue. (#26089) Thanks @sahilsatralkar and @vincentkoc.
4344
- Android/Nodes reliability: reject `facing=both` when `deviceId` is set to avoid mislabeled duplicate captures, allow notification `open`/`reply` on non-clearable entries while still gating dismiss, trigger listener rebind before notification actions, and scale invoke-result ack timeout to invoke budget for large clip payloads. (#28260) Thanks @obviyus.

src/browser/server-context.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,9 @@ function createProfileContext(
333333
return;
334334
}
335335

336-
// HTTP responds but WebSocket fails - port in use by something else
337-
if (!profileState.running) {
336+
// HTTP responds but WebSocket fails - port in use by something else.
337+
// Skip this check for remote CDP profiles since we never own the remote process.
338+
if (!profileState.running && !remoteCdp) {
338339
throw new Error(
339340
`Port ${profile.cdpPort} is in use for profile "${profile.name}" but not by openclaw. ` +
340341
`Run action=reset-profile profile=${profile.name} to kill the process.`,
@@ -356,6 +357,14 @@ function createProfileContext(
356357
);
357358
}
358359

360+
// At this point profileState.running is always non-null: the !remoteCdp guard
361+
// above throws when running is null, and the remoteCdp path always exits via
362+
// the attachOnly/remoteCdp block. Add an explicit guard for TypeScript.
363+
if (!profileState.running) {
364+
throw new Error(
365+
`Unexpected state for profile "${profile.name}": no running process to restart.`,
366+
);
367+
}
359368
await stopOpenClawChrome(profileState.running);
360369
setProfileRunning(null);
361370

0 commit comments

Comments
 (0)