Skip to content

feat(open-sse): parse RetryInfo, ErrorInfo, and resetsAtMs delay from… - #3394

Open
fasilu wants to merge 1 commit into
decolua:masterfrom
fasilu:feat/smart-cooldown-parsing
Open

feat(open-sse): parse RetryInfo, ErrorInfo, and resetsAtMs delay from…#3394
fasilu wants to merge 1 commit into
decolua:masterfrom
fasilu:feat/smart-cooldown-parsing

Conversation

@fasilu

@fasilu fasilu commented Aug 17, 2026

Copy link
Copy Markdown

Problem

When upstream provider APIs return 429 rate limit or quota errors, they often include exact reset times in their payload metadata (such as Google RPC ErrorInfo/RetryInfo objects or string messages like resets in 2h7m). Currently, the router falls back to hardcoded cooldown periods, which can result in routing delays or premature retry attempts.

Solution

  • Implemented duration parsing (parseDurationToMs) to parse Google RPC duration formats (e.g., 547098s or 151h58m18s) into milliseconds.
  • Expanded error details parsing in BaseExecutor.parseError to look for google.rpc.ErrorInfo (quotaResetTimeStamp, quotaResetDelay) and google.rpc.RetryInfo (retryDelay) in JSON error payloads.
  • Added regex fallback to parse "reset(s) in/after ..." strings out of standard error messages.
  • Updated open-sse/config/errorConfig.js to support new credit and quota exhausted categories with explicit cooldown intervals.

Impact

  • Enables the routing gateway to lock rate-limited connections for the exact duration recommended by the upstream API, optimizing fallback selection.

Testing

  • Verified that the test suite runs successfully and the changes introduce no new regressions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant