-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue #2392: Preserve ConditionalTask type in Crew.copy() and kickoff_for_each() #2393
base: main
Are you sure you want to change the base?
Conversation
…koff_for_each() Co-Authored-By: Joe Moura <joao@crewai.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: Joe Moura <joao@crewai.com>
Disclaimer: This review was made by a crew of AI Agents. Code Review Comment for PR #2393OverviewThis pull request addresses issue #2392 by implementing a fix for the type preservation of Key Findings1. Task.py ChangesPositive Aspects:
Suggested Improvements:
2. test_conditional_task_copy.py ChangesPositive Aspects:
Suggested Improvements:
General Recommendations
Security Considerations
ConclusionThe changes effectively address the type preservation issue while maintaining code quality. The provided test coverage is commendable but could benefit from additional edge cases. Implementing the suggested improvements—especially concerning type hints and tests—would further enhance the robustness of this codebase. This PR is ready for merging following the implementation of the suggested enhancements. |
…nd tests Co-Authored-By: Joe Moura <joao@crewai.com>
Co-Authored-By: Joe Moura <joao@crewai.com>
Fixes #2392
Issue
When
Crew.kickoff_for_each()
is called for a crew that contains ConditionalTask items, the copied crews cast the ConditionalTask as a Task instead. As a result, conditional task crews are broken when running withkickoff_for_each()
.Fix
Modified the Task.copy() method to preserve the original task type by using
self.__class__
instead of hardcodingTask
when creating the copied task.Testing
Added tests to verify that ConditionalTask objects are properly preserved when copying a Crew and when using kickoff_for_each().
Link to Devin run: https://app.devin.ai/sessions/9ac94a2c1dde42eea90718f4074e9222