diff --git a/src/daemon/ticker.py b/src/daemon/ticker.py index a72a365..27c6f8f 100644 --- a/src/daemon/ticker.py +++ b/src/daemon/ticker.py @@ -395,10 +395,17 @@ class Ticker: return False now = datetime.utcnow().isoformat() - conn.execute( - "UPDATE tasks SET status=?, updated_at=? WHERE id=?", - (new_status, now, task_id), - ) + # 重置到 pending 时清空 assignee(避免残留导致重复路由到同一 Agent) + if new_status == "pending": + conn.execute( + "UPDATE tasks SET status=?, assignee=NULL, updated_at=? WHERE id=?", + (new_status, now, task_id), + ) + else: + conn.execute( + "UPDATE tasks SET status=?, updated_at=? WHERE id=?", + (new_status, now, task_id), + ) event_type = f"task_{new_status}" if event_type not in EVENT_TYPES: event_type = "daemon_tick"