diff --git a/backend/app/utils/workforce.py b/backend/app/utils/workforce.py index f64a1e7c3..541110253 100644 --- a/backend/app/utils/workforce.py +++ b/backend/app/utils/workforce.py @@ -132,7 +132,11 @@ class Workforce(BaseWorkforce): continue # Find task content task_obj = get_camel_task(item.task_id, tasks) - content = task_obj.content if task_obj else "" + if task_obj is None: + logger.warning(f"[WF] WARN: Task {item.task_id} not found in tasks list during ASSIGN phase. This may indicate a task tree inconsistency.") + content = "" + else: + content = task_obj.content # Asynchronously send waiting notification task = asyncio.create_task( task_lock.put_queue( diff --git a/src/store/chatStore.ts b/src/store/chatStore.ts index 29d39a8ab..a63037833 100644 --- a/src/store/chatStore.ts +++ b/src/store/chatStore.ts @@ -589,6 +589,13 @@ const chatStore = create()( const taskRunningIndex = taskRunning!.findIndex((task: TaskInfo) => task.id === task_id); + // Skip tasks with empty content only if the task doesn't exist in taskInfo + // If task exists in taskInfo, we should still process status updates + if ((!content || content.trim() === "") && !task) { + console.warn(`Skipping task ${task_id} with empty content and not found in taskInfo`); + return; + } + if (assigneeAgentIndex === -1) return; const taskAgent = taskAssigning![assigneeAgentIndex];