auto-sync: 2026-06-03 00:51:23

This commit is contained in:
cfdaily
2026-06-03 00:51:23 +08:00
parent e17c33ffc9
commit a3546833f9
+7 -4
View File
@@ -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