From 04770e0af95bb1c6d783b88340df159358e1f1a0 Mon Sep 17 00:00:00 2001 From: JOJO <1498581755@qq.com> Date: Sat, 29 Aug 2026 23:11:45 +0800 Subject: [PATCH] =?UTF-8?q?fix(sub=5Fagent):=20finish=5Ftask=20=E8=A1=A5?= =?UTF-8?q?=E7=BB=88=E6=80=81=E8=BF=9B=E5=BA=A6=E4=BA=8B=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B4=BB=E5=8A=A8=E7=AA=97=E5=8F=A3=E6=B0=B8?= =?UTF-8?q?=E4=B9=85=E8=BD=AC=E5=9C=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit finish_task 在模型流式阶段会 emit「calling」进度事件,但执行分支直接收尾不补终态,导致前端活动窗口该条目永远停留在调用中。现在补 emit status=completed。 Co-authored-by: Astrion powered by DeepSeek-V4-Flash --- modules/sub_agent/task.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/sub_agent/task.py b/modules/sub_agent/task.py index 4f5fcfba..67c2549c 100644 --- a/modules/sub_agent/task.py +++ b/modules/sub_agent/task.py @@ -413,6 +413,12 @@ class SubAgentTask: if self.current_context_tokens > 0 and self.current_context_tokens >= self.compress_threshold_tokens: compressed = self._deep_compress_messages() if compressed: + # 写入进度文件:前端活动窗口在压缩发生的位置显示压缩提示 + self.emit("progress", { + "subtype": "compression", + "round": self._compress_round, + "ts": int(time.time() * 1000), + }) ma_debug( "sub_agent_deep_compressed", task_id=self.task_id, @@ -477,6 +483,9 @@ class SubAgentTask: progress_id = tool_call.get("id") or f"tool_{int(time.time() * 1000)}_{uuid.uuid4().hex[:6]}" if name == "finish_task": + # finish_task 在模型流式阶段已 emit「calling」进度事件(_call_model), + # 此处必须补终态,否则前端活动窗口该条目永远停留在「调用中」转圈 + self.emit("progress", {"id": progress_id, "tool": name, "status": "completed", "args": args, "ts": int(time.time() * 1000)}) await self._write_finish(args, elapsed) return