auto-sync: 2026-05-18 23:25:41

This commit is contained in:
cfdaily
2026-05-18 23:25:41 +08:00
parent 41a78a8798
commit 7ac3d7b4a0
+13 -5
View File
@@ -218,8 +218,8 @@ class Queries:
def compute_parent_status(self, parent_task_id: str) -> Optional[str]:
"""从子 Task 聚合推导父 Task 状态
优先级:review > working > pending > blocked > failed
手动状态(cancelled)不参与聚合
v2.8 优先级:escalated > waiting_human > review > working > pending > failed > blocked
手动状态(cancelled, paused)不参与聚合
"""
conn = self._conn()
try:
@@ -232,10 +232,10 @@ class Queries:
if parent_row["status"] in MANUAL_STATUSES:
return parent_row["status"]
# 聚合子 Task 状态(排除 cancelled
# 聚合子 Task 状态(排除 cancelled + paused
rows = conn.execute(
"SELECT status, COUNT(*) as cnt FROM tasks "
"WHERE parent_task=? AND status != 'cancelled' "
"WHERE parent_task=? AND status NOT IN ('cancelled', 'paused') "
"GROUP BY status",
(parent_task_id,),
).fetchall()
@@ -252,6 +252,14 @@ class Queries:
if done_count == total:
return "done"
# 有 escalated → escalated
if status_counts.get("escalated", 0) > 0:
return "escalated"
# 有 waiting_human → waiting_human
if status_counts.get("waiting_human", 0) > 0:
return "waiting_human"
# 有 review → review
if status_counts.get("review", 0) > 0:
return "review"
@@ -264,7 +272,7 @@ class Queries:
if status_counts.get("pending", 0) > 0:
return "pending"
# 有 failed → failed(优先于 blocked:失败比等待更严重)
# 有 failed → failed
if status_counts.get("failed", 0) > 0:
return "failed"