From e8bbaccfd03f299c160b62a3885e1edbfc9c8ef4 Mon Sep 17 00:00:00 2001 From: JOJO <1498581755@qq.com> Date: Mon, 20 Jul 2026 03:37:58 +0800 Subject: [PATCH] =?UTF-8?q?fix(tasks):=20REST=E5=AF=B9=E8=B4=A6=E5=89=94?= =?UTF-8?q?=E9=99=A4idle=E5=A4=9A=E6=99=BA=E8=83=BD=E4=BD=93=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E2=80=94=E2=80=94=E5=AF=B9=E9=BD=90socket=E8=AF=AD?= =?UTF-8?q?=E4=B9=89=EF=BC=8C=E4=BF=AE=E5=A4=8D=E5=B9=BD=E7=81=B5=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E6=80=81=E4=B8=8E=E5=9B=9E=E6=94=B6=E5=99=A8=E8=AF=AF?= =?UTF-8?q?=E9=98=BB=E5=A1=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/tasks/models.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/tasks/models.py b/server/tasks/models.py index 5fd50010..8edfd6d9 100644 --- a/server/tasks/models.py +++ b/server/tasks/models.py @@ -656,6 +656,13 @@ class TaskManager: if status in terminal_statuses: continue if task_info.get('multi_agent_mode'): + # idle = 本轮输出结束、保留上下文等待指令,不算运行中。 + # 对齐 socket task_complete 语义(chat_flow_task_main.py: + # 仅 running 实例 + pending master 消息算活跃),否则 + # REST 对账会把已空闲的多智能体对话误判为运行中(前端 + # 幽灵轮询),且回收器永远不敢回收该对话的 terminal。 + if status == "idle": + continue result["has_running_multi_agent"] = True else: result["has_running_sub_agents"] = True