diff --git a/backend/services/tasks.py b/backend/services/tasks.py index f07e8bd..6d967e7 100644 --- a/backend/services/tasks.py +++ b/backend/services/tasks.py @@ -180,7 +180,9 @@ def _rollup_parent_status(cur, *, tenant_id: str, parent_task_id: str) -> None: """, (tenant_id, parent_task_id), ) - child_statuses = [row[0] for row in cur.fetchall()] + child_statuses = [ + row["status"] if isinstance(row, dict) else row[0] for row in cur.fetchall() + ] if not child_statuses: return if any(status not in TERMINAL_TASK_STATUSES for status in child_statuses): @@ -196,8 +198,11 @@ def _rollup_parent_status(cur, *, tenant_id: str, parent_task_id: str) -> None: (parent_task_id, tenant_id), ) row = cur.fetchone() - if row and row[0]: - _rollup_parent_status(cur, tenant_id=tenant_id, parent_task_id=str(row[0])) + if not row: + return + next_parent = row["parent_task_id"] if isinstance(row, dict) else row[0] + if next_parent: + _rollup_parent_status(cur, tenant_id=tenant_id, parent_task_id=str(next_parent)) def create_task(