Conversation
diegosouzapw
pushed a commit
to diegosouzapw/OmniRoute
that referenced
this pull request
Jun 26, 2026
Port of upstream fix adding transient 5xx retry support and tool
declaration deduplication to the antigravity executor.
Three changes:
1. Add ANTIGRAVITY_TRANSIENT_ERROR_PATTERNS regex array,
ANTIGRAVITY_TRANSIENT_STATUSES set (500/502/503/504), and
ANTIGRAVITY_TRANSIENT_RETRY_MAX_MS (15s cap). Expose two new
class methods — extractErrorMessage() and isTransientAntigravityError()
— so the intra-request retry block can classify 5xx responses by body
pattern as well as status code ("Agent execution terminated due to error",
"high traffic", "capacity", etc.). Extends the existing 429 auto-retry
block to also back off on matching transient 5xx, capped at 15s.
2. Equivalent of upstream per-status retry config: the inline
MAX_AUTO_RETRIES=3 constant already covers 5xx now that the
retry condition includes transient statuses.
3. Tool-name deduplication in buildGeminiTools (geminiToolsSanitizer.ts):
add a seenToolNames Set so duplicate sanitized function names (same raw
name repeated across groups, or two different names that collapse to the
same sanitized form) are silently dropped — fixes Gemini API rejections
caused by duplicate functionDeclaration names.
Co-authored-by: Sutarto Jordan Chrisfivo <Jordannst@users.noreply.github.com>
Inspired-by: decolua/9router#2054
Owner
|
Thanks @Jordannst! Reviewed and merged into master. The transient 5xx/capacity retry with bounded backoff, tool-name dedupe, and Headroom phantom-savings diagnostics all look solid. 🙏 |
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.
Why
Antigravity upstream occasionally returns short-lived capacity/transient errors for Claude models, especially:
503 MODEL_CAPACITY_EXHAUSTED/ “No capacity available...”Before this change, these failures could immediately surface to clients even when a short retry or another Antigravity account could recover successfully.
While testing the retry path with Claude clients, I also hit a separate Antigravity request validation failure:
400 invalid_request_error: tools: Tool names must be unique.That can happen when client tool names collide after Antigravity name sanitization, e.g. distinct incoming names normalize into the same forwarded tool name.
What changed
500responses in addition to existing429/503behavior.Retry-After/ reset hints when present,400behavior: invalid requests are not retried.functionDeclarationsgroup.Why this is safe
500only enables the existing Antigravity retry hook for that status.Retry-After/ reset windows.400errors remain non-retryable.Verification
npx vitest run tests/unit/antigravity-retry-hook.test.js tests/unit/base-executor-retry.test.js tests/translator/bugs-antigravity.test.jsManual e2e via 9Router dev server on
127.0.0.1:20138with Claude client usingag/claude-opus-4-6-thinking:503retries with2s → 4s → 8sbackoff,tools: Tool names must be uniqueerror no longer occurred after the dedupe patch and fresh restart.