fix: track last error across retries in _call_with_retry#234
Open
dennis-lynch-nv wants to merge 1 commit intoaiming-lab:mainfrom
Open
fix: track last error across retries in _call_with_retry#234dennis-lynch-nv wants to merge 1 commit intoaiming-lab:mainfrom
dennis-lynch-nv wants to merge 1 commit intoaiming-lab:mainfrom
Conversation
When all retries are exhausted, the RuntimeError message only says 'LLM call failed after N retries for model X' with no indication of what went wrong. Additionally, URLError exceptions are not captured as a variable, losing diagnostic info. Fixes: - Add last_err tracking across all three exception handlers (HTTPError, URLError, TimeoutError/OSError) - Capture URLError as 'e' so the error details are available - Include last_err in the final RuntimeError message - Truncate HTTP body to 200 chars to avoid massive error messages
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.
Problem
When all retries are exhausted in
_call_with_retry(), the finalRuntimeErroronly says:...with no indication of what went wrong (rate limit? timeout? connection refused?).
Additionally,
URLErrorexceptions are caught but not captured as a variable, so their details are lost.Fix
last_errtracking across all three exception handlers (HTTPError,URLError,TimeoutError/OSError)URLErroraseso the error details are availablelast_errin the finalRuntimeErrormessageAfter
Testing
Import-tested; no new dependencies. Change is limited to the retry loop in
researchclaw/llm/client.py.