From 38e99cf65cd0feb53c0dad420804d19166bc7c66 Mon Sep 17 00:00:00 2001 From: idiotsj Date: Fri, 27 Feb 2026 22:21:47 +0800 Subject: [PATCH] fix: restore task cancellation on timeout per review feedback Pending tasks in asyncio.wait are tasks that have NOT completed initialization within 20s, so cancelling them is safe and correct. --- astrbot/core/provider/func_tool_manager.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/astrbot/core/provider/func_tool_manager.py b/astrbot/core/provider/func_tool_manager.py index db92f7b42..be663f0aa 100644 --- a/astrbot/core/provider/func_tool_manager.py +++ b/astrbot/core/provider/func_tool_manager.py @@ -234,6 +234,8 @@ class FunctionToolManager: "MCP 服务初始化超时(20秒),部分服务可能未完全加载。" "建议检查 MCP 服务器配置和网络连接。" ) + for task in pending: + task.cancel() success_count = 0 failed_services: list[str] = []