From 9f5afc7636246320dc3e8fd4f9d5aef50fbadcfb Mon Sep 17 00:00:00 2001 From: annguyenNous Date: Fri, 29 May 2026 14:33:33 +0700 Subject: [PATCH] fix(mcp): widen isinstance check to BaseException for CancelledError asyncio.gather(return_exceptions=True) captures CancelledError as a BaseException value. The previous isinstance(result, Exception) check missed CancelledError, silently dropping it without logging. Since Python 3.9, CancelledError is a BaseException subclass (not Exception). This one-line change ensures all failure types from MCP server connections are properly logged. Fixes NousResearch/hermes-agent#34443 --- tools/mcp_tool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mcp_tool.py b/tools/mcp_tool.py index 5a3c7ab63af..593994caa09 100644 --- a/tools/mcp_tool.py +++ b/tools/mcp_tool.py @@ -3366,7 +3366,7 @@ def register_mcp_servers(servers: Dict[str, dict]) -> List[str]: return_exceptions=True, ) for name, result in zip(server_names, results): - if isinstance(result, Exception): + if isinstance(result, BaseException): command = new_servers.get(name, {}).get("command") logger.warning( "Failed to connect to MCP server '%s'%s: %s",