fix(quality): Retry invalid stream only 1 time (#9169)

This commit is contained in:
Sandy Tao
2025-09-22 17:15:55 -07:00
committed by GitHub
parent 47948e3712
commit 712dc245ac
2 changed files with 4 additions and 4 deletions

View File

@@ -891,11 +891,11 @@ describe('GeminiChat', () => {
}
}).rejects.toThrow(InvalidStreamError);
// Should be called 3 times (initial + 2 retries)
// Should be called 2 times (initial + 1 retry)
expect(mockContentGenerator.generateContentStream).toHaveBeenCalledTimes(
3,
2,
);
expect(mockLogContentRetry).toHaveBeenCalledTimes(2);
expect(mockLogContentRetry).toHaveBeenCalledTimes(1);
expect(mockLogContentRetryFailure).toHaveBeenCalledTimes(1);
// History should be clean, as if the failed turn never happened.

View File

@@ -63,7 +63,7 @@ interface ContentRetryOptions {
}
const INVALID_CONTENT_RETRY_OPTIONS: ContentRetryOptions = {
maxAttempts: 3, // 1 initial call + 2 retries
maxAttempts: 2, // 1 initial call + 1 retry
initialDelayMs: 500,
};