retries
This commit is contained in:
parent
3578328409
commit
cc017be01a
2 changed files with 37 additions and 23 deletions
|
|
@ -68,7 +68,8 @@ 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)
|
||||||
|
if next_task.status != "in_progress":
|
||||||
self.task_manager.start_task(next_task)
|
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)
|
||||||
|
|
@ -83,6 +84,15 @@ class AgentOrchestrator:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# 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 > 0:
|
||||||
|
print(f"\n🔄 Retry attempt {retry_count}/{self.config.max_retries} for task {next_task.id}")
|
||||||
|
|
||||||
# Execute task
|
# Execute task
|
||||||
success = self._execute_task(next_task)
|
success = self._execute_task(next_task)
|
||||||
|
|
||||||
|
|
@ -90,8 +100,9 @@ class AgentOrchestrator:
|
||||||
# Task completed successfully
|
# Task completed successfully
|
||||||
print(f"\n✅ Task {next_task.id} completed successfully")
|
print(f"\n✅ Task {next_task.id} completed successfully")
|
||||||
self.task_manager.mark_task_completed(next_task.id)
|
self.task_manager.mark_task_completed(next_task.id)
|
||||||
|
break
|
||||||
else:
|
else:
|
||||||
# Task failed
|
# Task failed, increment retry count
|
||||||
retry_count = self.task_manager.increment_retry()
|
retry_count = self.task_manager.increment_retry()
|
||||||
|
|
||||||
if retry_count >= self.config.max_retries:
|
if retry_count >= self.config.max_retries:
|
||||||
|
|
@ -103,8 +114,11 @@ class AgentOrchestrator:
|
||||||
|
|
||||||
# Create GitHub issue
|
# Create GitHub issue
|
||||||
self._create_issue_for_failed_task(next_task)
|
self._create_issue_for_failed_task(next_task)
|
||||||
|
break
|
||||||
else:
|
else:
|
||||||
print(f"\n⚠️ Task {next_task.id} failed, will retry ({retry_count}/{self.config.max_retries})")
|
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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue