From 7dbe5ffc673ce3b6d4397d202a8569bb6cd80809 Mon Sep 17 00:00:00 2001 From: puzhen <1303385763@qq.com> Date: Sat, 21 Feb 2026 21:15:14 +0000 Subject: [PATCH] inital_fix --- backend/app/utils/workforce.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/backend/app/utils/workforce.py b/backend/app/utils/workforce.py index 39be31e7..21660b08 100644 --- a/backend/app/utils/workforce.py +++ b/backend/app/utils/workforce.py @@ -936,8 +936,8 @@ class Workforce(BaseWorkforce): if hasattr(self, "_children") and self._children: for child in self._children: # Cleanup base worker agent - if hasattr(child, "worker_agent"): - agent = child.worker_agent + if hasattr(child, "worker"): + agent = child.worker cb = getattr(agent, "_cdp_release_callback", None) if callable(cb): try: @@ -969,10 +969,14 @@ class Workforce(BaseWorkforce): from app.agent.factory.browser import _cdp_pool_manager task_ids: set[str] = set() + # Use workforce's own api_task_id as the primary source + if self.api_task_id: + task_ids.add(self.api_task_id) + # Also collect from child agents if hasattr(self, "_children") and self._children: for child in self._children: - if hasattr(child, "worker_agent"): - tid = getattr(child.worker_agent, "_cdp_task_id", None) + if hasattr(child, "worker"): + tid = getattr(child.worker, "_cdp_task_id", None) if tid is not None: task_ids.add(tid) if hasattr(child, "agent_pool") and child.agent_pool: