diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index b3532a00b7..98567296aa 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -184,6 +184,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction(null) const everVisibleMessagesTsRef = useRef>( new LRUCache({ max: 100, @@ -516,10 +517,18 @@ const ChatViewComponent: React.ForwardRefRenderFunction { if (!isApprovalActionPending) { + approvalPendingMessagesSnapshotRef.current = null return } - clearApprovalActionPending() + if (approvalPendingMessagesSnapshotRef.current === null) { + approvalPendingMessagesSnapshotRef.current = messages + return + } + + if (messages !== approvalPendingMessagesSnapshotRef.current) { + clearApprovalActionPending() + } }, [messages, isApprovalActionPending, clearApprovalActionPending]) // Update button text when messages change (e.g., completion_result is added) for subtasks in resume_task state @@ -923,6 +932,8 @@ const ChatViewComponent: React.ForwardRefRenderFunction