From 408e89d7e8b9065b1ff50d6892a11e4c6dfefde2 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Thu, 12 Nov 2026 14:00:12 +0100 Subject: [PATCH] fix: Browser tab in Chrome mode keeps reconnecting when its chat is open in two windows (#34133) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: Browser tab in Chrome mode keeps reconnecting when its chat is open in two windows With the same chat open in two windows, the terminal hands the Chrome tab to the newer window, but the older window only saw a lost connection. It reconnected and took the tab back, so both windows kept flipping to "Reconnecting…" and the "Browser opened in another viewer." message never showed. The terminal's reason for ending the tab's connection now reaches the page, as it already does for the shell. The window that lost the tab shows that message and stops, and the other window keeps the page. Fixes #34095 * fix: Browser tab in Chrome mode keeps reconnecting when its chat is open in two windows Narrows the change to passing the terminal's close reason on to the page. The relay's existing handling of a broken connection stays as it was. --- backend/open_webui/routers/terminals.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/open_webui/routers/terminals.py b/backend/open_webui/routers/terminals.py index fe65e6fb08..753a1316db 100644 --- a/backend/open_webui/routers/terminals.py +++ b/backend/open_webui/routers/terminals.py @@ -198,6 +198,8 @@ async def relay_to_browser(ws, upstream): await ws.send_bytes(msg.data) else: return + code = upstream.close_code or 1011 + await ws.close(code=1011 if code in (1005, 1006, 1015) else code) async def watch_access(server_id, sid, browser_token, request):