retries
This commit is contained in:
parent
3578328409
commit
cc017be01a
2 changed files with 37 additions and 23 deletions
|
|
@ -68,8 +68,9 @@ class AgentOrchestrator:
|
|||
print(f"⏱️ Estimated: {next_task.estimated_hours}h")
|
||||
print(f"{'='*80}\n")
|
||||
|
||||
# Start task
|
||||
self.task_manager.start_task(next_task)
|
||||
# Start task (only if not already in progress)
|
||||
if next_task.status != "in_progress":
|
||||
self.task_manager.start_task(next_task)
|
||||
|
||||
# Check if task needs global lock (modifies common package)
|
||||
needs_global_lock = self._needs_global_lock(next_task)
|
||||
|
|
@ -83,28 +84,41 @@ class AgentOrchestrator:
|
|||
return 0
|
||||
|
||||
try:
|
||||
# Execute task
|
||||
success = self._execute_task(next_task)
|
||||
|
||||
if success:
|
||||
# Task completed successfully
|
||||
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()
|
||||
# Retry loop: keep trying the same task until success or max retries
|
||||
while True:
|
||||
# Get current retry count
|
||||
current_state = self.task_manager.load_state()
|
||||
retry_count = current_state.retry_count
|
||||
|
||||
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)
|
||||
if retry_count > 0:
|
||||
print(f"\n🔄 Retry attempt {retry_count}/{self.config.max_retries} for task {next_task.id}")
|
||||
|
||||
# Execute task
|
||||
success = self._execute_task(next_task)
|
||||
|
||||
if success:
|
||||
# Task completed successfully
|
||||
print(f"\n✅ Task {next_task.id} completed successfully")
|
||||
self.task_manager.mark_task_completed(next_task.id)
|
||||
break
|
||||
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:
|
||||
# Release global lock if held
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class AgentConfig:
|
|||
|
||||
# Agent limits
|
||||
max_iterations: int = 10
|
||||
max_retries: int = 3
|
||||
max_retries: int = 5
|
||||
timeout_hours: int = 6
|
||||
|
||||
# Cursor CLI settings
|
||||
|
|
|
|||
Loading…
Reference in a new issue