fix(kanban): treat archived parent tasks as terminal for dependency resolution

When a parent task is archived, dependent child tasks were stuck in
todo forever because recompute_ready and claim_task only checked for
status == 'done'. Now both functions also treat 'archived' as a
terminal status, allowing children to proceed when their parent is
archived.

Fixes #23180.
This commit is contained in:
Ninso112 2026-05-10 19:11:00 +02:00 committed by kshitij
parent 27cfe72543
commit a1854ac07c

View file

@ -1826,7 +1826,7 @@ def _synthesize_ended_run(
# ---------------------------------------------------------------------------
def recompute_ready(conn: sqlite3.Connection) -> int:
"""Promote ``todo`` tasks to ``ready`` when all parents are ``done``.
"""Promote ``todo`` tasks to ``ready`` when all parents are ``done`` or ``archived``.
Returns the number of tasks promoted. Safe to call inside or outside
an existing transaction; it opens its own IMMEDIATE txn.
@ -1844,7 +1844,7 @@ def recompute_ready(conn: sqlite3.Connection) -> int:
"WHERE l.child_id = ?",
(task_id,),
).fetchall()
if all(p["status"] == "done" for p in parents):
if all(p["status"] in ("done", "archived") for p in parents):
conn.execute(
"UPDATE tasks SET status = 'ready' WHERE id = ? AND status = 'todo'",
(task_id,),
@ -1885,7 +1885,7 @@ def claim_task(
undone = conn.execute(
"SELECT 1 FROM task_links l "
"JOIN tasks p ON p.id = l.parent_id "
"WHERE l.child_id = ? AND p.status != 'done' LIMIT 1",
"WHERE l.child_id = ? AND p.status NOT IN ('done', 'archived') LIMIT 1",
(task_id,),
).fetchone()
if undone: