From 4a96aa29f3cd4e5d4d3343d0969147bd5738d199 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Tue, 12 Aug 2025 14:26:29 +0000 Subject: [PATCH] fix: prevent queue from interfering with manual approval workflow - Queue processing now pauses when approval buttons are showing (enableButtons is true) - Messages typed during approval requests are queued instead of being sent immediately - This prevents the unintended auto-rejection behavior when using QUEUE with manual approval Fixes #6996 --- webview-ui/src/components/chat/ChatView.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index 9b8c96dea1d..b5714e975a3 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -569,7 +569,11 @@ const ChatViewComponent: React.ForwardRefRenderFunction 0) { - if (sendingDisabled && !fromQueue) { + // Queue messages when: + // 1. sendingDisabled is true (existing behavior) + // 2. OR when approval buttons are showing (enableButtons is true) to prevent auto-rejection + // This ensures that pressing Enter during manual approval doesn't immediately reject the request + if ((sendingDisabled || enableButtons) && !fromQueue) { // Generate a more unique ID using timestamp + random component const messageId = `${Date.now()}-${Math.random().toString(36).substr(2, 9)}` setMessageQueue((prev: QueuedMessage[]) => [...prev, { id: messageId, text, images }]) @@ -627,17 +631,20 @@ const ChatViewComponent: React.ForwardRefRenderFunction { // Early return if conditions aren't met // Also don't process queue if there's an API error (clineAsk === "api_req_failed") + // IMPORTANT: Don't process queue when there's a pending approval request (enableButtons is true) + // This prevents the queue from interfering with manual approval workflows if ( sendingDisabled || messageQueue.length === 0 || isProcessingQueueRef.current || - clineAsk === "api_req_failed" + clineAsk === "api_req_failed" || + enableButtons // Don't process queue when approval buttons are shown ) { return } @@ -682,7 +689,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction { isProcessingQueueRef.current = false } - }, [sendingDisabled, messageQueue, handleSendMessage, clineAsk]) + }, [sendingDisabled, messageQueue, handleSendMessage, clineAsk, enableButtons]) const handleSetChatBoxMessage = useCallback( (text: string, images: string[]) => {