fix: cap consecutive empty LLM response retries to prevent infinite loop#247
Closed
Kailigithub wants to merge 1 commit intolsdefine:mainfrom
Closed
fix: cap consecutive empty LLM response retries to prevent infinite loop#247Kailigithub wants to merge 1 commit intolsdefine:mainfrom
Kailigithub wants to merge 1 commit intolsdefine:mainfrom
Conversation
Owner
|
Thanks for identifying this issue. We've implemented a simpler fix on our end. Closing this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #201
Summary
Issue #201 reports that the agent enters an infinite retry loop when the LLM returns empty responses, continuously printing
[Warn] LLM returned an empty response. Retrying...without any upper bound.Root Cause
do_no_tool()inga.pyreturns aStepOutcomewith a retry prompt whenever the LLM response is empty. The agent loop (agent_runner_loop) then re-invokes the LLM, which can produce another empty response, creating an unbounded cycle untilmax_turns(40) is exhausted.Fix
_consecutive_empty_retries) toGenericAgentHandlerStepOutcome({}, next_prompt=None)instead of a retry promptRetrying (1/3)...,Retrying (2/3)..., etc.Changes
ga.py—__init__: added_consecutive_empty_retries = 0ga.py—do_no_tool(): capped retries at 3, added counter reset on valid responseVerification