mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-22 22:58:13 +00:00
Fix Task config and callback parameters being silently ignored
- Preserve config dictionary in process_config function instead of removing it - Only set Task attributes for valid model fields in set_attributes_based_on_config - Add comprehensive tests for config retention, value extraction, and callback retention - Add reproduction script demonstrating the fix for issue #3160 - Fix deprecation warning by using class.model_fields instead of instance.model_fields Fixes #3160 Co-Authored-By: Jo\u00E3o <joao@crewai.com>
This commit is contained in:
@@ -324,7 +324,8 @@ class Task(BaseModel):
|
||||
"""Set attributes based on the agent configuration."""
|
||||
if self.config:
|
||||
for key, value in self.config.items():
|
||||
setattr(self, key, value)
|
||||
if key in self.__class__.model_fields:
|
||||
setattr(self, key, value)
|
||||
return self
|
||||
|
||||
@model_validator(mode="after")
|
||||
|
||||
@@ -34,6 +34,4 @@ def process_config(
|
||||
else:
|
||||
values[key] = value
|
||||
|
||||
# Remove the config from values to avoid duplicate processing
|
||||
values.pop("config", None)
|
||||
return values
|
||||
|
||||
Reference in New Issue
Block a user