From eb4ff07b294c5a964f594578326b23fcd7a4b3e8 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Thu, 5 Nov 2026 14:05:29 +0900 Subject: [PATCH] refac --- backend/open_webui/routers/terminals.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/routers/terminals.py b/backend/open_webui/routers/terminals.py index 52e72f6adf..e3be8cee0a 100644 --- a/backend/open_webui/routers/terminals.py +++ b/backend/open_webui/routers/terminals.py @@ -694,7 +694,8 @@ async def _proxy_terminal_websocket( elif 'text' in msg and msg['text']: await upstream.send_str(msg['text']) except Exception: - pass + with suppress(Exception): + await ws.close(code=1011, reason='Terminal connection interrupted. Reconnecting.') async def _upstream_to_client(): """Forward upstream → client.""" @@ -724,6 +725,8 @@ async def _proxy_terminal_websocket( return except Exception: log.exception('Terminal access recheck failed') + with suppress(Exception): + await ws.close(code=1011, reason='Terminal access check unavailable. Reconnecting.') # End the proxy as soon as any task finishes (e.g. a # graceful upstream CLOSE) and cancel the rest, which would