@google/gemini-cli-core 0.9.0-nightly.20251003.2ab61dd1 → 0.9.0-nightly.20251005.7f8537a1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/src/agents/codebase-investigator.d.ts +36 -1
- package/dist/src/agents/codebase-investigator.js +54 -89
- package/dist/src/agents/codebase-investigator.js.map +1 -1
- package/dist/src/agents/executor.d.ts +4 -3
- package/dist/src/agents/executor.js +35 -5
- package/dist/src/agents/executor.js.map +1 -1
- package/dist/src/agents/executor.test.js +7 -11
- package/dist/src/agents/executor.test.js.map +1 -1
- package/dist/src/agents/invocation.d.ts +3 -2
- package/dist/src/agents/invocation.js +1 -0
- package/dist/src/agents/invocation.js.map +1 -1
- package/dist/src/agents/invocation.test.js +1 -0
- package/dist/src/agents/invocation.test.js.map +1 -1
- package/dist/src/agents/registry.d.ts +2 -1
- package/dist/src/agents/registry.js +2 -0
- package/dist/src/agents/registry.js.map +1 -1
- package/dist/src/agents/types.d.ts +15 -5
- package/dist/src/agents/types.js +1 -0
- package/dist/src/agents/types.js.map +1 -1
- package/dist/src/core/geminiChat.js +1 -14
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/geminiChat.test.js +14 -18
- package/dist/src/core/geminiChat.test.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +0 -8
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +2 -2
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +4 -4
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
- package/dist/src/tools/mcp-client.d.ts +3 -2
- package/dist/src/tools/mcp-client.js +25 -30
- package/dist/src/tools/mcp-client.js.map +1 -1
- package/dist/src/tools/mcp-client.test.js +110 -7
- package/dist/src/tools/mcp-client.test.js.map +1 -1
- package/dist/src/utils/errorParsing.d.ts +1 -1
- package/dist/src/utils/errorParsing.js +5 -33
- package/dist/src/utils/errorParsing.js.map +1 -1
- package/dist/src/utils/errorParsing.test.js +0 -88
- package/dist/src/utils/errorParsing.test.js.map +1 -1
- package/dist/src/utils/flashFallback.test.js +26 -45
- package/dist/src/utils/flashFallback.test.js.map +1 -1
- package/dist/src/utils/googleErrors.d.ts +104 -0
- package/dist/src/utils/googleErrors.js +108 -0
- package/dist/src/utils/googleErrors.js.map +1 -0
- package/dist/src/utils/googleErrors.test.d.ts +6 -0
- package/dist/src/utils/googleErrors.test.js +212 -0
- package/dist/src/utils/googleErrors.test.js.map +1 -0
- package/dist/src/utils/googleQuotaErrors.d.ts +35 -0
- package/dist/src/utils/googleQuotaErrors.js +108 -0
- package/dist/src/utils/googleQuotaErrors.js.map +1 -0
- package/dist/src/utils/googleQuotaErrors.test.d.ts +6 -0
- package/dist/src/utils/googleQuotaErrors.test.js +189 -0
- package/dist/src/utils/googleQuotaErrors.test.js.map +1 -0
- package/dist/src/utils/quotaErrorDetection.d.ts +0 -2
- package/dist/src/utils/quotaErrorDetection.js +0 -46
- package/dist/src/utils/quotaErrorDetection.js.map +1 -1
- package/dist/src/utils/retry.js +40 -157
- package/dist/src/utils/retry.js.map +1 -1
- package/dist/src/utils/retry.test.js +85 -144
- package/dist/src/utils/retry.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { describe, it, expect, vi, afterEach } from 'vitest';
|
|
7
|
+
import { classifyGoogleError, RetryableQuotaError, TerminalQuotaError, } from './googleQuotaErrors.js';
|
|
8
|
+
import * as errorParser from './googleErrors.js';
|
|
9
|
+
describe('classifyGoogleError', () => {
|
|
10
|
+
afterEach(() => {
|
|
11
|
+
vi.restoreAllMocks();
|
|
12
|
+
});
|
|
13
|
+
it('should return original error if not a Google API error', () => {
|
|
14
|
+
const regularError = new Error('Something went wrong');
|
|
15
|
+
vi.spyOn(errorParser, 'parseGoogleApiError').mockReturnValue(null);
|
|
16
|
+
const result = classifyGoogleError(regularError);
|
|
17
|
+
expect(result).toBe(regularError);
|
|
18
|
+
});
|
|
19
|
+
it('should return original error if code is not 429', () => {
|
|
20
|
+
const apiError = {
|
|
21
|
+
code: 500,
|
|
22
|
+
message: 'Server error',
|
|
23
|
+
details: [],
|
|
24
|
+
};
|
|
25
|
+
vi.spyOn(errorParser, 'parseGoogleApiError').mockReturnValue(apiError);
|
|
26
|
+
const originalError = new Error();
|
|
27
|
+
const result = classifyGoogleError(originalError);
|
|
28
|
+
expect(result).toBe(originalError);
|
|
29
|
+
expect(result).not.toBeInstanceOf(TerminalQuotaError);
|
|
30
|
+
expect(result).not.toBeInstanceOf(RetryableQuotaError);
|
|
31
|
+
});
|
|
32
|
+
it('should return TerminalQuotaError for daily quota violations in QuotaFailure', () => {
|
|
33
|
+
const apiError = {
|
|
34
|
+
code: 429,
|
|
35
|
+
message: 'Quota exceeded',
|
|
36
|
+
details: [
|
|
37
|
+
{
|
|
38
|
+
'@type': 'type.googleapis.com/google.rpc.QuotaFailure',
|
|
39
|
+
violations: [
|
|
40
|
+
{
|
|
41
|
+
subject: 'user',
|
|
42
|
+
description: 'daily limit',
|
|
43
|
+
quotaId: 'RequestsPerDay-limit',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
vi.spyOn(errorParser, 'parseGoogleApiError').mockReturnValue(apiError);
|
|
50
|
+
const result = classifyGoogleError(new Error());
|
|
51
|
+
expect(result).toBeInstanceOf(TerminalQuotaError);
|
|
52
|
+
expect(result.cause).toBe(apiError);
|
|
53
|
+
});
|
|
54
|
+
it('should return TerminalQuotaError for daily quota violations in ErrorInfo', () => {
|
|
55
|
+
const apiError = {
|
|
56
|
+
code: 429,
|
|
57
|
+
message: 'Quota exceeded',
|
|
58
|
+
details: [
|
|
59
|
+
{
|
|
60
|
+
'@type': 'type.googleapis.com/google.rpc.ErrorInfo',
|
|
61
|
+
reason: 'QUOTA_EXCEEDED',
|
|
62
|
+
domain: 'googleapis.com',
|
|
63
|
+
metadata: {
|
|
64
|
+
quota_limit: 'RequestsPerDay_PerProject_PerUser',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
};
|
|
69
|
+
vi.spyOn(errorParser, 'parseGoogleApiError').mockReturnValue(apiError);
|
|
70
|
+
const result = classifyGoogleError(new Error());
|
|
71
|
+
expect(result).toBeInstanceOf(TerminalQuotaError);
|
|
72
|
+
});
|
|
73
|
+
it('should return TerminalQuotaError for long retry delays', () => {
|
|
74
|
+
const apiError = {
|
|
75
|
+
code: 429,
|
|
76
|
+
message: 'Too many requests',
|
|
77
|
+
details: [
|
|
78
|
+
{
|
|
79
|
+
'@type': 'type.googleapis.com/google.rpc.RetryInfo',
|
|
80
|
+
retryDelay: '301s', // > 5 minutes
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
};
|
|
84
|
+
vi.spyOn(errorParser, 'parseGoogleApiError').mockReturnValue(apiError);
|
|
85
|
+
const result = classifyGoogleError(new Error());
|
|
86
|
+
expect(result).toBeInstanceOf(TerminalQuotaError);
|
|
87
|
+
});
|
|
88
|
+
it('should return RetryableQuotaError for short retry delays', () => {
|
|
89
|
+
const apiError = {
|
|
90
|
+
code: 429,
|
|
91
|
+
message: 'Too many requests',
|
|
92
|
+
details: [
|
|
93
|
+
{
|
|
94
|
+
'@type': 'type.googleapis.com/google.rpc.RetryInfo',
|
|
95
|
+
retryDelay: '45.123s',
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
};
|
|
99
|
+
vi.spyOn(errorParser, 'parseGoogleApiError').mockReturnValue(apiError);
|
|
100
|
+
const result = classifyGoogleError(new Error());
|
|
101
|
+
expect(result).toBeInstanceOf(RetryableQuotaError);
|
|
102
|
+
expect(result.retryDelayMs).toBe(45123);
|
|
103
|
+
});
|
|
104
|
+
it('should return RetryableQuotaError for per-minute quota violations in QuotaFailure', () => {
|
|
105
|
+
const apiError = {
|
|
106
|
+
code: 429,
|
|
107
|
+
message: 'Quota exceeded',
|
|
108
|
+
details: [
|
|
109
|
+
{
|
|
110
|
+
'@type': 'type.googleapis.com/google.rpc.QuotaFailure',
|
|
111
|
+
violations: [
|
|
112
|
+
{
|
|
113
|
+
subject: 'user',
|
|
114
|
+
description: 'per minute limit',
|
|
115
|
+
quotaId: 'RequestsPerMinute-limit',
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
};
|
|
121
|
+
vi.spyOn(errorParser, 'parseGoogleApiError').mockReturnValue(apiError);
|
|
122
|
+
const result = classifyGoogleError(new Error());
|
|
123
|
+
expect(result).toBeInstanceOf(RetryableQuotaError);
|
|
124
|
+
expect(result.retryDelayMs).toBe(60000);
|
|
125
|
+
});
|
|
126
|
+
it('should return RetryableQuotaError for per-minute quota violations in ErrorInfo', () => {
|
|
127
|
+
const apiError = {
|
|
128
|
+
code: 429,
|
|
129
|
+
message: 'Quota exceeded',
|
|
130
|
+
details: [
|
|
131
|
+
{
|
|
132
|
+
'@type': 'type.googleapis.com/google.rpc.ErrorInfo',
|
|
133
|
+
reason: 'QUOTA_EXCEEDED',
|
|
134
|
+
domain: 'googleapis.com',
|
|
135
|
+
metadata: {
|
|
136
|
+
quota_limit: 'RequestsPerMinute_PerProject_PerUser',
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
};
|
|
141
|
+
vi.spyOn(errorParser, 'parseGoogleApiError').mockReturnValue(apiError);
|
|
142
|
+
const result = classifyGoogleError(new Error());
|
|
143
|
+
expect(result).toBeInstanceOf(RetryableQuotaError);
|
|
144
|
+
expect(result.retryDelayMs).toBe(60000);
|
|
145
|
+
});
|
|
146
|
+
it('should prioritize daily limit over retry info', () => {
|
|
147
|
+
const apiError = {
|
|
148
|
+
code: 429,
|
|
149
|
+
message: 'Quota exceeded',
|
|
150
|
+
details: [
|
|
151
|
+
{
|
|
152
|
+
'@type': 'type.googleapis.com/google.rpc.QuotaFailure',
|
|
153
|
+
violations: [
|
|
154
|
+
{
|
|
155
|
+
subject: 'user',
|
|
156
|
+
description: 'daily limit',
|
|
157
|
+
quotaId: 'RequestsPerDay-limit',
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
'@type': 'type.googleapis.com/google.rpc.RetryInfo',
|
|
163
|
+
retryDelay: '10s',
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
};
|
|
167
|
+
vi.spyOn(errorParser, 'parseGoogleApiError').mockReturnValue(apiError);
|
|
168
|
+
const result = classifyGoogleError(new Error());
|
|
169
|
+
expect(result).toBeInstanceOf(TerminalQuotaError);
|
|
170
|
+
});
|
|
171
|
+
it('should return original error for 429 without specific details', () => {
|
|
172
|
+
const apiError = {
|
|
173
|
+
code: 429,
|
|
174
|
+
message: 'Too many requests',
|
|
175
|
+
details: [
|
|
176
|
+
{
|
|
177
|
+
'@type': 'type.googleapis.com/google.rpc.DebugInfo',
|
|
178
|
+
detail: 'some debug info',
|
|
179
|
+
stackEntries: [],
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
};
|
|
183
|
+
vi.spyOn(errorParser, 'parseGoogleApiError').mockReturnValue(apiError);
|
|
184
|
+
const originalError = new Error();
|
|
185
|
+
const result = classifyGoogleError(originalError);
|
|
186
|
+
expect(result).toBe(originalError);
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
//# sourceMappingURL=googleQuotaErrors.test.js.map
|
|
@@ -0,0 +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14,5 +14,3 @@ export interface ApiError {
|
|
|
14
14
|
}
|
|
15
15
|
export declare function isApiError(error: unknown): error is ApiError;
|
|
16
16
|
export declare function isStructuredError(error: unknown): error is StructuredError;
|
|
17
|
-
export declare function isProQuotaExceededError(error: unknown): boolean;
|
|
18
|
-
export declare function isGenericQuotaExceededError(error: unknown): boolean;
|
|
@@ -16,50 +16,4 @@ export function isStructuredError(error) {
|
|
|
16
16
|
'message' in error &&
|
|
17
17
|
typeof error.message === 'string');
|
|
18
18
|
}
|
|
19
|
-
export function isProQuotaExceededError(error) {
|
|
20
|
-
// Check for Pro quota exceeded errors by looking for the specific pattern
|
|
21
|
-
// This will match patterns like:
|
|
22
|
-
// - "Quota exceeded for quota metric 'Gemini 2.5 Pro Requests'"
|
|
23
|
-
// - "Quota exceeded for quota metric 'Gemini 2.5-preview Pro Requests'"
|
|
24
|
-
// We use string methods instead of regex to avoid ReDoS vulnerabilities
|
|
25
|
-
const checkMessage = (message) => message.includes("Quota exceeded for quota metric 'Gemini") &&
|
|
26
|
-
message.includes("Pro Requests'");
|
|
27
|
-
if (typeof error === 'string') {
|
|
28
|
-
return checkMessage(error);
|
|
29
|
-
}
|
|
30
|
-
if (isStructuredError(error)) {
|
|
31
|
-
return checkMessage(error.message);
|
|
32
|
-
}
|
|
33
|
-
if (isApiError(error)) {
|
|
34
|
-
return checkMessage(error.error.message);
|
|
35
|
-
}
|
|
36
|
-
// Check if it's a Gaxios error with response data
|
|
37
|
-
if (error && typeof error === 'object' && 'response' in error) {
|
|
38
|
-
const gaxiosError = error;
|
|
39
|
-
if (gaxiosError.response && gaxiosError.response.data) {
|
|
40
|
-
if (typeof gaxiosError.response.data === 'string') {
|
|
41
|
-
return checkMessage(gaxiosError.response.data);
|
|
42
|
-
}
|
|
43
|
-
if (typeof gaxiosError.response.data === 'object' &&
|
|
44
|
-
gaxiosError.response.data !== null &&
|
|
45
|
-
'error' in gaxiosError.response.data) {
|
|
46
|
-
const errorData = gaxiosError.response.data;
|
|
47
|
-
return checkMessage(errorData.error?.message || '');
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
export function isGenericQuotaExceededError(error) {
|
|
54
|
-
if (typeof error === 'string') {
|
|
55
|
-
return error.includes('Quota exceeded for quota metric');
|
|
56
|
-
}
|
|
57
|
-
if (isStructuredError(error)) {
|
|
58
|
-
return error.message.includes('Quota exceeded for quota metric');
|
|
59
|
-
}
|
|
60
|
-
if (isApiError(error)) {
|
|
61
|
-
return error.error.message.includes('Quota exceeded for quota metric');
|
|
62
|
-
}
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
19
|
//# sourceMappingURL=quotaErrorDetection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quotaErrorDetection.js","sourceRoot":"","sources":["../../../src/utils/quotaErrorDetection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,OAAO,IAAI,KAAK;QAChB,OAAQ,KAAkB,CAAC,KAAK,KAAK,QAAQ;QAC7C,SAAS,IAAK,KAAkB,CAAC,KAAK,CACvC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,SAAS,IAAI,KAAK;QAClB,OAAQ,KAAyB,CAAC,OAAO,KAAK,QAAQ,CACvD,CAAC;AACJ,CAAC
|
|
1
|
+
{"version":3,"file":"quotaErrorDetection.js","sourceRoot":"","sources":["../../../src/utils/quotaErrorDetection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,OAAO,IAAI,KAAK;QAChB,OAAQ,KAAkB,CAAC,KAAK,KAAK,QAAQ;QAC7C,SAAS,IAAK,KAAkB,CAAC,KAAK,CACvC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,SAAS,IAAI,KAAK;QAClB,OAAQ,KAAyB,CAAC,OAAO,KAAK,QAAQ,CACvD,CAAC;AACJ,CAAC"}
|
package/dist/src/utils/retry.js
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { ApiError } from '@google/genai';
|
|
6
7
|
import { AuthType } from '../core/contentGenerator.js';
|
|
7
|
-
import {
|
|
8
|
+
import { classifyGoogleError, RetryableQuotaError, TerminalQuotaError, } from './googleQuotaErrors.js';
|
|
8
9
|
const DEFAULT_RETRY_OPTIONS = {
|
|
9
|
-
maxAttempts:
|
|
10
|
+
maxAttempts: 10,
|
|
10
11
|
initialDelayMs: 5000,
|
|
11
12
|
maxDelayMs: 30000, // 30 seconds
|
|
12
13
|
shouldRetryOnError: defaultShouldRetry,
|
|
@@ -18,18 +19,17 @@ const DEFAULT_RETRY_OPTIONS = {
|
|
|
18
19
|
* @returns True if the error is a transient error, false otherwise.
|
|
19
20
|
*/
|
|
20
21
|
function defaultShouldRetry(error) {
|
|
21
|
-
//
|
|
22
|
-
if (error
|
|
23
|
-
|
|
24
|
-
if (status ===
|
|
25
|
-
return
|
|
26
|
-
|
|
22
|
+
// Priority check for ApiError
|
|
23
|
+
if (error instanceof ApiError) {
|
|
24
|
+
// Explicitly do not retry 400 (Bad Request)
|
|
25
|
+
if (error.status === 400)
|
|
26
|
+
return false;
|
|
27
|
+
return error.status === 429 || (error.status >= 500 && error.status < 600);
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return true;
|
|
29
|
+
// Check for status using helper (handles other error shapes)
|
|
30
|
+
const status = getErrorStatus(error);
|
|
31
|
+
if (status !== undefined) {
|
|
32
|
+
return status === 429 || (status >= 500 && status < 600);
|
|
33
33
|
}
|
|
34
34
|
return false;
|
|
35
35
|
}
|
|
@@ -61,7 +61,6 @@ export async function retryWithBackoff(fn, options) {
|
|
|
61
61
|
};
|
|
62
62
|
let attempt = 0;
|
|
63
63
|
let currentDelay = initialDelayMs;
|
|
64
|
-
let consecutive429Count = 0;
|
|
65
64
|
while (attempt < maxAttempts) {
|
|
66
65
|
attempt++;
|
|
67
66
|
try {
|
|
@@ -77,114 +76,44 @@ export async function retryWithBackoff(fn, options) {
|
|
|
77
76
|
return result;
|
|
78
77
|
}
|
|
79
78
|
catch (error) {
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
attempt = 0;
|
|
91
|
-
consecutive429Count = 0;
|
|
92
|
-
currentDelay = initialDelayMs;
|
|
93
|
-
// With the model updated, we continue to the next attempt
|
|
94
|
-
continue;
|
|
79
|
+
const classifiedError = classifyGoogleError(error);
|
|
80
|
+
if (classifiedError instanceof TerminalQuotaError) {
|
|
81
|
+
if (onPersistent429 && authType === AuthType.LOGIN_WITH_GOOGLE) {
|
|
82
|
+
try {
|
|
83
|
+
const fallbackModel = await onPersistent429(authType, classifiedError);
|
|
84
|
+
if (fallbackModel) {
|
|
85
|
+
attempt = 0; // Reset attempts and retry with the new model.
|
|
86
|
+
currentDelay = initialDelayMs;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
95
89
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
throw error;
|
|
90
|
+
catch (fallbackError) {
|
|
91
|
+
console.warn('Model fallback failed:', fallbackError);
|
|
99
92
|
}
|
|
100
93
|
}
|
|
101
|
-
|
|
102
|
-
// If fallback fails, continue with original error
|
|
103
|
-
console.warn('Fallback to Flash model failed:', fallbackError);
|
|
104
|
-
}
|
|
94
|
+
throw classifiedError; // Throw if no fallback or fallback failed.
|
|
105
95
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
!isProQuotaExceededError(error) &&
|
|
110
|
-
isGenericQuotaExceededError(error) &&
|
|
111
|
-
onPersistent429) {
|
|
112
|
-
try {
|
|
113
|
-
const fallbackModel = await onPersistent429(authType, error);
|
|
114
|
-
if (fallbackModel !== false && fallbackModel !== null) {
|
|
115
|
-
// Reset attempt counter and try with new model
|
|
116
|
-
attempt = 0;
|
|
117
|
-
consecutive429Count = 0;
|
|
118
|
-
currentDelay = initialDelayMs;
|
|
119
|
-
// With the model updated, we continue to the next attempt
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
// Fallback handler returned null/false, meaning don't continue - stop retry process
|
|
124
|
-
throw error;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
catch (fallbackError) {
|
|
128
|
-
// If fallback fails, continue with original error
|
|
129
|
-
console.warn('Fallback to Flash model failed:', fallbackError);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
// Track consecutive 429 errors
|
|
133
|
-
if (errorStatus === 429) {
|
|
134
|
-
consecutive429Count++;
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
consecutive429Count = 0;
|
|
138
|
-
}
|
|
139
|
-
// If we have persistent 429s and a fallback callback for OAuth
|
|
140
|
-
if (consecutive429Count >= 2 &&
|
|
141
|
-
onPersistent429 &&
|
|
142
|
-
authType === AuthType.LOGIN_WITH_GOOGLE) {
|
|
143
|
-
try {
|
|
144
|
-
const fallbackModel = await onPersistent429(authType, error);
|
|
145
|
-
if (fallbackModel !== false && fallbackModel !== null) {
|
|
146
|
-
// Reset attempt counter and try with new model
|
|
147
|
-
attempt = 0;
|
|
148
|
-
consecutive429Count = 0;
|
|
149
|
-
currentDelay = initialDelayMs;
|
|
150
|
-
// With the model updated, we continue to the next attempt
|
|
151
|
-
continue;
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
// Fallback handler returned null/false, meaning don't continue - stop retry process
|
|
155
|
-
throw error;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
catch (fallbackError) {
|
|
159
|
-
// If fallback fails, continue with original error
|
|
160
|
-
console.warn('Fallback to Flash model failed:', fallbackError);
|
|
96
|
+
if (classifiedError instanceof RetryableQuotaError) {
|
|
97
|
+
if (attempt >= maxAttempts) {
|
|
98
|
+
throw classifiedError;
|
|
161
99
|
}
|
|
100
|
+
console.warn(`Attempt ${attempt} failed: ${classifiedError.message}. Retrying after ${classifiedError.retryDelayMs}ms...`);
|
|
101
|
+
await delay(classifiedError.retryDelayMs);
|
|
102
|
+
continue;
|
|
162
103
|
}
|
|
163
|
-
//
|
|
104
|
+
// Generic retry logic for other errors
|
|
164
105
|
if (attempt >= maxAttempts || !shouldRetryOnError(error)) {
|
|
165
106
|
throw error;
|
|
166
107
|
}
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
// Fall back to exponential backoff with jitter
|
|
177
|
-
logRetryAttempt(attempt, error, errorStatus);
|
|
178
|
-
// Add jitter: +/- 30% of currentDelay
|
|
179
|
-
const jitter = currentDelay * 0.3 * (Math.random() * 2 - 1);
|
|
180
|
-
const delayWithJitter = Math.max(0, currentDelay + jitter);
|
|
181
|
-
await delay(delayWithJitter);
|
|
182
|
-
currentDelay = Math.min(maxDelayMs, currentDelay * 2);
|
|
183
|
-
}
|
|
108
|
+
const errorStatus = getErrorStatus(error);
|
|
109
|
+
logRetryAttempt(attempt, error, errorStatus);
|
|
110
|
+
// Exponential backoff with jitter for non-quota errors
|
|
111
|
+
const jitter = currentDelay * 0.3 * (Math.random() * 2 - 1);
|
|
112
|
+
const delayWithJitter = Math.max(0, currentDelay + jitter);
|
|
113
|
+
await delay(delayWithJitter);
|
|
114
|
+
currentDelay = Math.min(maxDelayMs, currentDelay * 2);
|
|
184
115
|
}
|
|
185
116
|
}
|
|
186
|
-
// This line should theoretically be unreachable due to the throw in the catch block.
|
|
187
|
-
// Added for type safety and to satisfy the compiler that a promise is always returned.
|
|
188
117
|
throw new Error('Retry attempts exhausted');
|
|
189
118
|
}
|
|
190
119
|
/**
|
|
@@ -209,52 +138,6 @@ export function getErrorStatus(error) {
|
|
|
209
138
|
}
|
|
210
139
|
return undefined;
|
|
211
140
|
}
|
|
212
|
-
/**
|
|
213
|
-
* Extracts the Retry-After delay from an error object's headers.
|
|
214
|
-
* @param error The error object.
|
|
215
|
-
* @returns The delay in milliseconds, or 0 if not found or invalid.
|
|
216
|
-
*/
|
|
217
|
-
function getRetryAfterDelayMs(error) {
|
|
218
|
-
if (typeof error === 'object' && error !== null) {
|
|
219
|
-
// Check for error.response.headers (common in axios errors)
|
|
220
|
-
if ('response' in error &&
|
|
221
|
-
typeof error.response === 'object' &&
|
|
222
|
-
error.response !== null) {
|
|
223
|
-
const response = error.response;
|
|
224
|
-
if ('headers' in response &&
|
|
225
|
-
typeof response.headers === 'object' &&
|
|
226
|
-
response.headers !== null) {
|
|
227
|
-
const headers = response.headers;
|
|
228
|
-
const retryAfterHeader = headers['retry-after'];
|
|
229
|
-
if (typeof retryAfterHeader === 'string') {
|
|
230
|
-
const retryAfterSeconds = parseInt(retryAfterHeader, 10);
|
|
231
|
-
if (!isNaN(retryAfterSeconds)) {
|
|
232
|
-
return retryAfterSeconds * 1000;
|
|
233
|
-
}
|
|
234
|
-
// It might be an HTTP date
|
|
235
|
-
const retryAfterDate = new Date(retryAfterHeader);
|
|
236
|
-
if (!isNaN(retryAfterDate.getTime())) {
|
|
237
|
-
return Math.max(0, retryAfterDate.getTime() - Date.now());
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
return 0;
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Determines the delay duration based on the error, prioritizing Retry-After header.
|
|
247
|
-
* @param error The error object.
|
|
248
|
-
* @returns An object containing the delay duration in milliseconds and the error status.
|
|
249
|
-
*/
|
|
250
|
-
function getDelayDurationAndStatus(error) {
|
|
251
|
-
const errorStatus = getErrorStatus(error);
|
|
252
|
-
let delayDurationMs = 0;
|
|
253
|
-
if (errorStatus === 429) {
|
|
254
|
-
delayDurationMs = getRetryAfterDelayMs(error);
|
|
255
|
-
}
|
|
256
|
-
return { delayDurationMs, errorStatus };
|
|
257
|
-
}
|
|
258
141
|
/**
|
|
259
142
|
* Logs a message for a retry attempt when using exponential backoff.
|
|
260
143
|
* @param attempt The current attempt number.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../../../src/utils/retry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../../../src/utils/retry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAmBhC,MAAM,qBAAqB,GAAiB;IAC1C,WAAW,EAAE,EAAE;IACf,cAAc,EAAE,IAAI;IACpB,UAAU,EAAE,KAAK,EAAE,aAAa;IAChC,kBAAkB,EAAE,kBAAkB;CACvC,CAAC;AAEF;;;;;GAKG;AACH,SAAS,kBAAkB,CAAC,KAAsB;IAChD,8BAA8B;IAC9B,IA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