fix(executors): parse retryAfter timestamp for precise backoff on 429 - #879
Open
anuragg-saxenaa wants to merge 1 commit into
Open
anuragg-saxenaa wants to merge 1 commit into
anuragg-saxenaa wants to merge 1 commit into
Conversation
When providers (e.g. MiniMax) return 429 with a retryAfter ISO timestamp, the base parseError() ignores it and falls back to exponential backoff (starting at 2s, doubling). This adds a parseError() override in both default.js and opencode-go.js that extracts the precise retryAfter timestamp and returns resetsAtMs — so the caller waits exactly until the provider's reset window, not a guessed backoff. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Author
|
👋 Gentle follow-up — this PR has been ready for ~35 days and CI is green. Happy to address any feedback or close if no longer relevant. Let me know how to move it forward. |
diegosouzapw
added a commit
to diegosouzapw/OmniRoute
that referenced
this pull request
Jul 3, 2026
The per-account cooldown path (getUpstreamRetryHintMs -> parseRetryFromErrorText
in open-sse/services/accountFallback.ts) only recognized retry hints from the
HTTP Retry-After header or free-text prose in the response body. Some
providers instead surface the hint as structured fields on the 429 JSON
body itself (e.g. {"error":{"retryAfter":"<ISO>"}} or
{"retry_after_ms":45000}), which were previously ignored, causing the
connection to fall back to the generic exponential-backoff cooldown instead
of the provider's own reset window.
parseRetryFromErrorText now attempts a JSON.parse of the error text first
and reads retryAfter (bare ISO 8601, converted to a future duration) or
retry_after_ms / retryAfterMs (already in milliseconds) from either the
top level or a nested `error` object, reusing the existing
MAX_PROVIDER_COOLDOWN_MS 30-day cap. No new regexes were added.
Co-authored-by: Anurag Saxena <anuragg.saxenaa@gmail.com>
Inspired-by: decolua/9router#879
afandiaziz
pushed a commit
to afandiaziz/9router
that referenced
this pull request
Aug 9, 2026
29 PR upstream di-cherry-pick (semua masih open upstream per 2026-08-09). Rincian lengkap + link per PR ada di FORK-CHANGES.md. P1 skala 2475 koneksi : decolua#2798 decolua#410 decolua#2879 decolua#879 decolua#2997 P2 akurasi token/usage: decolua#2422 decolua#2658 decolua#2762 decolua#2453 decolua#2668 decolua#2361 P3 provider & combo : decolua#2526 decolua#3125 decolua#1434 decolua#2689 decolua#2439 decolua#2724 decolua#2647 decolua#1805 decolua#2909 decolua#2853 decolua#2508 decolua#2928 decolua#2345 decolua#2112 decolua#2786 P4 keamanan : decolua#1666 decolua#2776 Revert decolua#664: menambah transformRequest kedua di DefaultExecutor sehingga menimpa yang pertama dan mematikan stream_options/text.format/ injectReasoningContent/stripUnsupportedParams — termasuk PR decolua#3081 yang sudah dipakai produksi. Test: 88 gagal / 1783 lulus — nol regresi vs baseline v0.5.50 (88/1656).
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
parseError()inDefaultExecutorandOpenCodeGoExecutorto extractretryAfterISO timestamp from MiniMax (and similar providers) 429 responsesresetsAtMsinstead of falling back to exponential backoff guessingretryAfter(ISO string) andretry_after_ms/retryAfterMs(numeric ms)Test plan
retryAfterfield → verifyresetsAtMsis set to the parsed timestampretryAfter→ verify falls through to default exponential backoffCloses #878