From db06ae23c6c3bfa326fc2ec866c35a60547b34c5 Mon Sep 17 00:00:00 2001 From: Senko Rasic Date: Thu, 30 May 2024 11:42:43 +0200 Subject: [PATCH] Check task state before checking steps (so it can be skipped if needed) --- core/agents/orchestrator.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/agents/orchestrator.py b/core/agents/orchestrator.py index 5b59b37ea..de93f9068 100644 --- a/core/agents/orchestrator.py +++ b/core/agents/orchestrator.py @@ -181,10 +181,9 @@ def create_agent(self, prev_response: Optional[AgentResponse]) -> BaseAgent: ): # Ask the Tech Lead to break down the initial project or feature into tasks and apply project template return TechLead(self.state_manager, self.ui, process_manager=self.process_manager) - elif not state.steps and not state.iterations: - # Ask the Developer to break down current task into actionable steps - return Developer(self.state_manager, self.ui) + # Current task status must be checked before Developer is called because we might want + # to skip it instead of breaking it down current_task_status = state.current_task.get("status") if state.current_task else None if current_task_status: # Status of the current task is set first time after the task was reviewed by user @@ -199,6 +198,10 @@ def create_agent(self, prev_response: Optional[AgentResponse]) -> BaseAgent: # Task is fully done or skipped, call TaskCompleter to mark it as completed return TaskCompleter(self.state_manager, self.ui) + if not state.steps and not state.iterations: + # Ask the Developer to break down current task into actionable steps + return Developer(self.state_manager, self.ui) + if state.current_step: # Execute next step in the task # TODO: this can be parallelized in the future