diff options
| author | Bryan Morgan <[email protected]> | 2025-07-09 13:55:56 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-09 17:55:56 +0000 |
| commit | 8a6509ffeba271a8e7ccb83066a9a31a5d72a647 (patch) | |
| tree | e67893a06d291f074e69f7f14d4f22ccbe3a6550 /packages/cli/src/ui/hooks/useGeminiStream.ts | |
| parent | 01e756481f359a28aca0d5220f853daec8d25ed4 (diff) | |
Remove auto-execution on Flash in the event of a 429/Quota failover (#3662)
Co-authored-by: Jenna Inouye <[email protected]>
Diffstat (limited to 'packages/cli/src/ui/hooks/useGeminiStream.ts')
| -rw-r--r-- | packages/cli/src/ui/hooks/useGeminiStream.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/packages/cli/src/ui/hooks/useGeminiStream.ts b/packages/cli/src/ui/hooks/useGeminiStream.ts index 550cab86..d32c9ffa 100644 --- a/packages/cli/src/ui/hooks/useGeminiStream.ts +++ b/packages/cli/src/ui/hooks/useGeminiStream.ts @@ -90,6 +90,8 @@ export const useGeminiStream = ( getPreferredEditor: () => EditorType | undefined, onAuthError: () => void, performMemoryRefresh: () => Promise<void>, + modelSwitchedFromQuotaError: boolean, + setModelSwitchedFromQuotaError: React.Dispatch<React.SetStateAction<boolean>>, ) => { const [initError, setInitError] = useState<string | null>(null); const abortControllerRef = useRef<AbortController | null>(null); @@ -494,6 +496,12 @@ export const useGeminiStream = ( const userMessageTimestamp = Date.now(); setShowHelp(false); + // Reset quota error flag when starting a new query (not a continuation) + if (!options?.isContinuation) { + setModelSwitchedFromQuotaError(false); + config.setQuotaErrorOccurred(false); + } + abortControllerRef.current = new AbortController(); const abortSignal = abortControllerRef.current.signal; turnCancelledRef.current = false; @@ -552,6 +560,7 @@ export const useGeminiStream = ( [ streamingState, setShowHelp, + setModelSwitchedFromQuotaError, prepareQueryForGemini, processGeminiStreamEvents, pendingHistoryItemRef, @@ -668,6 +677,12 @@ export const useGeminiStream = ( ); markToolsAsSubmitted(callIdsToMarkAsSubmitted); + + // Don't continue if model was switched due to quota error + if (modelSwitchedFromQuotaError) { + return; + } + submitQuery(mergePartListUnions(responsesToSend), { isContinuation: true, }); @@ -678,6 +693,7 @@ export const useGeminiStream = ( markToolsAsSubmitted, geminiClient, performMemoryRefresh, + modelSwitchedFromQuotaError, ], ); |
