grok 判死
This commit is contained in:
@@ -968,10 +968,13 @@ func (s *TokenService) RefreshGrokLiveness(ctx context.Context) {
|
|||||||
}
|
}
|
||||||
sub, serr := s.grok.FetchSubscription(ctx, it.Value)
|
sub, serr := s.grok.FetchSubscription(ctx, it.Value)
|
||||||
if serr != nil {
|
if serr != nil {
|
||||||
if errors.Is(serr, grok.ErrAuth) {
|
// Any probe error — including 401/403 (ErrAuth) — is treated as
|
||||||
_, _ = s.tokens.Update(ctx, "grok", it.ID, map[string]any{"status": "disabled", "dead": true})
|
// transient: leave the account as-is and retry next tick. A grok sso
|
||||||
}
|
// can momentarily 401 (upstream blip / proxy hiccup / anti-bot) while
|
||||||
continue // transient upstream error → leave as-is, retry next tick
|
// still being fully valid, so a single auth failure must NOT kill a
|
||||||
|
// live account. Genuine membership loss is still caught below via an
|
||||||
|
// INACTIVE/empty subscription (!sub.Member).
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
if sub == nil || !sub.Member {
|
if sub == nil || !sub.Member {
|
||||||
// no ACTIVE subscription (INACTIVE / empty) → membership lapsed → dead.
|
// no ACTIVE subscription (INACTIVE / empty) → membership lapsed → dead.
|
||||||
@@ -980,9 +983,8 @@ func (s *TokenService) RefreshGrokLiveness(ctx context.Context) {
|
|||||||
}
|
}
|
||||||
data, derr := s.grok.FetchCreditsBalance(ctx, it.Value)
|
data, derr := s.grok.FetchCreditsBalance(ctx, it.Value)
|
||||||
if derr != nil {
|
if derr != nil {
|
||||||
if errors.Is(derr, grok.ErrAuth) {
|
// Same policy as the subscription probe: a credits-balance 401/403 is
|
||||||
_, _ = s.tokens.Update(ctx, "grok", it.ID, map[string]any{"status": "disabled", "dead": true})
|
// transient, never a reason to kill a live account. Skip and retry.
|
||||||
}
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
meta := cloneJSONMap(it.Meta)
|
meta := cloneJSONMap(it.Meta)
|
||||||
|
|||||||
@@ -3085,7 +3085,10 @@ func (s *V1Service) markTokenFailure(ctx context.Context, pool string, token mod
|
|||||||
// the cookie. chatgpt/runway/leonardo auth means the stored credential is
|
// the cookie. chatgpt/runway/leonardo auth means the stored credential is
|
||||||
// dead — a raw JWT (chatgpt/runway) or a cookie whose session no longer
|
// dead — a raw JWT (chatgpt/runway) or a cookie whose session no longer
|
||||||
// authenticates (leonardo) — there's nothing left to refresh from.
|
// authenticates (leonardo) — there's nothing left to refresh from.
|
||||||
if pool == "chatgpt" || pool == "runway" || pool == "leonardo" || pool == "krea" || pool == "imagine" || pool == "grok" {
|
// grok is intentionally excluded: a grok sso can momentarily 401 while
|
||||||
|
// still valid (upstream blip / proxy / anti-bot), so an auth failure just
|
||||||
|
// fails over for this request without permanently killing the account.
|
||||||
|
if pool == "chatgpt" || pool == "runway" || pool == "leonardo" || pool == "krea" || pool == "imagine" {
|
||||||
patch["status"] = "disabled"
|
patch["status"] = "disabled"
|
||||||
patch["dead"] = true
|
patch["dead"] = true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user