From a3546833f930beb35bc8eccf9ca145178bc517e8 Mon Sep 17 00:00:00 2001 From: cfdaily Date: Wed, 3 Jun 2026 00:51:23 +0800 Subject: [PATCH] auto-sync: 2026-06-03 00:51:23 --- src/daemon/ticker.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/daemon/ticker.py b/src/daemon/ticker.py index 0140af5..83fc5ee 100644 --- a/src/daemon/ticker.py +++ b/src/daemon/ticker.py @@ -1644,18 +1644,21 @@ Parent Task ID: {parent_task.id} def _find_pre_reviewing_status(self, conn, task_id: str) -> str: """查 events 表找到 reviewing 之前的状态(done 或 failed)""" + # _transition_status 写入 event_type=f"task_{new_status}",detail 用 from/to rows = conn.execute( """SELECT detail FROM events - WHERE task_id=? AND event_type='task_status_changed' - ORDER BY id DESC LIMIT 10""", + WHERE task_id=? AND event_type='task_reviewing' + ORDER BY id DESC LIMIT 1""", (task_id,) ).fetchall() for event in rows: try: detail = json.loads(event["detail"]) - if detail.get("new_status") == "reviewing": - return detail.get("old_status", "done") # 兜底 done + # _transition_status detail 格式: {"from": old_status, "to": new_status, ...} + prev = detail.get("from") or detail.get("old_status") + if prev in ("done", "failed"): + return prev except (json.JSONDecodeError, KeyError): continue