From da1fd5b9535afd25cd8a13ff997c51017a51fbbb Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 20 Mar 2026 12:07:55 +0000 Subject: [PATCH] fix: address ruff lint and formatting issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add explicit strict=False to zip() call in _create_completed_tasks_summary - Apply ruff formatting to all changed files Co-Authored-By: João --- lib/crewai/src/crewai/crew.py | 22 ++++++------------- .../src/crewai/utilities/planning_handler.py | 6 +++-- .../crewai/utilities/replanning_evaluator.py | 4 +++- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/lib/crewai/src/crewai/crew.py b/lib/crewai/src/crewai/crew.py index 98d621343..487039a45 100644 --- a/lib/crewai/src/crewai/crew.py +++ b/lib/crewai/src/crewai/crew.py @@ -111,8 +111,8 @@ from crewai.utilities.i18n import get_i18n from crewai.utilities.llm_utils import create_llm from crewai.utilities.logger import Logger from crewai.utilities.planning_handler import CrewPlanner -from crewai.utilities.replanning_evaluator import ReplanningEvaluator from crewai.utilities.printer import PrinterColor +from crewai.utilities.replanning_evaluator import ReplanningEvaluator from crewai.utilities.rpm_controller import RPMController from crewai.utilities.streaming import ( create_async_chunk_generator, @@ -1059,9 +1059,7 @@ class Crew(FlowTrackable, BaseModel): task_outputs.append(task_output) self._process_task_result(task, task_output) self._store_execution_log(task, task_output, task_index, was_replayed) - self._maybe_replan( - task, task_output, task_index, tasks, task_outputs - ) + self._maybe_replan(task, task_output, task_index, tasks, task_outputs) if pending_tasks: task_outputs = await self._aprocess_async_tasks(pending_tasks, was_replayed) @@ -1110,9 +1108,7 @@ class Crew(FlowTrackable, BaseModel): # Store original descriptions before appending plans so replanning # can strip the old plan and apply a fresh one. - self._original_task_descriptions = [ - task.description for task in self.tasks - ] + self._original_task_descriptions = [task.description for task in self.tasks] self._replan_count = 0 plan_map: dict[int, str] = {} @@ -1165,7 +1161,7 @@ class Crew(FlowTrackable, BaseModel): ): return - remaining_tasks = tasks[task_index + 1:] + remaining_tasks = tasks[task_index + 1 :] if not remaining_tasks: return @@ -1175,7 +1171,7 @@ class Crew(FlowTrackable, BaseModel): if task_index < len(self._original_task_descriptions) else task.description ) - plan_text = task.description[len(original_desc):] + plan_text = task.description[len(original_desc) :] if not plan_text.strip(): return @@ -1199,9 +1195,7 @@ class Crew(FlowTrackable, BaseModel): ) completed_tasks = tasks[: task_index + 1] - planner = CrewPlanner( - tasks=self.tasks, planning_agent_llm=self.planning_llm - ) + planner = CrewPlanner(tasks=self.tasks, planning_agent_llm=self.planning_llm) replan_result = planner._handle_crew_replanning( completed_tasks=completed_tasks, completed_outputs=all_task_outputs, @@ -1359,9 +1353,7 @@ class Crew(FlowTrackable, BaseModel): task_outputs.append(task_output) self._process_task_result(task, task_output) self._store_execution_log(task, task_output, task_index, was_replayed) - self._maybe_replan( - task, task_output, task_index, tasks, task_outputs - ) + self._maybe_replan(task, task_output, task_index, tasks, task_outputs) if futures: task_outputs = self._process_async_tasks(futures, was_replayed) diff --git a/lib/crewai/src/crewai/utilities/planning_handler.py b/lib/crewai/src/crewai/utilities/planning_handler.py index 4a9d14d42..f217cc24b 100644 --- a/lib/crewai/src/crewai/utilities/planning_handler.py +++ b/lib/crewai/src/crewai/utilities/planning_handler.py @@ -209,7 +209,9 @@ class CrewPlanner: A formatted string summarizing completed tasks and results. """ summaries = [] - for idx, (task, output) in enumerate(zip(tasks, outputs), start=1): + for idx, (task, output) in enumerate( + zip(tasks, outputs, strict=False), start=1 + ): agent_role = task.agent.role if task.agent else "None" summaries.append( f"Task {idx} (Agent: {agent_role}):\n" @@ -234,7 +236,7 @@ class CrewPlanner: agent_role = task.agent.role if task.agent else "None" agent_goal = task.agent.goal if task.agent else "None" summaries.append( - f'Task Number {idx}:\n' + f"Task Number {idx}:\n" f' "task_description": {task.description}\n' f' "task_expected_output": {task.expected_output}\n' f' "agent": {agent_role}\n' diff --git a/lib/crewai/src/crewai/utilities/replanning_evaluator.py b/lib/crewai/src/crewai/utilities/replanning_evaluator.py index 80b1f8575..265ff8d55 100644 --- a/lib/crewai/src/crewai/utilities/replanning_evaluator.py +++ b/lib/crewai/src/crewai/utilities/replanning_evaluator.py @@ -129,7 +129,9 @@ class ReplanningEvaluator: if isinstance(result.pydantic, ReplanDecision): return result.pydantic - logger.warning("Failed to get structured ReplanDecision, defaulting to no replan") + logger.warning( + "Failed to get structured ReplanDecision, defaulting to no replan" + ) return ReplanDecision( should_replan=False, reason="Failed to evaluate task output against plan.",