Commit Graph

3 Commits

Author SHA1 Message Date
Devin AI
1c5ff235bd Fix test failures in test_config.py
- Replace type(NOT_SPECIFIED) with Any in type annotations to fix Pydantic schema generation errors
- Fix test_process_config_with_empty_config to expect empty config to remain (early return behavior)
- Fix test_process_config_with_dict_merge to test the actual behavior (config only overrides None/NOT_SPECIFIED)

All 19 tests now pass locally.

Co-Authored-By: João <joao@crewai.com>
2025-11-16 14:10:37 +00:00
Devin AI
31357f7f2a Trigger CI re-run
Co-Authored-By: João <joao@crewai.com>
2025-11-16 14:02:48 +00:00
Devin AI
ebcf0c98d5 Fix: Handle context: None in YAML task configuration (#3929)
This commit fixes issue #3929 where setting 'context: None' in a YAML
task configuration would cause errors.

Changes:
1. Updated _map_task_variables in crew_base.py to explicitly handle
   the 'context' key when present in task_info:
   - Preserves explicit None values from YAML
   - Preserves empty list [] from YAML
   - Resolves non-empty lists to Task instances as before

2. Updated process_config in utilities/config.py to allow None values
   from config to override the NOT_SPECIFIED sentinel:
   - Changed condition to only skip override when current value is
     not None AND not NOT_SPECIFIED
   - This preserves the semantic distinction between 'unspecified'
     (NOT_SPECIFIED) and 'explicitly none' (None)

3. Added comprehensive unit tests:
   - test_config.py: Tests for process_config handling None with
     NOT_SPECIFIED sentinel
   - test_crew_base_context_none.py: Tests for _map_task_variables
     handling context: None, context: [], and context: [tasks]

The fix ensures that when users set 'context: None' in YAML, it is
properly preserved as None in the Task instance, rather than being
ignored or causing errors.

Co-Authored-By: João <joao@crewai.com>
2025-11-16 13:58:33 +00:00