From 40747ebac94ccfa23986396b6f65db41d8e9561b Mon Sep 17 00:00:00 2001 From: Rizel Scarlett Date: Fri, 9 Jan 2026 18:44:31 -0500 Subject: [PATCH] Restore task completion notification (#6427) --- ui/desktop/src/hooks/useChatStream.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ui/desktop/src/hooks/useChatStream.ts b/ui/desktop/src/hooks/useChatStream.ts index 70e9fcbf..784be8eb 100644 --- a/ui/desktop/src/hooks/useChatStream.ts +++ b/ui/desktop/src/hooks/useChatStream.ts @@ -170,6 +170,7 @@ export function useChatStream({ }); const [notifications, setNotifications] = useState([]); const abortControllerRef = useRef(null); + const lastInteractionTimeRef = useRef(Date.now()); useEffect(() => { if (session) { @@ -192,6 +193,14 @@ export function useChatStream({ setSessionLoadError(error); } + const timeSinceLastInteraction = Date.now() - lastInteractionTimeRef.current; + if (!error && timeSinceLastInteraction > 60000) { + window.electron.showNotification({ + title: 'goose finished the task.', + body: 'Click here to expand.', + }); + } + const isNewSession = sessionId && sessionId.match(/^\d{8}_\d{6}$/); if (isNewSession) { console.log( @@ -294,6 +303,8 @@ export function useChatStream({ return; } + lastInteractionTimeRef.current = Date.now(); + // Emit session-created event for first message in a new session if (!hasExistingMessages && hasNewMessage) { window.dispatchEvent(new CustomEvent('session-created')); @@ -352,6 +363,8 @@ export function useChatStream({ return; } + lastInteractionTimeRef.current = Date.now(); + const responseMessage = createElicitationResponseMessage(elicitationId, userData); const currentMessages = [...messagesRef.current, responseMessage]; @@ -431,6 +444,7 @@ export function useChatStream({ const stopStreaming = useCallback(() => { abortControllerRef.current?.abort(); setChatState(ChatState.Idle); + lastInteractionTimeRef.current = Date.now(); }, []); const onMessageUpdate = useCallback(