From 06798e68f67d51fc34c9a6304a0c479492cc1d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zo=C3=AB?= Date: Sun, 31 May 2026 07:42:57 -0700 Subject: [PATCH] fix: claim/unclaim use view endpoint so tasks actually move buckets, log review skips at INFO --- dispatcher/dispatcher.py | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/dispatcher/dispatcher.py b/dispatcher/dispatcher.py index 488ed62..2105f97 100644 --- a/dispatcher/dispatcher.py +++ b/dispatcher/dispatcher.py @@ -185,10 +185,20 @@ def list_todo_tasks(vikunja_token: str, project_id: int, todo_id: int) -> list[d ] -def claim_task(vikunja_token: str, task_id: int, in_progress_id: int) -> bool: - """Move task from Todo → In Progress.""" +def claim_task( + vikunja_token: str, + task_id: int, + in_progress_id: int, + project_id: int, + view_id: int, +) -> bool: + """Move task from Todo → In Progress via the kanban view endpoint.""" try: - vikunja_post(vikunja_token, f"tasks/{task_id}", {"bucket_id": in_progress_id}) + vikunja_post( + vikunja_token, + f"projects/{project_id}/views/{view_id}/buckets/{in_progress_id}/tasks", + {"task_id": task_id}, + ) log.info("Moved task %d → In Progress (bucket %d)", task_id, in_progress_id) return True except Exception as e: @@ -196,10 +206,20 @@ def claim_task(vikunja_token: str, task_id: int, in_progress_id: int) -> bool: return False -def unclaim_task(vikunja_token: str, task_id: int, todo_id: int) -> None: - """Move task back to Todo on job spawn failure.""" +def unclaim_task( + vikunja_token: str, + task_id: int, + todo_id: int, + project_id: int, + view_id: int, +) -> None: + """Move task back to Todo on job spawn failure via the kanban view endpoint.""" try: - vikunja_post(vikunja_token, f"tasks/{task_id}", {"bucket_id": todo_id}) + vikunja_post( + vikunja_token, + f"projects/{project_id}/views/{view_id}/buckets/{todo_id}/tasks", + {"task_id": task_id}, + ) log.info("Unclaimed task %d → Todo", task_id) except Exception as e: log.warning("Failed to unclaim task %d: %s", task_id, e) @@ -473,7 +493,7 @@ def orchestrate_review_tasks( role = extract_agent_role(task) if not role or role in REVIEW_SKIP_ROLES: - log.debug("Task %d role=%s skipped for review orchestration", task_id, role) + log.info("Task %d role=%s skipped for review orchestration", task_id, role) continue spawn_review_pm_job( @@ -697,7 +717,7 @@ def main() -> None: continue log.info("Claiming task %d (%s) for role=%s", task_id, title[:60], role) - if not claim_task(vikunja_token, task_id, in_progress_id): + if not claim_task(vikunja_token, task_id, in_progress_id, project_id, view_id): continue try: @@ -707,7 +727,7 @@ def main() -> None: active_by_role[role] = active_by_role.get(role, 0) + 1 except Exception as e: log.error("Failed to spawn job for task %d: %s", task_id, e) - unclaim_task(vikunja_token, task_id, todo_id) + unclaim_task(vikunja_token, task_id, todo_id, project_id, view_id) log.info("Dispatcher done. Claimed %d tasks.", claimed)