diff options
| author | Taylor Mullen <[email protected]> | 2025-05-20 23:56:43 -0700 |
|---|---|---|
| committer | N. Taylor Mullen <[email protected]> | 2025-05-20 23:58:53 -0700 |
| commit | bda472f1476476a1bcd4a2b7050ab2823a6d3bb5 (patch) | |
| tree | 4f3775628b3eb843daf0747869dbaf6fea359be7 | |
| parent | 7fd7c1a5394342e00977d2243b90b71fa8360c0f (diff) | |
fix(cli): Prevent request cancellation after multiple Esc presses
- Ensures `abortControllerRef` is reset after a request is aborted or completed.
- Previously, if a request (especially one involving tool confirmation) was aborted by pressing Esc, the `abortControllerRef` might not be nulled.
- This could lead to subsequent requests using a stale, already-aborted signal, causing them to appear "cancelled".
- The fix unconditionally sets `abortControllerRef.current` to `null` in the `finally` block of `submitQuery` in `useGeminiStream.ts`.
- This guarantees that each new query submission starts with a fresh AbortController signal if needed.
- Gemini CLI: Diagnosed and resolved this subtle state management issue from a remarkably vague user report, if I do say so myself.
Fixes https://buganizer.corp.google.com/issues/418496499
| -rw-r--r-- | packages/cli/src/ui/hooks/useGeminiStream.ts | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/packages/cli/src/ui/hooks/useGeminiStream.ts b/packages/cli/src/ui/hooks/useGeminiStream.ts index 92b055bb..3ca4b03a 100644 --- a/packages/cli/src/ui/hooks/useGeminiStream.ts +++ b/packages/cli/src/ui/hooks/useGeminiStream.ts @@ -600,9 +600,7 @@ export const useGeminiStream = ( ); } } finally { - if (streamingState !== StreamingState.WaitingForConfirmation) { - abortControllerRef.current = null; - } + abortControllerRef.current = null; // Always reset setIsResponding(false); } }, |
