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