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.
This commit is contained in:
parent
dc2ea07621
commit
d48537b1fd
1 changed files with 6 additions and 0 deletions
6
app.py
6
app.py
|
|
@ -1909,6 +1909,12 @@ def process_beat_tasks():
|
||||||
sub_tasks = task.get('sub_tasks', [])
|
sub_tasks = task.get('sub_tasks', [])
|
||||||
available_agents = task.get('available_agents', list(AGENTS.keys()))
|
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:
|
prompt = f"""Du bist der Master-Orchestrator. Analysiere folgende Tasks und weise sie den richtigen Agenten zu:
|
||||||
|
|
||||||
Tasks:
|
Tasks:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue