From d48537b1fd0c0760f9a64224e93c4e0398820bae Mon Sep 17 00:00:00 2001 From: pdyde Date: Sat, 21 Feb 2026 15:44:00 +0100 Subject: [PATCH] fix: Handle orchestrated tasks without sub_tasks Problem: - Task #1 was stuck in 'in_progress' status - TaskBeat expects 'sub_tasks' array for orchestrated tasks - Tasks created via old API didn't have sub_tasks defined - TaskBeat only processes 'pending' tasks, so in_progress tasks stay stuck Solution: - Added validation: if orchestrated task has no sub_tasks, mark as completed with error message - Prevents infinite loop with stuck tasks - Manually completed Task #1 in database Note: This handles legacy tasks from deprecated /api/orchestrate endpoint. --- app.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app.py b/app.py index fce9e54..d2cc9e7 100644 --- a/app.py +++ b/app.py @@ -1909,6 +1909,12 @@ def process_beat_tasks(): sub_tasks = task.get('sub_tasks', []) available_agents = task.get('available_agents', list(AGENTS.keys())) + # Falls keine sub_tasks: Task ist fehlerhaft, markiere als completed + if not sub_tasks: + logger.warning("[TaskBeat] Task #%d hat keine sub_tasks - als completed markiert", task['id']) + update_task_db(task['id'], status='completed', response='Fehler: Keine sub_tasks definiert. Dieser Task wurde wahrscheinlich über eine veraltete API erstellt.') + continue + prompt = f"""Du bist der Master-Orchestrator. Analysiere folgende Tasks und weise sie den richtigen Agenten zu: Tasks: