From 05d29d68aae3a2e8db4b03a2d47cbb89178fd9be Mon Sep 17 00:00:00 2001 From: Keith Guerin Date: Mon, 23 Mar 2026 23:13:30 -0700 Subject: [PATCH] fix(ci): address final test and build issues after rebase --- .../cli/src/ui/hooks/useGeminiStream.test.tsx | 7 +++- packages/cli/src/ui/hooks/useGeminiStream.ts | 38 +++---------------- 2 files changed, 11 insertions(+), 34 deletions(-) diff --git a/packages/cli/src/ui/hooks/useGeminiStream.test.tsx b/packages/cli/src/ui/hooks/useGeminiStream.test.tsx index 29fd619f5f..a5ac87821b 100644 --- a/packages/cli/src/ui/hooks/useGeminiStream.test.tsx +++ b/packages/cli/src/ui/hooks/useGeminiStream.test.tsx @@ -408,6 +408,8 @@ describe('useGeminiStream', () => { toolCalls: initialToolCalls, }; + let rerenderHook: (props?: typeof initialProps) => void; + mockUseToolScheduler.mockImplementation((onComplete) => { capturedOnComplete = onComplete; return [ @@ -421,7 +423,7 @@ describe('useGeminiStream', () => { ) => { lastToolCalls = typeof updater === 'function' ? updater(lastToolCalls) : updater; - rerender({ ...initialProps, toolCalls: lastToolCalls }); + rerenderHook?.({ ...initialProps, toolCalls: lastToolCalls }); }, (signal: AbortSignal) => { mockCancelAllToolCalls(signal); @@ -445,7 +447,7 @@ describe('useGeminiStream', () => { } return tc; }); - rerender({ ...initialProps, toolCalls: lastToolCalls }); + rerenderHook?.({ ...initialProps, toolCalls: lastToolCalls }); }, 0, ]; @@ -476,6 +478,7 @@ describe('useGeminiStream', () => { initialProps, }, ); + rerenderHook = rerender; return { result, rerender, diff --git a/packages/cli/src/ui/hooks/useGeminiStream.ts b/packages/cli/src/ui/hooks/useGeminiStream.ts index 96ac4a6d72..2e20aea838 100644 --- a/packages/cli/src/ui/hooks/useGeminiStream.ts +++ b/packages/cli/src/ui/hooks/useGeminiStream.ts @@ -38,32 +38,9 @@ import { GeminiCliOperation, getPlanModeExitMessage, isBackgroundExecutionData, -<<<<<<< HEAD -<<<<<<< HEAD -======= type CompressionStatus, ->>>>>>> 12bc9cace (fix(cli): resolve merge conflicts and align with async test helpers) Kind, -<<<<<<< HEAD ACTIVATE_SKILL_TOOL_NAME, -======= - CompressionStatus, ->>>>>>> 97ff2bea4 (feat(ui): restore threshold hint and thin arrow to compression message) -} from '@google/gemini-cli-core'; -import type { - Config, - EditorType, - GeminiClient, - ServerGeminiChatCompressedEvent, - ServerGeminiContentEvent as ContentEvent, - ServerGeminiFinishedEvent, - ServerGeminiStreamEvent as GeminiEvent, - ThoughtSummary, - ToolCallRequestInfo, - ToolCallResponseInfo, - GeminiErrorEventValue, - RetryAttemptPayload, -======= type Config, type EditorType, type GeminiClient, @@ -76,7 +53,6 @@ import type { type ToolCallResponseInfo, type GeminiErrorEventValue, type RetryAttemptPayload, ->>>>>>> 17740dc2d (fix(cli): resolve merge conflicts and align with async test helpers) } from '@google/gemini-cli-core'; import { type Part, type PartListUnion, FinishReason } from '@google/genai'; import type { @@ -279,6 +255,8 @@ export const useGeminiStream = ( const [_isFirstToolInGroup, isFirstToolInGroupRef, setIsFirstToolInGroup] = useStateAndRef(true); const processedMemoryToolsRef = useRef>(new Set()); + const handleCompletedToolsRef = + useRef<(completedTools: TrackedToolCall[]) => Promise>(undefined); const { startNewPrompt, getPromptCount } = useSessionStats(); const storage = config.storage; const logger = useLogger(storage); @@ -352,7 +330,7 @@ export const useGeminiStream = ( } // Handle tool response submission immediately when tools complete - await handleCompletedTools( + await handleCompletedToolsRef.current?.( completedToolCallsFromScheduler as TrackedToolCall[], ); } @@ -1192,13 +1170,8 @@ export const useGeminiStream = ( isPending: false, beforePercentage, afterPercentage, - /* eslint-disable @typescript-eslint/no-unsafe-type-assertion */ - compressionStatus: eventValue - ? (Number( - eventValue.compressionStatus, - ) as unknown as CompressionStatus) - : null, - /* eslint-enable @typescript-eslint/no-unsafe-type-assertion */ + // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion + compressionStatus: eventValue ? ((Number(eventValue.compressionStatus) as unknown) as CompressionStatus) : null, isManual: false, thresholdPercentage: Math.round(threshold * 100), }, @@ -1949,6 +1922,7 @@ export const useGeminiStream = ( setIsResponding, ], ); + handleCompletedToolsRef.current = handleCompletedTools; const pendingHistoryItems = useMemo( () =>