Description
Description
Browser Bridge regularly becomes disconnected after Chrome has remained open for a day or after the machine resumes from sleep.
Running browser-backed commands then fails with:
PS C:\Users\wh> opencli bilibili hot --limit 5
⏳ Waiting for Chrome/Chromium extension to connect...
Make sure Chrome or Chromium is open and the OpenCLI extension is enabled.
ok: false
error:
code: BROWSER_CONNECT
message: Browser Bridge extension not connected
The Chrome extension is installed and enabled, and Chrome is already running.
Environment
- OS: Windows
- Shell: PowerShell
- Node.js: v22.22.2
- OpenCLI: v1.8.0
- OpenCLI Chrome extension: v1.0.15
- Daemon port: 19825
## Diagnostics
`opencli daemon status` reports:
Daemon: running
Version: v1.8.0
Extension: disconnected
Port: 19825
`opencli doctor` reports:
[OK] Daemon: running on port 19825 (v1.8.0)
[MISSING] Extension: not connected
[FAIL] Connectivity: failed (Browser Bridge extension not connected)
The extension had previously connected successfully, but was no longer seen the next day.
Observed extension last-seen timestamp:
2026-05-23 11:12:32 +08:00
### Steps to Reproduce
1. Install the OpenCLI Chrome extension.
2. Start Chrome and confirm OpenCLI browser-backed commands work.
3. Leave Chrome running overnight or let the machine sleep/resume.
4. Run:
opencli bilibili hot --limit 5
5. Browser Bridge remains disconnected even though Chrome and the extension are enabled.
### Expected Behavior
The Browser Bridge extension should automatically reconnect to the daemon after Chrome resumes, after its service worker restarts, or when a new OpenCLI command starts the daemon.
## Actual behavior
The extension stays disconnected until manually toggling the extension off/on in chrome://extensions.
### OpenCLI Version
v1.8.0
### Node.js Version
20.x
### Operating System
Windows
### Logs / Screenshots
```shell
## Error Logs:
PS C:\Users\wh> opencli doctor
⏳ Starting daemon...
opencli v1.8.0 doctor (node v22.22.2)
[OK] Daemon: running on port 19825 (v1.8.0)
[MISSING] Extension: not connected
[FAIL] Connectivity: failed (Browser Bridge extension not connected)
Issues:
• Daemon is running but the Chrome/Chromium extension is not connected.
If the extension is already installed, try: opencli daemon restart
If the extension is not installed:
1. Download from https://github.com/jackwener/opencli/releases
2. Open chrome://extensions/ → Enable Developer Mode
3. Click "Load unpacked" → select the extension folder
• Browser connectivity test failed: Browser Bridge extension not connected
PS C:\Users\wh> opencli daemon restart
Daemon restarted on port 19825 (v1.8.0).
⚠ Daemon is running, but the Browser Bridge extension has not connected yet.
## Additional investigation
Keeping the daemon running for more than 40 seconds did not cause the extension to reconnect.
The installed extension background script appears to create a keepalive alarm and relies on reconnect logic, but the service worker does not recover automatically in this state.
Possible relevant area:
- Manifest V3 extension service worker lifecycle
- alarm-based keepalive/reconnect behavior
- reconnect after daemon starts while the extension worker is suspended
Description
Description
Browser Bridge regularly becomes disconnected after Chrome has remained open for a day or after the machine resumes from sleep.
Running browser-backed commands then fails with:
Daemon: running
Version: v1.8.0
Extension: disconnected
Port: 19825
[OK] Daemon: running on port 19825 (v1.8.0)
[MISSING] Extension: not connected
[FAIL] Connectivity: failed (Browser Bridge extension not connected)
2026-05-23 11:12:32 +08:00
opencli bilibili hot --limit 5