auto-sync: 2026-05-26 08:25:40
This commit is contained in:
@@ -610,22 +610,21 @@ class Ticker:
|
||||
|
||||
spawned = []
|
||||
for agent_id in idle_agents:
|
||||
if not await self.counter.can_acquire(agent_id):
|
||||
continue
|
||||
# v2.7.2: counter 检查在 spawn_full_agent 内部
|
||||
prompt = self._build_claim_prompt(agent_id, broadcastable, project_id)
|
||||
try:
|
||||
await self.counter.acquire(agent_id)
|
||||
session_id = await self.spawner.spawn_full_agent(
|
||||
agent_id=agent_id,
|
||||
message=prompt,
|
||||
on_complete=lambda aid, _: self.counter.release(aid),
|
||||
# v2.7.2: on_complete 不含 counter.release,由 wrapped_on_complete 保证
|
||||
task_id=broadcastable[0].id if broadcastable else None,
|
||||
task_db_path=db_path,
|
||||
)
|
||||
spawned.append(agent_id)
|
||||
logger.info("Broadcast spawned %s (session=%s)", agent_id, session_id)
|
||||
except AgentBusyError:
|
||||
logger.debug("Broadcast skip %s: busy", agent_id)
|
||||
except Exception:
|
||||
self.counter.release(agent_id)
|
||||
logger.exception("Broadcast spawn failed for %s", agent_id)
|
||||
|
||||
return task_ids if spawned else []
|
||||
|
||||
Reference in New Issue
Block a user