← Back to PRs

#10390: fix(chrome-relay): sticky attach + auto-restore after disconnects

by Mokoby open 2026-02-06 13:02 View on GitHub →
stale
## 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