Repository navigation
Retry transient upstream errors on image-modality requests - #143
Closed
kyto-agent wants to merge 1 commit into
Closed
kyto-agent wants to merge 1 commit into
kyto-agent wants to merge 1 commit into
Conversation
Image-modality requests (text-to-image, image editing) bypassed
fetchWithRetries entirely because they must skip the 15s header timeout.
That also dropped retry handling: an upstream OpenRouter 429
("Rate limit exceeded") on an image edit was passed straight through to
the client with no retry, while text requests retried it twice.
Refactor fetchWithRetries to take a skipHeaderTimeout option so image
requests keep retrying transient upstream failures without the header
timeout guard.
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.
What
fetchWithRetriesgains askipHeaderTimeoutoption. Image-modality requests now route through it withskipHeaderTimeout: true, instead of bypassing the helper entirely via a barefetch.Why
Image requests bypassed the header-timeout guard (they can take 10-30s+ to return headers), but the bypass also dropped all retry handling. So an upstream OpenRouter 429 ("Rate limit exceeded") on an image edit was passed straight through to the client with zero retries, while text requests retried 429/502/503/504 twice.
Confirmed live in #hack-club-ai support: a user's >1080p image edits consistently fail with a 429 whose body is OpenRouter's "Rate limit exceeded" wording, while smaller images pass. With retries, the transient provider rate-limit now gets its two attempts plus Retry-After backoff like every other request.
Header timeout behavior for image requests is unchanged (still no 15s guard).
Verification
tsc --noEmitclean.