From 06895d3ffd319e7da97ae36ec19ed951ee191b52 Mon Sep 17 00:00:00 2001 From: cfdaily Date: Sun, 17 May 2026 21:57:42 +0800 Subject: [PATCH] auto-sync: 2026-05-17 21:57:42 --- src/daemon/ticker.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/daemon/ticker.py b/src/daemon/ticker.py index 50c4b87..20ef4a6 100644 --- a/src/daemon/ticker.py +++ b/src/daemon/ticker.py @@ -496,12 +496,22 @@ class Ticker: try: conn = get_connection(db_path) try: - row = conn.execute( - "SELECT COUNT(*) as cnt FROM routing_decisions " - "WHERE task_id=? AND outcome='dispatched' " - "AND created_at > datetime('now', '-5 minutes')", - (task_id,), - ).fetchone() + # 检查是否有 from_status=review 的 dispatched 记录(防止重复 review dispatch) + if action_type == "review": + row = conn.execute( + "SELECT COUNT(*) as cnt FROM routing_decisions " + "WHERE task_id=? AND outcome='dispatched' " + "AND from_status='review' " + "AND created_at > datetime('now', '-5 minutes')", + (task_id,), + ).fetchone() + else: + row = conn.execute( + "SELECT COUNT(*) as cnt FROM routing_decisions " + "WHERE task_id=? AND outcome='dispatched' " + "AND created_at > datetime('now', '-5 minutes')", + (task_id,), + ).fetchone() return row["cnt"] > 0 if row else False finally: conn.close()