diff --git a/extensions/google-gemini-cli-auth/oauth.test.ts b/extensions/google-gemini-cli-auth/oauth.test.ts index afc0971b16e..cec301a13e7 100644 --- a/extensions/google-gemini-cli-auth/oauth.test.ts +++ b/extensions/google-gemini-cli-auth/oauth.test.ts @@ -239,14 +239,15 @@ describe("loginGeminiCliOAuth", () => { "GOOGLE_CLOUD_PROJECT_ID", ] as const; - function getExpectedPlatform(): "WINDOWS" | "MACOS" | "LINUX" { + function getExpectedPlatform(): "WINDOWS" | "MACOS" | "LINUX" | "PLATFORM_UNSPECIFIED" { if (process.platform === "win32") { return "WINDOWS"; } - if (process.platform === "linux") { - return "LINUX"; + if (process.platform === "darwin") { + return "MACOS"; } - return "MACOS"; + // Matches updated resolvePlatform() which uses PLATFORM_UNSPECIFIED for Linux + return "PLATFORM_UNSPECIFIED"; } function getRequestUrl(input: string | URL | Request): string { diff --git a/extensions/google-gemini-cli-auth/oauth.ts b/extensions/google-gemini-cli-auth/oauth.ts index 7e2280b9c9f..4f8f2938e47 100644 --- a/extensions/google-gemini-cli-auth/oauth.ts +++ b/extensions/google-gemini-cli-auth/oauth.ts @@ -224,14 +224,16 @@ function generatePkce(): { verifier: string; challenge: string } { return { verifier, challenge }; } -function resolvePlatform(): "WINDOWS" | "MACOS" | "LINUX" { +function resolvePlatform(): "WINDOWS" | "MACOS" | "LINUX" | "PLATFORM_UNSPECIFIED" { if (process.platform === "win32") { return "WINDOWS"; } - if (process.platform === "linux") { - return "LINUX"; + if (process.platform === "darwin") { + return "MACOS"; } - return "MACOS"; + // Google's loadCodeAssist API rejects "LINUX" as an invalid Platform enum value. + // Use "PLATFORM_UNSPECIFIED" for Linux and other platforms to match the pi-ai runtime. + return "PLATFORM_UNSPECIFIED"; } async function fetchWithTimeout(