fix: prevent task output loss when mixing sync and async tasks#4139
fix: prevent task output loss when mixing sync and async tasks#4139Rakshit-gen wants to merge 2 commits into
Conversation
Fixes crewAIInc#4137 When processing async tasks, `_process_async_tasks` returns a new list containing only async task outputs. The caller was replacing the existing `task_outputs` list instead of extending it, causing all previous sync task outputs to be silently lost. Changed assignment (`=`) to `extend()` at all affected locations: - `_execute_tasks()` lines 1155, 1169 - `_aexecute_tasks()` lines 960, 976 - `_handle_conditional_task()` line 1182 - `_ahandle_conditional_task()` line 990 This ensures sync task outputs accumulated before async tasks are preserved when async tasks are collected.
|
@gabemilani can we look into these changes? |
我也刚刚发现了这个问题,希望可以尽快合并 |
|
This PR is stale because it has been open for 45 days with no activity. |
Fixes #4137
When processing async tasks,
_process_async_tasksreturns a new list containing only async task outputs. The caller was replacing the existingtask_outputslist instead of extending it, causing all previous sync task outputs to be silently lost.Changed assignment (
=) toextend()at all affected locations:_execute_tasks()lines 1155, 1169_aexecute_tasks()lines 960, 976_handle_conditional_task()line 1182_ahandle_conditional_task()line 990This ensures sync task outputs accumulated before async tasks are preserved when async tasks are collected.
Note
Replaces overwriting of
task_outputswithextend()when resolving async tasks to prevent loss of prior sync outputs in both sync and async execution paths, including conditional handlers.task_outputs = ..._process_async_tasks(...)withtask_outputs.extend(...)in:*_aexecute_tasks()and*_execute_tasks()when flushing pending async tasks mid-loop and at the end.*_ahandle_conditional_task()and*_handle_conditional_task()before conditional evaluations.Written by Cursor Bugbot for commit 5fcbc31. This will update automatically on new commits. Configure here.