From 30a59168d753d3079f83b69b9247800dfb1efd31 Mon Sep 17 00:00:00 2001 From: sxjeru Date: Wed, 21 Jan 2026 21:48:23 +0800 Subject: [PATCH] fix(auth): handle quota cooldown in retry logic for transient errors --- sdk/cliproxy/auth/conductor.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sdk/cliproxy/auth/conductor.go b/sdk/cliproxy/auth/conductor.go index 43483672..5285b912 100644 --- a/sdk/cliproxy/auth/conductor.go +++ b/sdk/cliproxy/auth/conductor.go @@ -1371,8 +1371,12 @@ func (m *Manager) MarkResult(ctx context.Context, result Result) { shouldSuspendModel = true setModelQuota = true case 408, 500, 502, 503, 504: - next := now.Add(1 * time.Minute) - state.NextRetryAfter = next + if quotaCooldownDisabled.Load() { + state.NextRetryAfter = time.Time{} + } else { + next := now.Add(1 * time.Minute) + state.NextRetryAfter = next + } default: state.NextRetryAfter = time.Time{} } @@ -1623,7 +1627,11 @@ func applyAuthFailureState(auth *Auth, resultErr *Error, retryAfter *time.Durati auth.NextRetryAfter = next case 408, 500, 502, 503, 504: auth.StatusMessage = "transient upstream error" - auth.NextRetryAfter = now.Add(1 * time.Minute) + if quotaCooldownDisabled.Load() { + auth.NextRetryAfter = time.Time{} + } else { + auth.NextRetryAfter = now.Add(1 * time.Minute) + } default: if auth.StatusMessage == "" { auth.StatusMessage = "request failed"