openclaw - 💡(How to fix) Fix [Bug]: Remote CDP profiles (Browserbase) lose session between commands — multi-step workflows impossible [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#58646Fetched 2026-04-08 01:59:46
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
cross-referenced ×1subscribed ×1

When using Browserbase via a remote CDP profile, the gateway creates a new WebSocket connection for each CLI command. Since Browserbase creates a new browser session per WebSocket connection, the browser state (loaded pages, cookies, DOM) is lost between commands.

This makes multi-step workflows impossible:

openclaw browser --browser-profile browserbase navigate "https://example.com"  # ✅ Works
openclaw browser --browser-profile browserbase snapshot                        # ❌ "Remote CDP not reachable"

Root Cause

The gateway does not hold the WebSocket connection open between CLI invocations. Each command:

  1. Opens a new WebSocket to wss://connect.browserbase.com?apiKey=...
  2. Browserbase spins up a fresh browser session
  3. Executes the command
  4. WebSocket closes when command completes
  5. Browserbase destroys the session

On the next command, step 1 creates an entirely new session with a blank browser. On free tiers (1 concurrent session), it's worse: the old session hasn't been cleaned up yet, so the new connection is blocked by the concurrent session limit, causing immediate "not reachable" errors.

Code Example

openclaw browser --browser-profile browserbase navigate "https://example.com"  # ✅ Works
openclaw browser --browser-profile browserbase snapshot                        # ❌ "Remote CDP not reachable"

---

CONNECTED in 1116 ms
CDP OK in 7147 ms  (Browser.getVersion returned Chrome/146.0.7680.165)
RAW_BUFFERClick to expand / collapse

Description

When using Browserbase via a remote CDP profile, the gateway creates a new WebSocket connection for each CLI command. Since Browserbase creates a new browser session per WebSocket connection, the browser state (loaded pages, cookies, DOM) is lost between commands.

This makes multi-step workflows impossible:

openclaw browser --browser-profile browserbase navigate "https://example.com"  # ✅ Works
openclaw browser --browser-profile browserbase snapshot                        # ❌ "Remote CDP not reachable"

Root Cause

The gateway does not hold the WebSocket connection open between CLI invocations. Each command:

  1. Opens a new WebSocket to wss://connect.browserbase.com?apiKey=...
  2. Browserbase spins up a fresh browser session
  3. Executes the command
  4. WebSocket closes when command completes
  5. Browserbase destroys the session

On the next command, step 1 creates an entirely new session with a blank browser. On free tiers (1 concurrent session), it's worse: the old session hasn't been cleaned up yet, so the new connection is blocked by the concurrent session limit, causing immediate "not reachable" errors.

Evidence

Tested on OpenClaw 2026.3.28 with Browserbase (wss://connect.browserbase.com).

Raw WebSocket test confirms the provider works fine:

CONNECTED in 1116 ms
CDP OK in 7147 ms  (Browser.getVersion returned Chrome/146.0.7680.165)

Gateway behavior observed via logs:

  • navigate succeeds (new session created, page loaded)
  • snapshot 148ms later fails with "Remote CDP not reachable" (doesn't even attempt the 10s handshake timeout, just detects dead connection)
  • Browserbase API shows multiple zombie sessions accumulating from failed reconnection attempts

Additional findings:

  • remoteCdpHandshakeTimeoutMs config was needed (Browserbase cold start takes ~5-7s), but even with correct timeouts, multi-step workflows fail due to session non-persistence
  • Free tier concurrent session limit (1) causes cascading failures as zombie sessions block new connections
  • Local profiles (localhost CDP) are unaffected since Chrome stays running persistently

Expected Behavior

For remote CDP profiles, the gateway should hold the WebSocket connection open after browser start (or first command) and reuse it for subsequent commands until browser stop is called or the session times out. This matches how local profiles work (persistent Chrome process on a fixed port).

Suggested Implementation

  1. On first connect to a remote CDP URL, keep the WebSocket alive in the gateway's browser subsystem
  2. Reuse the existing connection for subsequent commands on the same profile
  3. Implement reconnection logic if the WebSocket drops (with backoff)
  4. On browser stop, cleanly close the WebSocket and release the provider session

Related

  • #4378 — Identical issue reported for Browserless.io (closed without fix during triage). The Browserless CEO offered to collaborate on a fix.
  • #15989 — "tab not found" after reconnection on remote CDP
  • #23427 — CDP connection silently dies after idle period
  • #29431 — Browser relay loses CDP connection on navigation

Environment

  • OpenClaw: 2026.3.28 (f9b1079)
  • Provider: Browserbase (free tier, 1 concurrent session)
  • OS: Linux 6.8.0-106-generic (x64)
  • Node: v22.22.1

extent analysis

TL;DR

The gateway should be modified to keep the WebSocket connection alive for remote CDP profiles, reusing it for subsequent commands until the session times out or is stopped.

Guidance

  • Implement a mechanism to keep the WebSocket connection open after the first command and reuse it for subsequent commands on the same profile.
  • Develop reconnection logic with backoff to handle dropped WebSocket connections.
  • Ensure the WebSocket is cleanly closed and the provider session is released when browser stop is called.
  • Consider collaborating with the Browserbase team to implement a fix, as they have expressed willingness to collaborate.

Example

No code snippet is provided as the issue does not contain sufficient information to create a specific example.

Notes

The free tier's concurrent session limit may still cause issues if multiple commands are executed in quick succession, even with the proposed fix. The gateway's implementation should account for this limitation.

Recommendation

Apply a workaround by modifying the gateway to keep the WebSocket connection alive and reusing it for subsequent commands, as this addresses the root cause of the issue and aligns with the expected behavior for local profiles.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: Remote CDP profiles (Browserbase) lose session between commands — multi-step workflows impossible [1 participants]