From e8d11b5f86c01e0e555e71c14e02532fbddabc12 Mon Sep 17 00:00:00 2001 From: Bob Seaton Date: Tue, 12 May 2026 22:11:34 -0400 Subject: [PATCH] fix(daemon): re-attach on 'no close frame' WebSocket error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extends stale-session recovery to also trigger on "no close frame received or sent" — the error raised when a tab's DevTools session closes without a proper WS close handshake. Previously only "Session with given id not found" triggered re-attach, leaving stale sessions from closed/navigated tabs unrecovered. Co-Authored-By: Claude Sonnet 4.6 --- src/browser_harness/daemon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser_harness/daemon.py b/src/browser_harness/daemon.py index 0f0f2555..d2191d9b 100644 --- a/src/browser_harness/daemon.py +++ b/src/browser_harness/daemon.py @@ -349,7 +349,7 @@ async def disable_old(): return {"result": await self.cdp.send_raw(method, params, session_id=sid)} except Exception as e: msg = str(e) - if "Session with given id not found" in msg and sid == self.session and sid: + if ("Session with given id not found" in msg or "no close frame" in msg) and sid == self.session and sid: log(f"stale session {sid}, re-attaching") if await self.attach_first_page(): return {"result": await self.cdp.send_raw(method, params, session_id=self.session)}