From 3b1c21c10cff40c03aba56f4ad0b41bbf9e35dcb Mon Sep 17 00:00:00 2001 From: Roo Code Date: Thu, 8 Jan 2026 20:23:02 +0000 Subject: [PATCH] fix: prevent slash commands from being treated as denial feedback in approval prompts - Add detection for slash commands (text starting with /) in askApproval function - Treat slash commands as simple denials without feedback to prevent them from being captured as feedback text - Applied fix to both tool approval and MCP tool approval flows - Resolves ROO-421 --- .../presentAssistantMessage.ts | 50 +++++++++++++------ 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/src/core/assistant-message/presentAssistantMessage.ts b/src/core/assistant-message/presentAssistantMessage.ts index 28cb038d3e..5f4f026f54 100644 --- a/src/core/assistant-message/presentAssistantMessage.ts +++ b/src/core/assistant-message/presentAssistantMessage.ts @@ -200,13 +200,24 @@ export async function presentAssistantMessage(cline: Task) { if (response !== "yesButtonClicked") { if (text) { - await cline.say("user_feedback", text, images) - pushToolResult( - formatResponse.toolResult( - formatResponse.toolDeniedWithFeedback(text, toolProtocol), - images, - ), - ) + // Check if the text is a slash command (starts with /) + // Slash commands should not be treated as feedback to the model + const isSlashCommand = text.trimStart().startsWith("/") + + if (isSlashCommand) { + // Treat slash commands as simple denial without feedback + // This prevents commands from being captured as denial feedback + pushToolResult(formatResponse.toolDenied(toolProtocol)) + } else { + // Normal text feedback + await cline.say("user_feedback", text, images) + pushToolResult( + formatResponse.toolResult( + formatResponse.toolDeniedWithFeedback(text, toolProtocol), + images, + ), + ) + } } else { pushToolResult(formatResponse.toolDenied(toolProtocol)) } @@ -589,13 +600,24 @@ export async function presentAssistantMessage(cline: Task) { if (response !== "yesButtonClicked") { // Handle both messageResponse and noButtonClicked with text. if (text) { - await cline.say("user_feedback", text, images) - pushToolResult( - formatResponse.toolResult( - formatResponse.toolDeniedWithFeedback(text, toolProtocol), - images, - ), - ) + // Check if the text is a slash command (starts with /) + // Slash commands should not be treated as feedback to the model + const isSlashCommand = text.trimStart().startsWith("/") + + if (isSlashCommand) { + // Treat slash commands as simple denial without feedback + // This prevents commands from being captured as denial feedback + pushToolResult(formatResponse.toolDenied(toolProtocol)) + } else { + // Normal text feedback + await cline.say("user_feedback", text, images) + pushToolResult( + formatResponse.toolResult( + formatResponse.toolDeniedWithFeedback(text, toolProtocol), + images, + ), + ) + } } else { pushToolResult(formatResponse.toolDenied(toolProtocol)) }