From 473f0329db0af75c370f3b72474cdf505713757a Mon Sep 17 00:00:00 2001 From: cfdaily Date: Tue, 26 May 2026 08:21:01 +0800 Subject: [PATCH] auto-sync: 2026-05-26 08:21:01 --- src/daemon/spawner.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/daemon/spawner.py b/src/daemon/spawner.py index 9eeb8dd..3336d48 100644 --- a/src/daemon/spawner.py +++ b/src/daemon/spawner.py @@ -153,6 +153,11 @@ MAIL_RETRY_PROMPT = """你收到一个续杯提醒。你的任务在执行过程 """ +class AgentBusyError(Exception): + """Agent 被 counter 占用,无法 spawn""" + pass + + class AgentSpawner: """Agent spawn 管理""" @@ -167,6 +172,7 @@ class AgentSpawner: gateway_timeout: float = 600.0, max_retries: int = 3, max_monitor_timeouts: int = 3, + counter: Optional[Any] = None, ): """ Args: @@ -185,6 +191,8 @@ class AgentSpawner: self.gateway_timeout = gateway_timeout self.max_retries = max_retries self.max_monitor_timeouts = max_monitor_timeouts + # v2.7.2: counter 引用(spawn_full_agent 内部 acquire/release) + self.counter = counter # session 注册表 {session_id: {...}} self._sessions: Dict[str, Dict[str, Any]] = {}