diff --git a/services/check_run_handler.py b/services/check_run_handler.py index d1f11120..7b96819c 100644 --- a/services/check_run_handler.py +++ b/services/check_run_handler.py @@ -261,11 +261,19 @@ def handle_check_run(payload: CheckRunCompletedPayload) -> None: if not is_explored and not is_committed: break + # If no files are found but changes are made, it might fall into an infinite loop (e.g., repeatedly making and reverting similar changes with slight variations) + if not is_explored and is_committed: + retry_count += 1 + if retry_count > 3: + break + continue + # If files are found but no changes are made, it means that the agent found files but didn't think it's necessary to commit changes or fell into an infinite-like loop (e.g. slightly different searches) if is_explored and not is_committed: retry_count += 1 if retry_count > 3: break + continue # Because the agent is committing changes, keep doing the loop retry_count = 0 diff --git a/services/gitauto_handler.py b/services/gitauto_handler.py index 751515af..f4bdda0f 100644 --- a/services/gitauto_handler.py +++ b/services/gitauto_handler.py @@ -233,14 +233,16 @@ async def handle_gitauto( # If no files are found but changes are made, it might fall into an infinite loop (e.g., repeatedly making and reverting similar changes with slight variations) if not is_explored and is_committed: retry_count += 1 - if retry_count > 10: + if retry_count > 3: break + continue # If files are found but no changes are made, it means that the agent found files but didn't think it's necessary to commit changes or fell into an infinite-like loop (e.g. slightly different searches) if is_explored and not is_committed: retry_count += 1 - if retry_count > 10: + if retry_count > 3: break + continue # Because the agent is committing changes, keep doing the loop retry_count = 0