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"⏱️ 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
|
||||||
|
current_state = self.task_manager.load_state()
|
||||||
|
retry_count = current_state.retry_count
|
||||||
|
|
||||||
if success:
|
if retry_count > 0:
|
||||||
# Task completed successfully
|
print(f"\n🔄 Retry attempt {retry_count}/{self.config.max_retries} for task {next_task.id}")
|
||||||
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:
|
# Execute task
|
||||||
print(f"\n❌ Task {next_task.id} failed after {retry_count} retries")
|
success = self._execute_task(next_task)
|
||||||
self.task_manager.mark_task_failed(
|
|
||||||
next_task.id,
|
|
||||||
f"Failed after {retry_count} retries"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Create GitHub issue
|
if success:
|
||||||
self._create_issue_for_failed_task(next_task)
|
# Task completed successfully
|
||||||
|
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
|
||||||
|
|
|
||||||
|
|
@ -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