Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix: catch asyncio.CancelledError in close_mcp shutdown
Brian Noah86f6558707aa
diff --git a/nanobot/agent/tools/mcp.py b/nanobot/agent/tools/mcp.pyindex 7919b9adf..2d17be593 100644--- a/nanobot/agent/tools/mcp.py+++ b/nanobot/agent/tools/mcp.py@@ -1410,6 +1410,10 @@ async def _close_server(state: Any, server_name: str) -> None:returntry:await stack.aclose()+ except asyncio.CancelledError:+ if asyncio.current_task().cancelling() > 0:+ raise+ logger.debug("MCP server '{}' cleanup error (can be ignored)", server_name)except (RuntimeError, BaseExceptionGroup):logger.debug("MCP server '{}' cleanup error (can be ignored)", server_name)@@ -1423,5 +1427,9 @@ async def close_mcp_servers(state: Any) -> None:for name, connection in connections:try:await connection.aclose()+ except asyncio.CancelledError:+ if asyncio.current_task().cancelling() > 0:+ raise+ logger.debug("MCP server '{}' cleanup error (can be ignored)", name)except (RuntimeError, BaseExceptionGroup):logger.debug("MCP server '{}' cleanup error (can be ignored)", name)