From 7fe17b5dad518947e678331e92b19e5450ad8b6c Mon Sep 17 00:00:00 2001 From: gemini-cli-robot Date: Tue, 3 Feb 2026 12:21:12 -0800 Subject: [PATCH] fix(patch): cherry-pick e1bd1d2 to release/v0.27.0-preview.6-pr-18209 to patch version v0.27.0-preview.6 and create version 0.27.0-preview.7 (#18226) Co-authored-by: Sehoon Shon --- packages/core/src/core/geminiChat.ts | 8 ++++++-- packages/core/src/utils/retry.ts | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/core/src/core/geminiChat.ts b/packages/core/src/core/geminiChat.ts index bd7182fd03..e803a2632f 100644 --- a/packages/core/src/core/geminiChat.ts +++ b/packages/core/src/core/geminiChat.ts @@ -18,7 +18,11 @@ import type { } from '@google/genai'; import { toParts } from '../code_assist/converter.js'; import { createUserContent, FinishReason } from '@google/genai'; -import { retryWithBackoff, isRetryableError } from '../utils/retry.js'; +import { + retryWithBackoff, + isRetryableError, + DEFAULT_MAX_ATTEMPTS, +} from '../utils/retry.js'; import type { ValidationRequiredError } from '../utils/googleQuotaErrors.js'; import type { Config } from '../config/config.js'; import { @@ -606,7 +610,7 @@ export class GeminiChat { onRetry: (attempt, error, delayMs) => { coreEvents.emitRetryAttempt({ attempt, - maxAttempts: availabilityMaxAttempts ?? 10, + maxAttempts: availabilityMaxAttempts ?? DEFAULT_MAX_ATTEMPTS, delayMs, error: error instanceof Error ? error.message : String(error), model: lastModelToUse, diff --git a/packages/core/src/utils/retry.ts b/packages/core/src/utils/retry.ts index a0a8d48c80..f78bef5bd1 100644 --- a/packages/core/src/utils/retry.ts +++ b/packages/core/src/utils/retry.ts @@ -18,6 +18,7 @@ import { getErrorStatus, ModelNotFoundError } from './httpErrors.js'; import type { RetryAvailabilityContext } from '../availability/modelPolicy.js'; export type { RetryAvailabilityContext }; +export const DEFAULT_MAX_ATTEMPTS = 3; export interface RetryOptions { maxAttempts: number; @@ -40,7 +41,7 @@ export interface RetryOptions { } const DEFAULT_RETRY_OPTIONS: RetryOptions = { - maxAttempts: 3, + maxAttempts: DEFAULT_MAX_ATTEMPTS, initialDelayMs: 5000, maxDelayMs: 30000, // 30 seconds shouldRetryOnError: isRetryableError,