summaryrefslogtreecommitdiff
path: root/packages/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/core/src')
-rw-r--r--packages/core/src/code_assist/codeAssist.ts5
-rw-r--r--packages/core/src/core/client.ts5
-rw-r--r--packages/core/src/core/contentGenerator.ts14
-rw-r--r--packages/core/src/core/geminiChat.ts5
-rw-r--r--packages/core/src/utils/retry.test.ts29
-rw-r--r--packages/core/src/utils/retry.ts3
6 files changed, 5 insertions, 56 deletions
diff --git a/packages/core/src/code_assist/codeAssist.ts b/packages/core/src/code_assist/codeAssist.ts
index 1ceb818b..8a3c6939 100644
--- a/packages/core/src/code_assist/codeAssist.ts
+++ b/packages/core/src/code_assist/codeAssist.ts
@@ -13,10 +13,7 @@ export async function createCodeAssistContentGenerator(
httpOptions: HttpOptions,
authType: AuthType,
): Promise<ContentGenerator> {
- if (
- authType === AuthType.LOGIN_WITH_GOOGLE_ENTERPRISE ||
- authType === AuthType.LOGIN_WITH_GOOGLE_PERSONAL
- ) {
+ if (authType === AuthType.LOGIN_WITH_GOOGLE_PERSONAL) {
const authClient = await getOauthClient();
const projectId = await setupUser(authClient);
return new CodeAssistServer(authClient, projectId, httpOptions);
diff --git a/packages/core/src/core/client.ts b/packages/core/src/core/client.ts
index eb94baed..6170f319 100644
--- a/packages/core/src/core/client.ts
+++ b/packages/core/src/core/client.ts
@@ -505,10 +505,7 @@ export class GeminiClient {
*/
private async handleFlashFallback(authType?: string): Promise<string | null> {
// Only handle fallback for OAuth users
- if (
- authType !== AuthType.LOGIN_WITH_GOOGLE_PERSONAL &&
- authType !== AuthType.LOGIN_WITH_GOOGLE_ENTERPRISE
- ) {
+ if (authType !== AuthType.LOGIN_WITH_GOOGLE_PERSONAL) {
return null;
}
diff --git a/packages/core/src/core/contentGenerator.ts b/packages/core/src/core/contentGenerator.ts
index c708dad4..7021adc2 100644
--- a/packages/core/src/core/contentGenerator.ts
+++ b/packages/core/src/core/contentGenerator.ts
@@ -36,7 +36,6 @@ export interface ContentGenerator {
export enum AuthType {
LOGIN_WITH_GOOGLE_PERSONAL = 'oauth-personal',
- LOGIN_WITH_GOOGLE_ENTERPRISE = 'oauth-enterprise',
USE_GEMINI = 'gemini-api-key',
USE_VERTEX_AI = 'vertex-ai',
}
@@ -71,14 +70,6 @@ export async function createContentGeneratorConfig(
return contentGeneratorConfig;
}
- // if its enterprise make sure we have a cloud project
- if (
- authType === AuthType.LOGIN_WITH_GOOGLE_ENTERPRISE &&
- !!googleCloudProject
- ) {
- return contentGeneratorConfig;
- }
-
//
if (authType === AuthType.USE_GEMINI && geminiApiKey) {
contentGeneratorConfig.apiKey = geminiApiKey;
@@ -118,10 +109,7 @@ export async function createContentGenerator(
'User-Agent': `GeminiCLI/${version} (${process.platform}; ${process.arch})`,
},
};
- if (
- config.authType === AuthType.LOGIN_WITH_GOOGLE_PERSONAL ||
- config.authType === AuthType.LOGIN_WITH_GOOGLE_ENTERPRISE
- ) {
+ if (config.authType === AuthType.LOGIN_WITH_GOOGLE_PERSONAL) {
return createCodeAssistContentGenerator(httpOptions, config.authType);
}
diff --git a/packages/core/src/core/geminiChat.ts b/packages/core/src/core/geminiChat.ts
index 4db13852..ce5accf4 100644
--- a/packages/core/src/core/geminiChat.ts
+++ b/packages/core/src/core/geminiChat.ts
@@ -188,10 +188,7 @@ export class GeminiChat {
*/
private async handleFlashFallback(authType?: string): Promise<string | null> {
// Only handle fallback for OAuth users
- if (
- authType !== AuthType.LOGIN_WITH_GOOGLE_PERSONAL &&
- authType !== AuthType.LOGIN_WITH_GOOGLE_ENTERPRISE
- ) {
+ if (authType !== AuthType.LOGIN_WITH_GOOGLE_PERSONAL) {
return null;
}
diff --git a/packages/core/src/utils/retry.test.ts b/packages/core/src/utils/retry.test.ts
index 031c0991..1988c02a 100644
--- a/packages/core/src/utils/retry.test.ts
+++ b/packages/core/src/utils/retry.test.ts
@@ -275,35 +275,6 @@ describe('retryWithBackoff', () => {
expect(mockFn).toHaveBeenCalledTimes(4); // 3 initial attempts + 1 after fallback
});
- it('should trigger fallback for OAuth enterprise users after persistent 429 errors', async () => {
- const fallbackCallback = vi.fn().mockResolvedValue('gemini-2.5-flash');
-
- let fallbackOccurred = false;
- const mockFn = vi.fn().mockImplementation(async () => {
- if (!fallbackOccurred) {
- const error: HttpError = new Error('Rate limit exceeded');
- error.status = 429;
- throw error;
- }
- return 'success';
- });
-
- const promise = retryWithBackoff(mockFn, {
- maxAttempts: 3,
- initialDelayMs: 100,
- onPersistent429: async (authType?: string) => {
- fallbackOccurred = true;
- return await fallbackCallback(authType);
- },
- authType: 'oauth-enterprise',
- });
-
- await vi.runAllTimersAsync();
-
- await expect(promise).resolves.toBe('success');
- expect(fallbackCallback).toHaveBeenCalledWith('oauth-enterprise');
- });
-
it('should NOT trigger fallback for API key users', async () => {
const fallbackCallback = vi.fn();
diff --git a/packages/core/src/utils/retry.ts b/packages/core/src/utils/retry.ts
index 851db0e7..ebe18510 100644
--- a/packages/core/src/utils/retry.ts
+++ b/packages/core/src/utils/retry.ts
@@ -99,8 +99,7 @@ export async function retryWithBackoff<T>(
if (
consecutive429Count >= 2 &&
onPersistent429 &&
- (authType === AuthType.LOGIN_WITH_GOOGLE_PERSONAL ||
- authType === AuthType.LOGIN_WITH_GOOGLE_ENTERPRISE)
+ authType === AuthType.LOGIN_WITH_GOOGLE_PERSONAL
) {
try {
const fallbackModel = await onPersistent429(authType);