From 5b607171338f31d0d4985c5a320875e93508554e Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Tue, 7 Jul 2026 11:04:50 +0000 Subject: [PATCH] =?UTF-8?q?A=20run=20with=20finished=20and=20queued=20batc?= =?UTF-8?q?hes=20rolls=20up=20in=20progress,=20not=20waiting=20?= =?UTF-8?q?=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- domain/tasks/tasks.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/domain/tasks/tasks.py b/domain/tasks/tasks.py index ead253ab6..992ae8d71 100644 --- a/domain/tasks/tasks.py +++ b/domain/tasks/tasks.py @@ -70,11 +70,12 @@ class Task: def recalculate_from_subtasks(self, statuses: list[SubTaskStatus]) -> None: """Recompute Task.status from its SubTasks' statuses. - Rule (preserved from legacy _update_task_progress): - - any FAILED → FAILED - - all COMPLETE → COMPLETE - - any IN_PROGRESS → IN_PROGRESS - - otherwise → WAITING + Rule: + - any FAILED → FAILED + - all COMPLETE → COMPLETE + - any IN_PROGRESS or COMPLETE → IN_PROGRESS (finished batches plus + queued batches is a run in progress, not a waiting one — ADR-0055) + - all WAITING → WAITING Empty list is a no-op (newly-created task with no subtasks). """ @@ -87,7 +88,10 @@ class Task: elif all(s is SubTaskStatus.COMPLETE for s in statuses): self.status = TaskStatus.COMPLETE self.job_completed = now - elif SubTaskStatus.IN_PROGRESS in statuses: + elif ( + SubTaskStatus.IN_PROGRESS in statuses + or SubTaskStatus.COMPLETE in statuses + ): self.status = TaskStatus.IN_PROGRESS self.job_completed = None else: