mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-02 21:58:11 +00:00
fix(a2a): always restore task.output_pydantic in finally block
In `_execute_task_with_a2a` and its async variant, the try body sets `task.output_pydantic = None` before returning an A2A response. The finally block then checks `if task.output_pydantic is not None` before restoring the original value — but since it was just set to None, the condition is always False and the original value is never restored. This permanently mutates the Task object. Remove the guard so `output_pydantic` is unconditionally restored, matching the unconditional restoration of `description` and `response_model` in the same block. Co-authored-by: Greyson LaLonde <greyson.r.lalonde@gmail.com>
This commit is contained in:
@@ -386,8 +386,7 @@ def _execute_task_with_a2a(
|
||||
return raw_result
|
||||
finally:
|
||||
task.description = original_description
|
||||
if task.output_pydantic is not None:
|
||||
task.output_pydantic = original_output_pydantic
|
||||
task.output_pydantic = original_output_pydantic
|
||||
task.response_model = original_response_model
|
||||
|
||||
|
||||
@@ -1534,8 +1533,7 @@ async def _aexecute_task_with_a2a(
|
||||
return raw_result
|
||||
finally:
|
||||
task.description = original_description
|
||||
if task.output_pydantic is not None:
|
||||
task.output_pydantic = original_output_pydantic
|
||||
task.output_pydantic = original_output_pydantic
|
||||
task.response_model = original_response_model
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user