From 7ac3d7b4a0e24b07914d856a0799601aca160e2f Mon Sep 17 00:00:00 2001 From: cfdaily Date: Mon, 18 May 2026 23:25:41 +0800 Subject: [PATCH] auto-sync: 2026-05-18 23:25:41 --- src/blackboard/queries.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/blackboard/queries.py b/src/blackboard/queries.py index 20c9fcc..5d42e17 100644 --- a/src/blackboard/queries.py +++ b/src/blackboard/queries.py @@ -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"