-
Notifications
You must be signed in to change notification settings - Fork 235
Open
Description
Problem
In extension mode, the relay server loses track of pages when the extension disconnects and reconnects. This happens frequently during normal usage (extension reload, browser restart, network hiccups).
Symptoms:
client.list()returns empty array despite Chrome tabs still existingclient.page("name")creates new tabs instead of finding existing ones- Tab accumulation: users end up with 30+ orphaned tabs they can't close via API
Root Cause
The relay stores page name→tabId mappings only in memory. When the extension reconnects:
- The WebSocket connection resets
- In-memory mappings are lost
- Chrome tabs still exist but relay doesn't know about them
Additionally, the extension doesn't initialize CDP domains (Page, Network, Runtime) after attaching the debugger, causing Playwright to miss navigation events.
Proposed Solution
- Persist page mappings to disk (
~/.dev-browser/pages.json) with{name, targetId, url, lastSeen} - Recover on reconnect by matching persisted entries to available tabs by URL
- Initialize CDP domains in extension's TabManager after debugger attach
- Preserve debugger attachments on unexpected disconnect (only detach on intentional user action)
Working Implementation
I have a working fix in my fork that addresses all these issues:
Key commits:
b7ca586- Persist page mappings across extension disconnects0b49b4a- Preserve session state across extension reconnects648f049- Enable Page domain on debugger attach
Happy to submit a PR if there's interest.
Related
This may help with #39 (extension stuck on "Connecting") by improving connection resilience.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels