diff --git a/dispatcher/dispatcher.py b/dispatcher/dispatcher.py index a3611c3..e95f2c4 100644 --- a/dispatcher/dispatcher.py +++ b/dispatcher/dispatcher.py @@ -89,7 +89,7 @@ def list_todo_tasks(vikunja_token: str) -> list[dict]: page = 1 while True: resp = httpx.get( - f"{VIKUNJA_BASE_URL}/api/v1/projects/{VIKUNJA_PROJECT_ID}/views/{VIKUNJA_KANBAN_VIEW_ID}/buckets/{VIKUNJA_TODO_BUCKET_ID}/tasks", + f"{VIKUNJA_BASE_URL}/api/v1/projects/{VIKUNJA_PROJECT_ID}/tasks", headers={"Authorization": f"Bearer {vikunja_token}"}, params={"page": page, "per_page": 50}, timeout=15, @@ -102,7 +102,10 @@ def list_todo_tasks(vikunja_token: str) -> list[dict]: if len(batch) < 50: break page += 1 - return tasks + # Tasks in Todo bucket have done=False and agent label. + # Since done tasks are marked done=True, filtering undone tasks + # with an agent label is sufficient. + return [t for t in tasks if not t.get("done") and t.get("labels")] def extract_agent_role(task: dict) -> str | None: