Skip to content

Commit

Permalink
Merge pull request #394 from gitautoai/wes
Browse files Browse the repository at this point in the history
Break while loop if GitAuto tries to search files with slightly different conditions (like with incremental line number) and identical commitment
  • Loading branch information
hiroshinishio authored Dec 13, 2024
2 parents 5255526 + a63171b commit 5128977
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 8 additions & 0 deletions services/check_run_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions services/gitauto_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5128977

Please sign in to comment.