fix(anthropic): retry 429/529 errors and surface error details to users#1585
Merged
Merged
Conversation
- 429 rate limit and 529 overloaded were incorrectly treated as non-retryable client errors, causing immediate failure instead of exponential backoff retry. Users hitting Anthropic rate limits got silent failures or no response at all. - Generic "Sorry, I encountered an unexpected error" now includes error type, details, and status-specific hints (auth, rate limit, overloaded). - Failed agent with final_response=None now surfaces the actual error message instead of returning an empty response.
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 27, 2026
…handling fix(anthropic): retry 429/529 errors and surface error details to users
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
…handling fix(anthropic): retry 429/529 errors and surface error details to users
olympus-terminal
pushed a commit
to olympus-terminal/hermes-agent
that referenced
this pull request
May 16, 2026
…handling fix(anthropic): retry 429/529 errors and surface error details to users
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
…handling fix(anthropic): retry 429/529 errors and surface error details to users
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.
Summary
run_agent.pyclassified all 4xx (except 413) as non-retryable client errors. This meant 429 (rate limit) and 529 (overloaded) caused immediate failure instead of exponential backoff retry. Fixed by adding_RETRYABLE_STATUS_CODES = {413, 429, 529}.gateway/run.pycaught all exceptions and returned "Sorry, I encountered an unexpected error" with zero detail. Now includes error type, message (truncated to 300 chars), and status-specific hints (auth, rate limit, overloaded).run_conversation()returned{"failed": True, "final_response": None}, the gateway sent nothing back to the user. Now surfaces the actual error message.Changes
run_agent.py(+5 lines): Exclude 429/529 from non-retryable client error classificationgateway/run.py(+25 lines): Informative error messages + handle None final_responsetests/test_anthropic_error_handling.py(new, 8 tests): Full coverage of Anthropic error pathsTest plan
All 8 tests run through the real agent retry loop via
_run_agent: