single task

This commit is contained in:
Dmitry 2025-11-21 01:49:07 +03:00
parent 63e01643e7
commit 0f8109ec00

View file

@ -1,6 +1,6 @@
""" """
Main orchestrator for AI agent execution. Main orchestrator for AI agent execution.
Manages the development cycle: read tasks -> execute -> test -> commit -> repeat Executes a single task per run: read task -> execute -> test -> commit
""" """
import sys import sys
import subprocess import subprocess
@ -33,12 +33,12 @@ class AgentOrchestrator:
def run(self) -> int: def run(self) -> int:
""" """
Main execution loop. Execute a single task from the task list.
Returns: 0 on success, 1 on error Returns: 0 on success, 1 on error
""" """
print(f"🚀 Starting AI Agent for component: {self.config.component}") print(f"🚀 Starting AI Agent for component: {self.config.component}")
print(f"📁 Project root: {self.config.project_root}") print(f"📁 Project root: {self.config.project_root}")
print(f"🎯 Max iterations: {self.config.max_iterations}") print(f"🎯 Executing one task per run")
# Check if another agent is running # Check if another agent is running
if self.task_manager.is_agent_running(): if self.task_manager.is_agent_running():
@ -47,14 +47,12 @@ class AgentOrchestrator:
return 0 return 0
try: try:
# Main development loop
while True:
state = self.task_manager.load_state() state = self.task_manager.load_state()
# Check iteration limit # Check iteration limit
if state.iteration_count >= self.config.max_iterations: if state.iteration_count >= self.config.max_iterations:
print(f"\n⏹️ Reached maximum iterations ({self.config.max_iterations})") print(f"\n⏹️ Reached maximum iterations ({self.config.max_iterations})")
break return 0
# Get next task # Get next task
next_task = self.task_manager.get_next_task() next_task = self.task_manager.get_next_task()
@ -62,10 +60,10 @@ class AgentOrchestrator:
if not next_task: if not next_task:
print("\n✅ All tasks completed!") print("\n✅ All tasks completed!")
self.task_manager.reset_state() self.task_manager.reset_state()
break return 0
print(f"\n{'='*80}") print(f"\n{'='*80}")
print(f"📋 Task {state.iteration_count + 1}/{self.config.max_iterations}: {next_task.id}") print(f"📋 Task: {next_task.id}")
print(f"📝 {next_task.title}") print(f"📝 {next_task.title}")
print(f"⏱️ Estimated: {next_task.estimated_hours}h") print(f"⏱️ Estimated: {next_task.estimated_hours}h")
print(f"{'='*80}\n") print(f"{'='*80}\n")
@ -82,7 +80,7 @@ class AgentOrchestrator:
next_task.id, next_task.id,
"Global lock not available" "Global lock not available"
) )
continue return 0
try: try:
# Execute task # Execute task
@ -113,10 +111,7 @@ class AgentOrchestrator:
if needs_global_lock: if needs_global_lock:
self.global_lock.release(self.config.component) self.global_lock.release(self.config.component)
# Small delay between tasks print("\n🎉 Agent execution completed (one task)")
time.sleep(2)
print("\n🎉 Agent execution completed")
return 0 return 0
except KeyboardInterrupt: except KeyboardInterrupt: