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
This commit is contained in:
+1
-1
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user