#10390: fix(chrome-relay): sticky attach + auto-restore after disconnects
stale
Cluster:
Chrome Extension Enhancements
## Summary
Fixes OpenClaw Browser Relay Chrome extension losing the attached tab after navigations / service worker restarts / temporary relay disconnects.
## Changes
- Persist user intent for attached tabs (sticky attach) and auto-restore after reconnect.
- Keep debugger attachments on relay disconnect; retry reconnect via `chrome.alarms`.
- Document the behavior in the extension README.
- Add missing `alarms` permission to `manifest.json`.
## Why
This addresses frequent `tab not found` / dropped attachment issues when automating GitHub/Binance tabs through the Browser Relay.
## Testing
- Manual: attach to an existing tab, navigate within the tab, and observe attachment persists.
- Manual: stop/start relay (or restart service worker) and observe auto-restore.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
- Adds “sticky attach” to the Chrome relay extension by persisting attached tab IDs and attempting to restore them after MV3 service worker restarts or relay disconnects.
- Changes relay disconnect handling to keep debugger attachments and mark tabs as reconnecting, plus adds periodic retry via `chrome.alarms`.
- Updates extension docs to describe auto-restore behavior and updates the manifest to request the `alarms` permission.
<h3>Confidence Score: 3/5</h3>
- This PR is likely safe but has behavioral edge cases around reconnect/restore ordering that should be fixed before merge.
- Core changes are localized to the extension, but reconnect resync currently only handles in-memory attachments; after a service worker restart, the relay may reconnect without informing the gateway about stored intended attachments until later retry/restore runs. Also the session counter is advanced twice per attach, which can alter expectations in downstream mapping logic.
- assets/chrome-extension/background.js
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#15817: fix(chrome-relay): auto-reconnect, MV3 persistence, and keepalive
by derrickburns · 2026-02-13
89.0%
#17588: fix(relay): survive WS disconnects and MV3 worker restarts
by Unayung · 2026-02-15
85.2%
#19766: fix: Chrome relay extension auto-reattach after SPA navigation
by nishantkabra77 · 2026-02-18
84.0%
#16743: fix: auto-reattach browser relay debugger after navigation
by jg-noncelogic · 2026-02-15
82.4%
#13942: Fix: chrome-extension: make relay reconnect reliable with one tab
by gabepsilva · 2026-02-11
79.2%
#21314: feat: enhance browser relay with custom naming and diagnostic tools
by kelvinCB · 2026-02-19
76.2%
#20688: fix(browser): allow extension reconnect when stale websocket linger...
by HOYALIM · 2026-02-19
75.9%
#22571: fix(browser): complete extension relay handshake on connect.challenge
by pandego · 2026-02-21
75.7%
#23363: Browser: fallback to managed profile and improve runtime diagnostics
by isdoho · 2026-02-22
75.5%
#22385: fix: improve delivery recovery logging with entry age and deferral ...
by derrickburns · 2026-02-21
73.6%