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(agent): handle asyncio.CancelledError in message loop
cdkey85d83ba36800b8
diff --git a/nanobot/agent/loop.py b/nanobot/agent/loop.pyindex 36ab769c6..ea801b1d3 100644--- a/nanobot/agent/loop.py+++ b/nanobot/agent/loop.py@@ -264,6 +264,12 @@ class AgentLoop:msg = await asyncio.wait_for(self.bus.consume_inbound(), timeout=1.0)except asyncio.TimeoutError:continue+ except asyncio.CancelledError:+ # anyio/MCP cancel scopes surface as CancelledError (a BaseException subclass).+ # Re-raise only if the loop itself is being shut down; otherwise keep running.+ if not self._running:+ raise+ continueexcept Exception as e:logger.warning("Error consuming inbound message: {}, continuing...", e)continue