From 5c652303523a1eab9a25436fcce702758a5e2f63 Mon Sep 17 00:00:00 2001 From: cfdaily Date: Sat, 23 May 2026 00:37:46 +0800 Subject: [PATCH] auto-sync: 2026-05-23 00:37:46 --- src/blackboard/operations.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/blackboard/operations.py b/src/blackboard/operations.py index 91e76a0..4714678 100644 --- a/src/blackboard/operations.py +++ b/src/blackboard/operations.py @@ -128,16 +128,17 @@ class Blackboard: elif new_status == "paused": updates["completed_at"] = now # paused 也记录时间用于恢复 updates["resumed_from"] = old_status # 记录暂停前状态 - elif new_status == "pending" and old_status == "failed": - updates["retry_count"] = ( - conn.execute("SELECT retry_count FROM tasks WHERE id=?", - (task_id,)).fetchone()["retry_count"] + 1 - ) - # BUG-1: failed→pending 必须清空 assignee/claimed_at/current_agent - # 否则 dispatcher 会走确定性路由而非广播 + elif new_status == "pending": + # 所有 →pending 转换都清空 assignee(与 ticker._transition_status L414 对齐) updates["assignee"] = None updates["claimed_at"] = None updates["current_agent"] = None + if old_status == "failed": + # 仅 failed→pending 递增 retry_count + updates["retry_count"] = ( + conn.execute("SELECT retry_count FROM tasks WHERE id=?", + (task_id,)).fetchone()["retry_count"] + 1 + ) set_clause = ", ".join(f"{k}=?" for k in updates) conn.execute(