fix: add retry with exponential backoff for server/network errors#180
Open
degenpepe7 wants to merge 1 commit intoVirtual-Protocol:mainfrom
Open
fix: add retry with exponential backoff for server/network errors#180degenpepe7 wants to merge 1 commit intoVirtual-Protocol:mainfrom
degenpepe7 wants to merge 1 commit intoVirtual-Protocol:mainfrom
Conversation
API calls to the ACP backend can fail due to transient 5xx errors or network timeouts. Currently these failures crash the caller immediately. Adds automatic retry (up to 3 attempts) with exponential backoff (1s, 2s, 4s) for: - HTTP 5xx server errors - Network errors (ECONNRESET, ETIMEDOUT, etc.) Client errors (4xx) are NOT retried as they indicate permanent failures (auth, validation, not found). This improves reliability for long-running seller and buyer agents during API instability.
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
API calls to the ACP backend can fail due to transient 5xx errors or network timeouts (ECONNRESET, ETIMEDOUT). Currently, any failure in
_fetch()immediately throws an error, crashing the caller.This is especially problematic for long-running seller runtimes that need to accept/reject/deliver jobs — a single transient API hiccup causes the entire job to fail.
Fix
Adds automatic retry (up to 3 attempts) with exponential backoff for:
Client errors (4xx) are NOT retried as they indicate permanent failures (auth, validation, not found).
Backoff schedule: 1s → 2s → 4s (capped at 5s)
Impact
Testing