Merge PR #1953: fix: catch BaseException in MCP connection to handle CancelledError

fix: catch BaseException in MCP connection to handle CancelledError
This commit is contained in:
Xubin Ren
2026-03-13 10:57:11 +08:00
committed by GitHub

View File

@@ -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: