From 127ac390632a612154090b4f881bda217900ba29 Mon Sep 17 00:00:00 2001 From: chengyongru Date: Fri, 13 Mar 2026 10:23:15 +0800 Subject: [PATCH] fix: catch BaseException in MCP connection to handle CancelledError --- nanobot/agent/loop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nanobot/agent/loop.py b/nanobot/agent/loop.py index 5fe0ee0..dc76441 100644 --- a/nanobot/agent/loop.py +++ b/nanobot/agent/loop.py @@ -139,7 +139,7 @@ class AgentLoop: await self._mcp_stack.__aenter__() await connect_mcp_servers(self._mcp_servers, self.tools, self._mcp_stack) self._mcp_connected = True - except Exception as e: + except BaseException as e: logger.error("Failed to connect MCP servers (will retry next message): {}", e) if self._mcp_stack: try: