From f22bc59fe37c9708c5751e6aace6913995d6f251 Mon Sep 17 00:00:00 2001 From: song Date: Sat, 17 Jan 2026 21:15:33 +0800 Subject: [PATCH] fix(antigravity): route signature retry through url fallback --- .../service/antigravity_gateway_service.go | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/backend/internal/service/antigravity_gateway_service.go b/backend/internal/service/antigravity_gateway_service.go index 72ad7180..e6401891 100644 --- a/backend/internal/service/antigravity_gateway_service.go +++ b/backend/internal/service/antigravity_gateway_service.go @@ -844,11 +844,20 @@ func (s *AntigravityGatewayService) Forward(ctx context.Context, c *gin.Context, if txErr != nil { continue } - retryReq, buildErr := antigravity.NewAPIRequest(ctx, action, accessToken, retryGeminiBody) - if buildErr != nil { - continue - } - retryResp, retryErr := s.httpUpstream.Do(retryReq, proxyURL, account.ID, account.Concurrency) + retryResult, retryErr := antigravityRetryLoop(antigravityRetryLoopParams{ + ctx: ctx, + prefix: prefix, + account: account, + proxyURL: proxyURL, + accessToken: accessToken, + action: action, + body: retryGeminiBody, + quotaScope: quotaScope, + c: c, + httpUpstream: s.httpUpstream, + settingService: s.settingService, + handleError: s.handleUpstreamError, + }) if retryErr != nil { appendOpsUpstreamError(c, OpsUpstreamErrorEvent{ Platform: account.Platform, @@ -862,6 +871,7 @@ func (s *AntigravityGatewayService) Forward(ctx context.Context, c *gin.Context, continue } + retryResp := retryResult.resp if retryResp.StatusCode < 400 { _ = resp.Body.Close() resp = retryResp @@ -873,8 +883,8 @@ func (s *AntigravityGatewayService) Forward(ctx context.Context, c *gin.Context, _ = retryResp.Body.Close() if retryResp.StatusCode == http.StatusTooManyRequests { retryBaseURL := "" - if retryReq.URL != nil { - retryBaseURL = retryReq.URL.Scheme + "://" + retryReq.URL.Host + if retryResp.Request != nil && retryResp.Request.URL != nil { + retryBaseURL = retryResp.Request.URL.Scheme + "://" + retryResp.Request.URL.Host } log.Printf("%s status=429 rate_limited base_url=%s retry_stage=%s body=%s", prefix, retryBaseURL, stage.name, truncateForLog(retryBody, 200)) }