From 80b4dde3507db28b86e416a8b6502be091f9bc72 Mon Sep 17 00:00:00 2001 From: Bryan Morgan Date: Sun, 22 Feb 2026 10:09:07 -0500 Subject: [PATCH] feat(core): increase thought signature retry resilience MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit maxAttempts 2→3, initialDelayMs 500→1000 for "thought signature chunk" errors to better handle transient API flakes. --- packages/core/src/core/geminiChat.test.ts | 6 +++--- packages/core/src/core/geminiChat.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/core/src/core/geminiChat.test.ts b/packages/core/src/core/geminiChat.test.ts index 8a6b3f8bc8..9796e85ccd 100644 --- a/packages/core/src/core/geminiChat.test.ts +++ b/packages/core/src/core/geminiChat.test.ts @@ -1315,11 +1315,11 @@ describe('GeminiChat', () => { } }).rejects.toThrow(InvalidStreamError); - // Should be called 2 times (initial + 1 retry) + // Should be called 3 times (initial + 2 retries) expect(mockContentGenerator.generateContentStream).toHaveBeenCalledTimes( - 2, + 3, ); - expect(mockLogContentRetry).toHaveBeenCalledTimes(1); + expect(mockLogContentRetry).toHaveBeenCalledTimes(2); expect(mockLogContentRetryFailure).toHaveBeenCalledTimes(1); // History should still contain the user message. diff --git a/packages/core/src/core/geminiChat.ts b/packages/core/src/core/geminiChat.ts index c9cb6cf8f2..5300bfdfbb 100644 --- a/packages/core/src/core/geminiChat.ts +++ b/packages/core/src/core/geminiChat.ts @@ -86,8 +86,8 @@ interface ContentRetryOptions { } const INVALID_CONTENT_RETRY_OPTIONS: ContentRetryOptions = { - maxAttempts: 2, // 1 initial call + 1 retry - initialDelayMs: 500, + maxAttempts: 3, // 1 initial call + 2 retries + initialDelayMs: 1000, }; export const SYNTHETIC_THOUGHT_SIGNATURE = 'skip_thought_signature_validator';