From 43d3269b3811de44d38e13289e4ecd6da10e9025 Mon Sep 17 00:00:00 2001 From: Haileyesus <118998054+blackmammoth@users.noreply.github.com> Date: Thu, 25 Jun 2026 15:54:05 +0300 Subject: [PATCH] fix(chat): notify for background permission requests Permission audio was guarded by the visible session check. Tool approvals in background sessions were therefore silent. Keep banner state session-scoped while playing the existing sound globally. --- src/components/chat/hooks/useChatRealtimeHandlers.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/components/chat/hooks/useChatRealtimeHandlers.ts b/src/components/chat/hooks/useChatRealtimeHandlers.ts index 01af4bb0..80826486 100644 --- a/src/components/chat/hooks/useChatRealtimeHandlers.ts +++ b/src/components/chat/hooks/useChatRealtimeHandlers.ts @@ -270,6 +270,10 @@ export function useChatRealtimeHandlers({ case 'permission_request': { if (!msg.requestId) break; + if (isActionablePermissionRequest({ toolName: msg.toolName })) { + void playNotificationSound(); + } + if (sid === activeViewSessionId) { const previousPendingPermissionRequests = pendingPermissionRequestsRef.current; if (!previousPendingPermissionRequests.some((request) => request.requestId === msg.requestId)) { @@ -284,13 +288,6 @@ export function useChatRealtimeHandlers({ pendingPermissionRequestsRef.current = nextPendingPermissionRequests; setPendingPermissionRequests(nextPendingPermissionRequests); - - if ( - isActionablePermissionRequest({ toolName: msg.toolName }) - && !hasActionablePermissionRequests(previousPendingPermissionRequests) - ) { - void playNotificationSound(); - } } } if (sid) {