fix: prevent task output loss when mixing sync and async tasks #4139
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.