From c43927b935c017262242a10fa8e5966cb9e57240 Mon Sep 17 00:00:00 2001 From: hannesrudolph Date: Mon, 7 Jul 2025 14:15:15 -0600 Subject: [PATCH] fix: execute command after whitelisting with 'Always allow' button - Modified addToWhitelist handler to trigger command execution after whitelisting - Fixes issue where chat was stuck after clicking 'Always allow' - Command now gets whitelisted AND executed in one action --- src/core/webview/webviewMessageHandler.ts | 5 ++++- webview-ui/src/components/chat/ChatView.tsx | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/webview/webviewMessageHandler.ts b/src/core/webview/webviewMessageHandler.ts index c646224ba5..9b2e3286ac 100644 --- a/src/core/webview/webviewMessageHandler.ts +++ b/src/core/webview/webviewMessageHandler.ts @@ -588,7 +588,7 @@ export const webviewMessageHandler = async ( break } case "addToWhitelist": { - // Handle adding a command pattern to the whitelist without running it + // Handle adding a command pattern to the whitelist and then running it if (message.pattern) { // Get current allowed commands const currentAllowedCommands = getGlobalState("allowedCommands") || [] @@ -608,6 +608,9 @@ export const webviewMessageHandler = async ( // Post state update to webview await provider.postStateToWebview() } + + // After whitelisting, approve the pending command execution + provider.getCurrentCline()?.handleWebviewAskResponse("yesButtonClicked") } break } diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index c18d64bf9c..176f3e1ce3 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -1659,7 +1659,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction {/* Command approval with auto-approve pattern */} {clineAsk === "command" && !isStreaming ? ( -
+
{/* Top row: Run Command and Reject */}