auto-sync: 2026-05-26 08:31:51

This commit is contained in:
cfdaily
2026-05-26 08:31:51 +08:00
parent 72156f1387
commit 6fe374af21
+10 -3
View File
@@ -710,11 +710,18 @@ curl -X POST http://{api_host}:{api_port}/api/projects/{project_id}/tasks/{task_
async def _do_retry(self, session_id, agent_id, task_id, on_complete,
db_path, retry_field="retry_count"):
"""续杯:release counter 后通过 spawn_full_agent 重新 spawn
"""续杯:手动 release counter 后通过 spawn_full_agent 重新 spawn
v2.7.2: on_complete 是 wrapped_on_complete(含 counter release)。
调用 spawn_full_agent 时 counter 已 release,内部会 can_acquire + acquire。
v2.7.2: 进程已退出但 wrapped_on_complete 未被调用(只有 should_retry 分支走到这里)。
需要手动 release counter,然后 spawn_full_agent 内部会 acquire。
on_complete(含 counter release)置为 None,避免 double release。
"""
# ── 关键:手动 release counter(进程退出 = agent 空闲)──
if self.counter:
self.counter.release(agent_id)
# 旧 wrapped_on_complete 含 counter.release,不再使用,防止 double release
on_complete = None
# 续杯前检查任务状态,已终态则跳过
if db_path and task_id:
try: