From d89a8f7647cf95b0e7cb85225ef342a24276ec2c Mon Sep 17 00:00:00 2001 From: Roo Code Date: Mon, 11 Aug 2025 16:33:05 +0000 Subject: [PATCH 1/2] feat: add option to disable follow-up questions from LLM - Add alwaysAllowFollowupQuestions to SystemPromptSettings interface - Pass setting through generateSystemPrompt and Task.ts - Conditionally exclude ask_followup_question tool when disabled - Update UI description to clarify behavior when disabled Fixes #6940 --- src/core/prompts/tools/index.ts | 5 +++++ src/core/prompts/types.ts | 1 + src/core/task/Task.ts | 2 ++ src/core/webview/generateSystemPrompt.ts | 2 ++ webview-ui/src/i18n/locales/en/settings.json | 2 +- 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/core/prompts/tools/index.ts b/src/core/prompts/tools/index.ts index d455abb8d7..b87c8c0724 100644 --- a/src/core/prompts/tools/index.ts +++ b/src/core/prompts/tools/index.ts @@ -118,6 +118,11 @@ export function getToolDescriptionsForMode( tools.delete("update_todo_list") } + // Conditionally exclude ask_followup_question if disabled in settings + if (settings?.alwaysAllowFollowupQuestions === false) { + tools.delete("ask_followup_question") + } + // Map tool descriptions for allowed tools const descriptions = Array.from(tools).map((toolName) => { const descriptionFn = toolDescriptionMap[toolName] diff --git a/src/core/prompts/types.ts b/src/core/prompts/types.ts index 3977ea98c5..875c38e931 100644 --- a/src/core/prompts/types.ts +++ b/src/core/prompts/types.ts @@ -5,4 +5,5 @@ export interface SystemPromptSettings { maxConcurrentFileReads: number todoListEnabled: boolean useAgentRules: boolean + alwaysAllowFollowupQuestions: boolean } diff --git a/src/core/task/Task.ts b/src/core/task/Task.ts index 5e96b6fb16..7770589c38 100644 --- a/src/core/task/Task.ts +++ b/src/core/task/Task.ts @@ -1898,6 +1898,7 @@ export class Task extends EventEmitter implements TaskLike { maxConcurrentFileReads, maxReadFileLine, apiConfiguration, + alwaysAllowFollowupQuestions, } = state ?? {} return await (async () => { @@ -1928,6 +1929,7 @@ export class Task extends EventEmitter implements TaskLike { maxConcurrentFileReads: maxConcurrentFileReads ?? 5, todoListEnabled: apiConfiguration?.todoListEnabled ?? true, useAgentRules: vscode.workspace.getConfiguration("roo-cline").get("useAgentRules") ?? true, + alwaysAllowFollowupQuestions: alwaysAllowFollowupQuestions ?? true, }, ) })() diff --git a/src/core/webview/generateSystemPrompt.ts b/src/core/webview/generateSystemPrompt.ts index b8e87a1d4a..321a3b398d 100644 --- a/src/core/webview/generateSystemPrompt.ts +++ b/src/core/webview/generateSystemPrompt.ts @@ -25,6 +25,7 @@ export const generateSystemPrompt = async (provider: ClineProvider, message: Web language, maxReadFileLine, maxConcurrentFileReads, + alwaysAllowFollowupQuestions, } = await provider.getState() // Check experiment to determine which diff strategy to use @@ -85,6 +86,7 @@ export const generateSystemPrompt = async (provider: ClineProvider, message: Web maxConcurrentFileReads: maxConcurrentFileReads ?? 5, todoListEnabled: apiConfiguration?.todoListEnabled ?? true, useAgentRules: vscode.workspace.getConfiguration("roo-cline").get("useAgentRules") ?? true, + alwaysAllowFollowupQuestions: alwaysAllowFollowupQuestions ?? true, }, ) diff --git a/webview-ui/src/i18n/locales/en/settings.json b/webview-ui/src/i18n/locales/en/settings.json index eb893d6c51..7c6bce9951 100644 --- a/webview-ui/src/i18n/locales/en/settings.json +++ b/webview-ui/src/i18n/locales/en/settings.json @@ -172,7 +172,7 @@ }, "followupQuestions": { "label": "Question", - "description": "Automatically select the first suggested answer for follow-up questions after the configured timeout", + "description": "Allow the AI to ask follow-up questions. When disabled, the AI will not have access to the question-asking tool and must proceed without clarification", "timeoutLabel": "Time to wait before auto-selecting the first answer" }, "execute": { From 76390543934f4daf3a2050167e06e9967f51b560 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Mon, 11 Aug 2025 16:36:27 +0000 Subject: [PATCH 2/2] fix: add alwaysAllowFollowupQuestions to test settings objects --- .../prompts/__tests__/system-prompt.spec.ts | 3 ++ .../__tests__/custom-instructions.spec.ts | 54 ++++++++++++++++--- 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/src/core/prompts/__tests__/system-prompt.spec.ts b/src/core/prompts/__tests__/system-prompt.spec.ts index 4d5579408c..f7c7cc66f1 100644 --- a/src/core/prompts/__tests__/system-prompt.spec.ts +++ b/src/core/prompts/__tests__/system-prompt.spec.ts @@ -580,6 +580,7 @@ describe("SYSTEM_PROMPT", () => { maxConcurrentFileReads: 5, todoListEnabled: false, useAgentRules: true, + alwaysAllowFollowupQuestions: true, } const prompt = await SYSTEM_PROMPT( @@ -612,6 +613,7 @@ describe("SYSTEM_PROMPT", () => { maxConcurrentFileReads: 5, todoListEnabled: true, useAgentRules: true, + alwaysAllowFollowupQuestions: true, } const prompt = await SYSTEM_PROMPT( @@ -643,6 +645,7 @@ describe("SYSTEM_PROMPT", () => { maxConcurrentFileReads: 5, todoListEnabled: true, useAgentRules: true, + alwaysAllowFollowupQuestions: true, } const prompt = await SYSTEM_PROMPT( diff --git a/src/core/prompts/sections/__tests__/custom-instructions.spec.ts b/src/core/prompts/sections/__tests__/custom-instructions.spec.ts index d015748315..d548ff964e 100644 --- a/src/core/prompts/sections/__tests__/custom-instructions.spec.ts +++ b/src/core/prompts/sections/__tests__/custom-instructions.spec.ts @@ -535,7 +535,14 @@ describe("addCustomInstructions", () => { "global instructions", "/fake/path", "test-mode", - { settings: { maxConcurrentFileReads: 5, todoListEnabled: true, useAgentRules: true } }, + { + settings: { + maxConcurrentFileReads: 5, + todoListEnabled: true, + useAgentRules: true, + alwaysAllowFollowupQuestions: true, + }, + }, ) expect(result).toContain("# Agent Rules Standard (AGENTS.md):") @@ -560,7 +567,14 @@ describe("addCustomInstructions", () => { "global instructions", "/fake/path", "test-mode", - { settings: { maxConcurrentFileReads: 5, todoListEnabled: true, useAgentRules: false } }, + { + settings: { + maxConcurrentFileReads: 5, + todoListEnabled: true, + useAgentRules: false, + alwaysAllowFollowupQuestions: true, + }, + }, ) expect(result).not.toContain("# Agent Rules Standard (AGENTS.md):") @@ -614,7 +628,14 @@ describe("addCustomInstructions", () => { "global instructions", "/fake/path", "test-mode", - { settings: { maxConcurrentFileReads: 5, todoListEnabled: true, useAgentRules: true } }, + { + settings: { + maxConcurrentFileReads: 5, + todoListEnabled: true, + useAgentRules: true, + alwaysAllowFollowupQuestions: true, + }, + }, ) expect(result).toContain("Global Instructions:\nglobal instructions") @@ -653,7 +674,14 @@ describe("addCustomInstructions", () => { "global instructions", "/fake/path", "test-mode", - { settings: { maxConcurrentFileReads: 5, todoListEnabled: true, useAgentRules: true } }, + { + settings: { + maxConcurrentFileReads: 5, + todoListEnabled: true, + useAgentRules: true, + alwaysAllowFollowupQuestions: true, + }, + }, ) // Should contain both AGENTS.md and .roorules content @@ -714,7 +742,14 @@ describe("addCustomInstructions", () => { "global instructions", "/fake/path", "test-mode", - { settings: { maxConcurrentFileReads: 5, todoListEnabled: true, useAgentRules: true } }, + { + settings: { + maxConcurrentFileReads: 5, + todoListEnabled: true, + useAgentRules: true, + alwaysAllowFollowupQuestions: true, + }, + }, ) expect(result).toContain("# Agent Rules Standard (AGENTS.md):") @@ -759,7 +794,14 @@ describe("addCustomInstructions", () => { "global instructions", "/fake/path", "test-mode", - { settings: { maxConcurrentFileReads: 5, todoListEnabled: true, useAgentRules: true } }, + { + settings: { + maxConcurrentFileReads: 5, + todoListEnabled: true, + useAgentRules: true, + alwaysAllowFollowupQuestions: true, + }, + }, ) expect(result).toContain("# Agent Rules Standard (AGENTS.md):")