Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/core/prompts/__tests__/system-prompt.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ describe("SYSTEM_PROMPT", () => {
maxConcurrentFileReads: 5,
todoListEnabled: false,
useAgentRules: true,
alwaysAllowFollowupQuestions: true,
}

const prompt = await SYSTEM_PROMPT(
Expand Down Expand Up @@ -612,6 +613,7 @@ describe("SYSTEM_PROMPT", () => {
maxConcurrentFileReads: 5,
todoListEnabled: true,
useAgentRules: true,
alwaysAllowFollowupQuestions: true,
}

const prompt = await SYSTEM_PROMPT(
Expand Down Expand Up @@ -643,6 +645,7 @@ describe("SYSTEM_PROMPT", () => {
maxConcurrentFileReads: 5,
todoListEnabled: true,
useAgentRules: true,
alwaysAllowFollowupQuestions: true,
}

const prompt = await SYSTEM_PROMPT(
Expand Down
54 changes: 48 additions & 6 deletions src/core/prompts/sections/__tests__/custom-instructions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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):")
Expand All @@ -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):")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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):")
Expand Down Expand Up @@ -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):")
Expand Down
5 changes: 5 additions & 0 deletions src/core/prompts/tools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implementation looks good! The tool is properly excluded when the setting is disabled. Consider adding a specific test case to verify that ask_followup_question is actually removed from the tools list when alwaysAllowFollowupQuestions is false.

}

// Map tool descriptions for allowed tools
const descriptions = Array.from(tools).map((toolName) => {
const descriptionFn = toolDescriptionMap[toolName]
Expand Down
1 change: 1 addition & 0 deletions src/core/prompts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export interface SystemPromptSettings {
maxConcurrentFileReads: number
todoListEnabled: boolean
useAgentRules: boolean
alwaysAllowFollowupQuestions: boolean
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a comment about backward compatibility here. Since this adds a new required property to the interface, existing saved states might not have it. While the code defaults to true in multiple places, documenting this would help future maintainers understand the migration strategy.

}
2 changes: 2 additions & 0 deletions src/core/task/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1898,6 +1898,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
maxConcurrentFileReads,
maxReadFileLine,
apiConfiguration,
alwaysAllowFollowupQuestions,
} = state ?? {}

return await (async () => {
Expand Down Expand Up @@ -1928,6 +1929,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
maxConcurrentFileReads: maxConcurrentFileReads ?? 5,
todoListEnabled: apiConfiguration?.todoListEnabled ?? true,
useAgentRules: vscode.workspace.getConfiguration("roo-cline").get<boolean>("useAgentRules") ?? true,
alwaysAllowFollowupQuestions: alwaysAllowFollowupQuestions ?? true,
},
)
})()
Expand Down
2 changes: 2 additions & 0 deletions src/core/webview/generateSystemPrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<boolean>("useAgentRules") ?? true,
alwaysAllowFollowupQuestions: alwaysAllowFollowupQuestions ?? true,
},
)

Expand Down
2 changes: 1 addition & 1 deletion webview-ui/src/i18n/locales/en/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing internationalization for other locales - all other locale files (fr, de, es, ca, hi, id, it, ja, ko, nl, pl, pt-BR, ru, tr, vi, zh-CN, zh-TW) still have the old description for the follow-up questions setting. Could we update those as well to avoid confusion for non-English users?

"timeoutLabel": "Time to wait before auto-selecting the first answer"
},
"execute": {
Expand Down
Loading