This commit is contained in:
Dmitry 2025-11-21 02:05:04 +03:00
parent 3578328409
commit cc017be01a
2 changed files with 37 additions and 23 deletions

View file

@ -68,8 +68,9 @@ class AgentOrchestrator:
print(f"⏱️ Estimated: {next_task.estimated_hours}h") print(f"⏱️ Estimated: {next_task.estimated_hours}h")
print(f"{'='*80}\n") print(f"{'='*80}\n")
# Start task # Start task (only if not already in progress)
self.task_manager.start_task(next_task) if next_task.status != "in_progress":
self.task_manager.start_task(next_task)
# Check if task needs global lock (modifies common package) # Check if task needs global lock (modifies common package)
needs_global_lock = self._needs_global_lock(next_task) needs_global_lock = self._needs_global_lock(next_task)
@ -83,28 +84,41 @@ class AgentOrchestrator:
return 0 return 0
try: try:
# Execute task # Retry loop: keep trying the same task until success or max retries
success = self._execute_task(next_task) while True:
# Get current retry count
if success: current_state = self.task_manager.load_state()
# Task completed successfully retry_count = current_state.retry_count
print(f"\n✅ Task {next_task.id} completed successfully")
self.task_manager.mark_task_completed(next_task.id)
else:
# Task failed
retry_count = self.task_manager.increment_retry()
if retry_count >= self.config.max_retries: if retry_count > 0:
print(f"\n❌ Task {next_task.id} failed after {retry_count} retries") print(f"\n🔄 Retry attempt {retry_count}/{self.config.max_retries} for task {next_task.id}")
self.task_manager.mark_task_failed(
next_task.id, # Execute task
f"Failed after {retry_count} retries" success = self._execute_task(next_task)
)
if success:
# Create GitHub issue # Task completed successfully
self._create_issue_for_failed_task(next_task) print(f"\n✅ Task {next_task.id} completed successfully")
self.task_manager.mark_task_completed(next_task.id)
break
else: else:
print(f"\n⚠️ Task {next_task.id} failed, will retry ({retry_count}/{self.config.max_retries})") # Task failed, increment retry count
retry_count = self.task_manager.increment_retry()
if retry_count >= self.config.max_retries:
print(f"\n❌ Task {next_task.id} failed after {retry_count} retries")
self.task_manager.mark_task_failed(
next_task.id,
f"Failed after {retry_count} retries"
)
# Create GitHub issue
self._create_issue_for_failed_task(next_task)
break
else:
print(f"\n⚠️ Task {next_task.id} failed, retrying ({retry_count}/{self.config.max_retries})")
print("Waiting before retry...")
time.sleep(5) # Small delay before retry
finally: finally:
# Release global lock if held # Release global lock if held

View file

@ -17,7 +17,7 @@ class AgentConfig:
# Agent limits # Agent limits
max_iterations: int = 10 max_iterations: int = 10
max_retries: int = 3 max_retries: int = 5
timeout_hours: int = 6 timeout_hours: int = 6
# Cursor CLI settings # Cursor CLI settings