diff --git a/packages/types/src/experiment.ts b/packages/types/src/experiment.ts index 301d5fc453..dfb7cca1d5 100644 --- a/packages/types/src/experiment.ts +++ b/packages/types/src/experiment.ts @@ -6,13 +6,7 @@ import type { Keys, Equals, AssertEqual } from "./type-fu.js" * ExperimentId */ -export const experimentIds = [ - "powerSteering", - "concurrentFileReads", - "disableCompletionCommand", - "marketplace", - "multiFileApplyDiff", -] as const +export const experimentIds = ["powerSteering", "disableCompletionCommand", "marketplace", "multiFileApplyDiff"] as const export const experimentIdsSchema = z.enum(experimentIds) @@ -24,7 +18,6 @@ export type ExperimentId = z.infer export const experimentsSchema = z.object({ powerSteering: z.boolean().optional(), - concurrentFileReads: z.boolean().optional(), disableCompletionCommand: z.boolean().optional(), marketplace: z.boolean().optional(), multiFileApplyDiff: z.boolean().optional(), diff --git a/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap b/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap index be593279bc..616d14700f 100644 --- a/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap +++ b/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap @@ -39,7 +39,7 @@ Always use the actual tool name as the XML tag name for proper parsing and execu ## read_file Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. -**IMPORTANT: You can read a maximum of 15 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +**IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. Parameters: @@ -69,7 +69,7 @@ Examples: -2. Reading multiple files (within the 15-file limit): +2. Reading multiple files (within the 5-file limit): @@ -93,10 +93,10 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: -- You MUST read all related files and implementations together in a single operation (up to 15 files at once) +- You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes -- When you need to read more than 15 files, prioritize the most critical files first, then use subsequent read_file requests for additional files +- When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions Description: Request to fetch instructions to perform a task @@ -533,7 +533,7 @@ Always use the actual tool name as the XML tag name for proper parsing and execu ## read_file Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. -**IMPORTANT: You can read a maximum of 15 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +**IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. Parameters: @@ -563,7 +563,7 @@ Examples: -2. Reading multiple files (within the 15-file limit): +2. Reading multiple files (within the 5-file limit): @@ -587,10 +587,10 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: -- You MUST read all related files and implementations together in a single operation (up to 15 files at once) +- You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes -- When you need to read more than 15 files, prioritize the most critical files first, then use subsequent read_file requests for additional files +- When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions Description: Request to fetch instructions to perform a task @@ -1027,7 +1027,7 @@ Always use the actual tool name as the XML tag name for proper parsing and execu ## read_file Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. -**IMPORTANT: You can read a maximum of 15 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +**IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. Parameters: @@ -1057,7 +1057,7 @@ Examples: -2. Reading multiple files (within the 15-file limit): +2. Reading multiple files (within the 5-file limit): @@ -1081,10 +1081,10 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: -- You MUST read all related files and implementations together in a single operation (up to 15 files at once) +- You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes -- When you need to read more than 15 files, prioritize the most critical files first, then use subsequent read_file requests for additional files +- When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions Description: Request to fetch instructions to perform a task @@ -1521,7 +1521,7 @@ Always use the actual tool name as the XML tag name for proper parsing and execu ## read_file Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. -**IMPORTANT: You can read a maximum of 15 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +**IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. Parameters: @@ -1551,7 +1551,7 @@ Examples: -2. Reading multiple files (within the 15-file limit): +2. Reading multiple files (within the 5-file limit): @@ -1575,10 +1575,10 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: -- You MUST read all related files and implementations together in a single operation (up to 15 files at once) +- You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes -- When you need to read more than 15 files, prioritize the most critical files first, then use subsequent read_file requests for additional files +- When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions Description: Request to fetch instructions to perform a task @@ -2071,7 +2071,7 @@ Always use the actual tool name as the XML tag name for proper parsing and execu ## read_file Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. -**IMPORTANT: You can read a maximum of 15 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +**IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. Parameters: @@ -2101,7 +2101,7 @@ Examples: -2. Reading multiple files (within the 15-file limit): +2. Reading multiple files (within the 5-file limit): @@ -2125,10 +2125,10 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: -- You MUST read all related files and implementations together in a single operation (up to 15 files at once) +- You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes -- When you need to read more than 15 files, prioritize the most critical files first, then use subsequent read_file requests for additional files +- When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions Description: Request to fetch instructions to perform a task @@ -2633,7 +2633,7 @@ Always use the actual tool name as the XML tag name for proper parsing and execu ## read_file Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. -**IMPORTANT: You can read a maximum of 15 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +**IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. Parameters: @@ -2663,7 +2663,7 @@ Examples: -2. Reading multiple files (within the 15-file limit): +2. Reading multiple files (within the 5-file limit): @@ -2687,10 +2687,10 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: -- You MUST read all related files and implementations together in a single operation (up to 15 files at once) +- You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes -- When you need to read more than 15 files, prioritize the most critical files first, then use subsequent read_file requests for additional files +- When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions Description: Request to fetch instructions to perform a task @@ -3183,7 +3183,7 @@ Always use the actual tool name as the XML tag name for proper parsing and execu ## read_file Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. -**IMPORTANT: You can read a maximum of 15 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +**IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. Parameters: @@ -3213,7 +3213,7 @@ Examples: -2. Reading multiple files (within the 15-file limit): +2. Reading multiple files (within the 5-file limit): @@ -3237,10 +3237,10 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: -- You MUST read all related files and implementations together in a single operation (up to 15 files at once) +- You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes -- When you need to read more than 15 files, prioritize the most critical files first, then use subsequent read_file requests for additional files +- When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions Description: Request to fetch instructions to perform a task @@ -3765,7 +3765,7 @@ Always use the actual tool name as the XML tag name for proper parsing and execu ## read_file Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. -**IMPORTANT: You can read a maximum of 15 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +**IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. Parameters: @@ -3795,7 +3795,7 @@ Examples: -2. Reading multiple files (within the 15-file limit): +2. Reading multiple files (within the 5-file limit): @@ -3819,10 +3819,10 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: -- You MUST read all related files and implementations together in a single operation (up to 15 files at once) +- You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes -- When you need to read more than 15 files, prioritize the most critical files first, then use subsequent read_file requests for additional files +- When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions Description: Request to fetch instructions to perform a task @@ -4301,7 +4301,7 @@ Always use the actual tool name as the XML tag name for proper parsing and execu ## read_file Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. -**IMPORTANT: You can read a maximum of 15 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +**IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. Parameters: @@ -4331,7 +4331,7 @@ Examples: -2. Reading multiple files (within the 15-file limit): +2. Reading multiple files (within the 5-file limit): @@ -4355,10 +4355,10 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: -- You MUST read all related files and implementations together in a single operation (up to 15 files at once) +- You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes -- When you need to read more than 15 files, prioritize the most critical files first, then use subsequent read_file requests for additional files +- When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions Description: Request to fetch instructions to perform a task @@ -4872,7 +4872,7 @@ Always use the actual tool name as the XML tag name for proper parsing and execu ## read_file Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. -**IMPORTANT: You can read a maximum of 15 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +**IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. Parameters: @@ -4902,7 +4902,7 @@ Examples: -2. Reading multiple files (within the 15-file limit): +2. Reading multiple files (within the 5-file limit): @@ -4926,10 +4926,10 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: -- You MUST read all related files and implementations together in a single operation (up to 15 files at once) +- You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes -- When you need to read more than 15 files, prioritize the most critical files first, then use subsequent read_file requests for additional files +- When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions Description: Request to fetch instructions to perform a task @@ -5357,7 +5357,7 @@ Always use the actual tool name as the XML tag name for proper parsing and execu ## read_file Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. -**IMPORTANT: You can read a maximum of 15 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +**IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. Parameters: @@ -5387,7 +5387,7 @@ Examples: -2. Reading multiple files (within the 15-file limit): +2. Reading multiple files (within the 5-file limit): @@ -5411,10 +5411,10 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: -- You MUST read all related files and implementations together in a single operation (up to 15 files at once) +- You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes -- When you need to read more than 15 files, prioritize the most critical files first, then use subsequent read_file requests for additional files +- When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions Description: Request to fetch instructions to perform a task @@ -5759,7 +5759,7 @@ Always use the actual tool name as the XML tag name for proper parsing and execu ## read_file Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. -**IMPORTANT: You can read a maximum of 15 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +**IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. Parameters: @@ -5789,7 +5789,7 @@ Examples: -2. Reading multiple files (within the 15-file limit): +2. Reading multiple files (within the 5-file limit): @@ -5813,10 +5813,10 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: -- You MUST read all related files and implementations together in a single operation (up to 15 files at once) +- You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes -- When you need to read more than 15 files, prioritize the most critical files first, then use subsequent read_file requests for additional files +- When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions Description: Request to fetch instructions to perform a task @@ -6339,7 +6339,7 @@ Always use the actual tool name as the XML tag name for proper parsing and execu ## read_file Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Use line ranges to efficiently read specific portions of large files. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. -**IMPORTANT: You can read a maximum of 15 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +**IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. By specifying line ranges, you can efficiently read specific portions of large files without loading the entire file into memory. Parameters: @@ -6369,7 +6369,7 @@ Examples: -2. Reading multiple files (within the 15-file limit): +2. Reading multiple files (within the 5-file limit): @@ -6394,14 +6394,14 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: -- You MUST read all related files and implementations together in a single operation (up to 15 files at once) +- You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes - You MUST use line ranges to read specific portions of large files, rather than reading entire files when not needed - You MUST combine adjacent line ranges (<10 lines apart) - You MUST use multiple ranges for content separated by >10 lines - You MUST include sufficient line context for planned modifications while keeping ranges minimal -- When you need to read more than 15 files, prioritize the most critical files first, then use subsequent read_file requests for additional files +- When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions Description: Request to fetch instructions to perform a task diff --git a/src/core/prompts/tools/read-file.ts b/src/core/prompts/tools/read-file.ts index 9df1e0b1ab..86f4dc8c64 100644 --- a/src/core/prompts/tools/read-file.ts +++ b/src/core/prompts/tools/read-file.ts @@ -1,7 +1,7 @@ import { ToolArgs } from "./types" export function getReadFileDescription(args: ToolArgs): string { - const maxConcurrentReads = args.settings?.maxConcurrentFileReads ?? 15 + const maxConcurrentReads = args.settings?.maxConcurrentFileReads ?? 5 const isMultipleReadsEnabled = maxConcurrentReads > 1 return `## read_file diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 166db4d3f5..f44c7a517c 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -1436,7 +1436,7 @@ export class ClineProvider language: language ?? formatLanguage(vscode.env.language), renderContext: this.renderContext, maxReadFileLine: maxReadFileLine ?? -1, - maxConcurrentFileReads: maxConcurrentFileReads ?? 15, + maxConcurrentFileReads: maxConcurrentFileReads ?? 5, settingsImportedAt: this.settingsImportedAt, terminalCompressProgressBar: terminalCompressProgressBar ?? true, hasSystemPromptOverride, @@ -1586,12 +1586,7 @@ export class ClineProvider telemetrySetting: stateValues.telemetrySetting || "unset", showRooIgnoredFiles: stateValues.showRooIgnoredFiles ?? true, maxReadFileLine: stateValues.maxReadFileLine ?? -1, - maxConcurrentFileReads: experiments.isEnabled( - stateValues.experiments ?? experimentDefault, - EXPERIMENT_IDS.CONCURRENT_FILE_READS, - ) - ? (stateValues.maxConcurrentFileReads ?? 15) - : 1, + maxConcurrentFileReads: stateValues.maxConcurrentFileReads ?? 5, historyPreviewCollapsed: stateValues.historyPreviewCollapsed ?? false, cloudUserInfo, cloudIsAuthenticated, diff --git a/src/shared/__tests__/experiments.test.ts b/src/shared/__tests__/experiments.test.ts index 386677e534..96b970cf6e 100644 --- a/src/shared/__tests__/experiments.test.ts +++ b/src/shared/__tests__/experiments.test.ts @@ -28,7 +28,6 @@ describe("experiments", () => { const experiments: Record = { powerSteering: false, marketplace: false, - concurrentFileReads: false, disableCompletionCommand: false, multiFileApplyDiff: false, } @@ -39,7 +38,6 @@ describe("experiments", () => { const experiments: Record = { powerSteering: true, marketplace: false, - concurrentFileReads: false, disableCompletionCommand: false, multiFileApplyDiff: false, } @@ -50,34 +48,11 @@ describe("experiments", () => { const experiments: Record = { powerSteering: false, marketplace: false, - concurrentFileReads: false, disableCompletionCommand: false, multiFileApplyDiff: false, } expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.POWER_STEERING)).toBe(false) }) - - it("returns false when CONCURRENT_FILE_READS experiment is not enabled", () => { - const experiments: Record = { - powerSteering: false, - marketplace: false, - concurrentFileReads: false, - disableCompletionCommand: false, - multiFileApplyDiff: false, - } - expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.CONCURRENT_FILE_READS)).toBe(false) - }) - - it("returns true when CONCURRENT_FILE_READS experiment is enabled", () => { - const experiments: Record = { - powerSteering: false, - marketplace: false, - concurrentFileReads: true, - disableCompletionCommand: false, - multiFileApplyDiff: false, - } - expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.CONCURRENT_FILE_READS)).toBe(true) - }) }) describe("MARKETPLACE", () => { it("is configured correctly", () => { @@ -93,7 +68,6 @@ describe("experiments", () => { const experiments: Record = { powerSteering: false, marketplace: false, - concurrentFileReads: false, disableCompletionCommand: false, multiFileApplyDiff: false, } @@ -104,7 +78,6 @@ describe("experiments", () => { const experiments: Record = { powerSteering: false, marketplace: true, - concurrentFileReads: false, disableCompletionCommand: false, multiFileApplyDiff: false, } @@ -114,7 +87,6 @@ describe("experiments", () => { it("returns false when MARKETPLACE experiment is not present", () => { const experiments: Record = { powerSteering: false, - concurrentFileReads: false, // marketplace missing } as any expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.MARKETPLACE)).toBe(false) diff --git a/src/shared/experiments.ts b/src/shared/experiments.ts index 2fb6c160a3..8e71e71ff0 100644 --- a/src/shared/experiments.ts +++ b/src/shared/experiments.ts @@ -2,7 +2,6 @@ import type { AssertEqual, Equals, Keys, Values, ExperimentId, Experiments } fro export const EXPERIMENT_IDS = { MARKETPLACE: "marketplace", - CONCURRENT_FILE_READS: "concurrentFileReads", MULTI_FILE_APPLY_DIFF: "multiFileApplyDiff", DISABLE_COMPLETION_COMMAND: "disableCompletionCommand", POWER_STEERING: "powerSteering", @@ -18,7 +17,6 @@ interface ExperimentConfig { export const experimentConfigsMap: Record = { MARKETPLACE: { enabled: false }, - CONCURRENT_FILE_READS: { enabled: false }, MULTI_FILE_APPLY_DIFF: { enabled: false }, DISABLE_COMPLETION_COMMAND: { enabled: false }, POWER_STEERING: { enabled: false }, diff --git a/webview-ui/src/components/settings/ConcurrentFileReadsExperiment.tsx b/webview-ui/src/components/settings/ConcurrentFileReadsExperiment.tsx deleted file mode 100644 index fb1f0dc718..0000000000 --- a/webview-ui/src/components/settings/ConcurrentFileReadsExperiment.tsx +++ /dev/null @@ -1,69 +0,0 @@ -import { VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react" -import { useAppTranslation } from "@/i18n/TranslationContext" -import { Slider } from "@/components/ui/slider" - -interface ConcurrentFileReadsExperimentProps { - enabled: boolean - onEnabledChange: (value: boolean) => void - maxConcurrentFileReads: number - onMaxConcurrentFileReadsChange: (value: number) => void -} - -export const ConcurrentFileReadsExperiment = ({ - enabled, - onEnabledChange, - maxConcurrentFileReads, - onMaxConcurrentFileReadsChange, -}: ConcurrentFileReadsExperimentProps) => { - const { t } = useAppTranslation() - - const handleChange = (value: boolean) => { - onEnabledChange(value) - // Set to 1 if disabling to reset the setting - if (!value) { - onMaxConcurrentFileReadsChange(1) - } else { - // When enabling, ensure we have a valid value > 1 - if (!maxConcurrentFileReads || maxConcurrentFileReads <= 1) { - onMaxConcurrentFileReadsChange(15) - } - } - } - - return ( -
-
- handleChange(e.target.checked)} - data-testid="concurrent-file-reads-checkbox"> - {t("settings:experimental.CONCURRENT_FILE_READS.name")} - -
-

- {t("settings:experimental.CONCURRENT_FILE_READS.description")} -

- - {enabled && ( -
-
- - {t("settings:contextManagement.maxConcurrentFileReads.label")} - -
- onMaxConcurrentFileReadsChange(value)} - data-testid="max-concurrent-file-reads-slider" - /> - {Math.max(2, maxConcurrentFileReads)} -
-
-
- )} -
- ) -} diff --git a/webview-ui/src/components/settings/ContextManagementSettings.tsx b/webview-ui/src/components/settings/ContextManagementSettings.tsx index 6b558bdfbd..49d7cc5750 100644 --- a/webview-ui/src/components/settings/ContextManagementSettings.tsx +++ b/webview-ui/src/components/settings/ContextManagementSettings.tsx @@ -61,6 +61,7 @@ type ContextManagementSettingsProps = HTMLAttributes & { maxWorkspaceFiles: number showRooIgnoredFiles?: boolean maxReadFileLine?: number + maxConcurrentFileReads?: number setCachedStateField: SetCachedStateField< | "autoCondenseContext" | "autoCondenseContextPercent" @@ -70,6 +71,7 @@ type ContextManagementSettingsProps = HTMLAttributes & { | "maxWorkspaceFiles" | "showRooIgnoredFiles" | "maxReadFileLine" + | "maxConcurrentFileReads" > } @@ -84,6 +86,7 @@ export const ContextManagementSettings = ({ showRooIgnoredFiles, setCachedStateField, maxReadFileLine, + maxConcurrentFileReads, className, ...props }: ContextManagementSettingsProps) => { @@ -136,6 +139,26 @@ export const ContextManagementSettings = ({ +
+ + {t("settings:contextManagement.maxConcurrentFileReads.label")} + +
+ setCachedStateField("maxConcurrentFileReads", value)} + data-testid="max-concurrent-file-reads-slider" + /> + {Math.max(1, maxConcurrentFileReads ?? 5)} +
+
+ {t("settings:contextManagement.maxConcurrentFileReads.description")} +
+
+
-
+
{t("settings:contextManagement.rooignore.description")}
@@ -186,8 +209,7 @@ export const ContextManagementSettings = ({
- -
+
setCachedStateField("autoCondenseContext", e.target.checked)} diff --git a/webview-ui/src/components/settings/ExperimentalSettings.tsx b/webview-ui/src/components/settings/ExperimentalSettings.tsx index e9413090b9..9c84318ffa 100644 --- a/webview-ui/src/components/settings/ExperimentalSettings.tsx +++ b/webview-ui/src/components/settings/ExperimentalSettings.tsx @@ -14,13 +14,11 @@ import { SectionHeader } from "./SectionHeader" import { Section } from "./Section" import { ExperimentalFeature } from "./ExperimentalFeature" import { CodeIndexSettings } from "./CodeIndexSettings" -import { ConcurrentFileReadsExperiment } from "./ConcurrentFileReadsExperiment" type ExperimentalSettingsProps = HTMLAttributes & { experiments: Experiments setExperimentEnabled: SetExperimentEnabled - maxConcurrentFileReads?: number - setCachedStateField: SetCachedStateField<"codebaseIndexConfig" | "maxConcurrentFileReads"> + setCachedStateField: SetCachedStateField<"codebaseIndexConfig"> // CodeIndexSettings props codebaseIndexModels: CodebaseIndexModels | undefined codebaseIndexConfig: CodebaseIndexConfig | undefined @@ -32,7 +30,6 @@ type ExperimentalSettingsProps = HTMLAttributes & { export const ExperimentalSettings = ({ experiments, setExperimentEnabled, - maxConcurrentFileReads, setCachedStateField, codebaseIndexModels, codebaseIndexConfig, @@ -57,21 +54,6 @@ export const ExperimentalSettings = ({ {Object.entries(experimentConfigsMap) .filter((config) => config[0] !== "DIFF_STRATEGY" && config[0] !== "MULTI_SEARCH_AND_REPLACE") .map((config) => { - if (config[0] === "CONCURRENT_FILE_READS") { - return ( - - setExperimentEnabled(EXPERIMENT_IDS.CONCURRENT_FILE_READS, enabled) - } - maxConcurrentFileReads={maxConcurrentFileReads ?? 15} - onMaxConcurrentFileReadsChange={(value) => - setCachedStateField("maxConcurrentFileReads", value) - } - /> - ) - } if (config[0] === "MULTI_FILE_APPLY_DIFF") { return ( (({ onDone, t vscode.postMessage({ type: "maxWorkspaceFiles", value: maxWorkspaceFiles ?? 200 }) vscode.postMessage({ type: "showRooIgnoredFiles", bool: showRooIgnoredFiles }) vscode.postMessage({ type: "maxReadFileLine", value: maxReadFileLine ?? -1 }) - vscode.postMessage({ type: "maxConcurrentFileReads", value: cachedState.maxConcurrentFileReads ?? 15 }) + vscode.postMessage({ type: "maxConcurrentFileReads", value: cachedState.maxConcurrentFileReads ?? 5 }) vscode.postMessage({ type: "currentApiConfigName", text: currentApiConfigName }) vscode.postMessage({ type: "updateExperimental", values: experiments }) vscode.postMessage({ type: "alwaysAllowModeSwitch", bool: alwaysAllowModeSwitch }) @@ -627,6 +627,7 @@ const SettingsView = forwardRef(({ onDone, t maxWorkspaceFiles={maxWorkspaceFiles ?? 200} showRooIgnoredFiles={showRooIgnoredFiles} maxReadFileLine={maxReadFileLine} + maxConcurrentFileReads={maxConcurrentFileReads} setCachedStateField={setCachedStateField} /> )} @@ -656,7 +657,6 @@ const SettingsView = forwardRef(({ onDone, t ({ - useAppTranslation: () => ({ - t: (key: string) => key, - }), -})) - -// Mock ResizeObserver which is used by the Slider component -global.ResizeObserver = jest.fn().mockImplementation(() => ({ - observe: jest.fn(), - unobserve: jest.fn(), - disconnect: jest.fn(), -})) - -describe("ConcurrentFileReadsExperiment", () => { - const mockOnEnabledChange = jest.fn() - const mockOnMaxConcurrentFileReadsChange = jest.fn() - - beforeEach(() => { - jest.clearAllMocks() - }) - - it("should render with disabled state", () => { - render( - , - ) - - const checkbox = screen.getByTestId("concurrent-file-reads-checkbox") - expect(checkbox).not.toBeChecked() - - // Slider should not be visible when disabled - expect(screen.queryByTestId("max-concurrent-file-reads-slider")).not.toBeInTheDocument() - }) - - it("should render with enabled state", () => { - render( - , - ) - - const checkbox = screen.getByTestId("concurrent-file-reads-checkbox") - expect(checkbox).toBeChecked() - - // Slider should be visible when enabled - expect(screen.getByTestId("max-concurrent-file-reads-slider")).toBeInTheDocument() - expect(screen.getByText("20")).toBeInTheDocument() - }) - - it("should set maxConcurrentFileReads to 15 when enabling from disabled state", () => { - render( - , - ) - - const checkbox = screen.getByTestId("concurrent-file-reads-checkbox") - fireEvent.click(checkbox) - - expect(mockOnEnabledChange).toHaveBeenCalledWith(true) - expect(mockOnMaxConcurrentFileReadsChange).toHaveBeenCalledWith(15) - }) - - it("should set maxConcurrentFileReads to 1 when disabling", () => { - render( - , - ) - - const checkbox = screen.getByTestId("concurrent-file-reads-checkbox") - fireEvent.click(checkbox) - - expect(mockOnEnabledChange).toHaveBeenCalledWith(false) - expect(mockOnMaxConcurrentFileReadsChange).toHaveBeenCalledWith(1) - }) - - it("should not change maxConcurrentFileReads when enabling if already > 1", () => { - render( - , - ) - - const checkbox = screen.getByTestId("concurrent-file-reads-checkbox") - fireEvent.click(checkbox) - - expect(mockOnEnabledChange).toHaveBeenCalledWith(true) - // Should not call onMaxConcurrentFileReadsChange since value is already > 1 - expect(mockOnMaxConcurrentFileReadsChange).not.toHaveBeenCalled() - }) - - it("should update value when slider changes", () => { - // Since the Slider component doesn't render a standard input, - // we'll test the component's interaction through its props - const { rerender } = render( - , - ) - - // Verify initial value is displayed - expect(screen.getByText("15")).toBeInTheDocument() - - // Simulate the slider change by re-rendering with new value - rerender( - , - ) - - // Verify new value is displayed - expect(screen.getByText("50")).toBeInTheDocument() - }) - - it("should display minimum value of 2 when maxConcurrentFileReads is less than 2", () => { - render( - , - ) - - // Should display 2 (minimum value) instead of 1 - expect(screen.getByText("2")).toBeInTheDocument() - }) - - it("should set maxConcurrentFileReads to 15 when enabling with value of 0", () => { - render( - , - ) - - const checkbox = screen.getByTestId("concurrent-file-reads-checkbox") - fireEvent.click(checkbox) - - expect(mockOnEnabledChange).toHaveBeenCalledWith(true) - expect(mockOnMaxConcurrentFileReadsChange).toHaveBeenCalledWith(15) - }) -}) diff --git a/webview-ui/src/context/ExtensionStateContext.tsx b/webview-ui/src/context/ExtensionStateContext.tsx index 5de00cbcd0..e15c247603 100644 --- a/webview-ui/src/context/ExtensionStateContext.tsx +++ b/webview-ui/src/context/ExtensionStateContext.tsx @@ -194,7 +194,7 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode maxReadFileLine: -1, // Default max read file line limit pinnedApiConfigs: {}, // Empty object for pinned API configs terminalZshOhMy: false, // Default Oh My Zsh integration setting - maxConcurrentFileReads: 15, // Default concurrent file reads + maxConcurrentFileReads: 5, // Default concurrent file reads terminalZshP10k: false, // Default Powerlevel10k integration setting terminalZdotdir: false, // Default ZDOTDIR handling setting terminalCompressProgressBar: true, // Default to compress progress bar output