Move concurrent reads into context settings and default to 5 (#4597)

* Move concurrent reads into context settings and default to 5

* Spacing tweaks

* Change max back to 100
This commit is contained in:
Matt Rubens 2025-06-12 16:21:39 -04:00 committed by GitHub
parent 2eca105e35
commit 184c4803c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 85 additions and 364 deletions

View file

@ -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<typeof experimentIdsSchema>
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(),

View file

@ -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:
</args>
</read_file>
2. Reading multiple files (within the 15-file limit):
2. Reading multiple files (within the 5-file limit):
<read_file>
<args>
<file>
@ -93,10 +93,10 @@ Examples:
</read_file>
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:
</args>
</read_file>
2. Reading multiple files (within the 15-file limit):
2. Reading multiple files (within the 5-file limit):
<read_file>
<args>
<file>
@ -587,10 +587,10 @@ Examples:
</read_file>
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:
</args>
</read_file>
2. Reading multiple files (within the 15-file limit):
2. Reading multiple files (within the 5-file limit):
<read_file>
<args>
<file>
@ -1081,10 +1081,10 @@ Examples:
</read_file>
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:
</args>
</read_file>
2. Reading multiple files (within the 15-file limit):
2. Reading multiple files (within the 5-file limit):
<read_file>
<args>
<file>
@ -1575,10 +1575,10 @@ Examples:
</read_file>
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:
</args>
</read_file>
2. Reading multiple files (within the 15-file limit):
2. Reading multiple files (within the 5-file limit):
<read_file>
<args>
<file>
@ -2125,10 +2125,10 @@ Examples:
</read_file>
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:
</args>
</read_file>
2. Reading multiple files (within the 15-file limit):
2. Reading multiple files (within the 5-file limit):
<read_file>
<args>
<file>
@ -2687,10 +2687,10 @@ Examples:
</read_file>
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:
</args>
</read_file>
2. Reading multiple files (within the 15-file limit):
2. Reading multiple files (within the 5-file limit):
<read_file>
<args>
<file>
@ -3237,10 +3237,10 @@ Examples:
</read_file>
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:
</args>
</read_file>
2. Reading multiple files (within the 15-file limit):
2. Reading multiple files (within the 5-file limit):
<read_file>
<args>
<file>
@ -3819,10 +3819,10 @@ Examples:
</read_file>
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:
</args>
</read_file>
2. Reading multiple files (within the 15-file limit):
2. Reading multiple files (within the 5-file limit):
<read_file>
<args>
<file>
@ -4355,10 +4355,10 @@ Examples:
</read_file>
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:
</args>
</read_file>
2. Reading multiple files (within the 15-file limit):
2. Reading multiple files (within the 5-file limit):
<read_file>
<args>
<file>
@ -4926,10 +4926,10 @@ Examples:
</read_file>
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:
</args>
</read_file>
2. Reading multiple files (within the 15-file limit):
2. Reading multiple files (within the 5-file limit):
<read_file>
<args>
<file>
@ -5411,10 +5411,10 @@ Examples:
</read_file>
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:
</args>
</read_file>
2. Reading multiple files (within the 15-file limit):
2. Reading multiple files (within the 5-file limit):
<read_file>
<args>
<file>
@ -5813,10 +5813,10 @@ Examples:
</read_file>
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:
</args>
</read_file>
2. Reading multiple files (within the 15-file limit):
2. Reading multiple files (within the 5-file limit):
<read_file>
<args>
<file>
@ -6394,14 +6394,14 @@ Examples:
</read_file>
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

View file

@ -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

View file

@ -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,

View file

@ -28,7 +28,6 @@ describe("experiments", () => {
const experiments: Record<ExperimentId, boolean> = {
powerSteering: false,
marketplace: false,
concurrentFileReads: false,
disableCompletionCommand: false,
multiFileApplyDiff: false,
}
@ -39,7 +38,6 @@ describe("experiments", () => {
const experiments: Record<ExperimentId, boolean> = {
powerSteering: true,
marketplace: false,
concurrentFileReads: false,
disableCompletionCommand: false,
multiFileApplyDiff: false,
}
@ -50,34 +48,11 @@ describe("experiments", () => {
const experiments: Record<ExperimentId, boolean> = {
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<ExperimentId, boolean> = {
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<ExperimentId, boolean> = {
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<ExperimentId, boolean> = {
powerSteering: false,
marketplace: false,
concurrentFileReads: false,
disableCompletionCommand: false,
multiFileApplyDiff: false,
}
@ -104,7 +78,6 @@ describe("experiments", () => {
const experiments: Record<ExperimentId, boolean> = {
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<ExperimentId, boolean> = {
powerSteering: false,
concurrentFileReads: false,
// marketplace missing
} as any
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.MARKETPLACE)).toBe(false)

View file

@ -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<ExperimentKey, ExperimentConfig> = {
MARKETPLACE: { enabled: false },
CONCURRENT_FILE_READS: { enabled: false },
MULTI_FILE_APPLY_DIFF: { enabled: false },
DISABLE_COMPLETION_COMMAND: { enabled: false },
POWER_STEERING: { enabled: false },

View file

@ -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 (
<div>
<div className="flex items-center gap-2">
<VSCodeCheckbox
checked={enabled}
onChange={(e: any) => handleChange(e.target.checked)}
data-testid="concurrent-file-reads-checkbox">
<span className="font-medium">{t("settings:experimental.CONCURRENT_FILE_READS.name")}</span>
</VSCodeCheckbox>
</div>
<p className="text-vscode-descriptionForeground text-sm mt-0">
{t("settings:experimental.CONCURRENT_FILE_READS.description")}
</p>
{enabled && (
<div className="flex flex-col gap-3 pl-3 border-l-2 border-vscode-button-background">
<div>
<span className="block text-sm mb-1">
{t("settings:contextManagement.maxConcurrentFileReads.label")}
</span>
<div className="flex items-center gap-2">
<Slider
min={2}
max={100}
step={1}
value={[Math.max(2, maxConcurrentFileReads)]}
onValueChange={([value]) => onMaxConcurrentFileReadsChange(value)}
data-testid="max-concurrent-file-reads-slider"
/>
<span className="w-10 text-sm">{Math.max(2, maxConcurrentFileReads)}</span>
</div>
</div>
</div>
)}
</div>
)
}

View file

@ -61,6 +61,7 @@ type ContextManagementSettingsProps = HTMLAttributes<HTMLDivElement> & {
maxWorkspaceFiles: number
showRooIgnoredFiles?: boolean
maxReadFileLine?: number
maxConcurrentFileReads?: number
setCachedStateField: SetCachedStateField<
| "autoCondenseContext"
| "autoCondenseContextPercent"
@ -70,6 +71,7 @@ type ContextManagementSettingsProps = HTMLAttributes<HTMLDivElement> & {
| "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 = ({
</div>
</div>
<div>
<span className="block font-medium mb-1">
{t("settings:contextManagement.maxConcurrentFileReads.label")}
</span>
<div className="flex items-center gap-2">
<Slider
min={1}
max={100}
step={1}
value={[Math.max(1, maxConcurrentFileReads ?? 5)]}
onValueChange={([value]) => setCachedStateField("maxConcurrentFileReads", value)}
data-testid="max-concurrent-file-reads-slider"
/>
<span className="w-10 text-sm">{Math.max(1, maxConcurrentFileReads ?? 5)}</span>
</div>
<div className="text-vscode-descriptionForeground text-sm mt-1 mb-3">
{t("settings:contextManagement.maxConcurrentFileReads.description")}
</div>
</div>
<div>
<VSCodeCheckbox
checked={showRooIgnoredFiles}
@ -145,7 +168,7 @@ export const ContextManagementSettings = ({
{t("settings:contextManagement.rooignore.label")}
</label>
</VSCodeCheckbox>
<div className="text-vscode-descriptionForeground text-sm mt-1">
<div className="text-vscode-descriptionForeground text-sm mt-1 mb-3">
{t("settings:contextManagement.rooignore.description")}
</div>
</div>
@ -186,8 +209,7 @@ export const ContextManagementSettings = ({
</div>
</div>
</Section>
<Section>
<Section className="pt-2">
<VSCodeCheckbox
checked={autoCondenseContext}
onChange={(e: any) => setCachedStateField("autoCondenseContext", e.target.checked)}

View file

@ -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<HTMLDivElement> & {
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<HTMLDivElement> & {
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 (
<ConcurrentFileReadsExperiment
key={config[0]}
enabled={experiments[EXPERIMENT_IDS.CONCURRENT_FILE_READS] ?? false}
onEnabledChange={(enabled) =>
setExperimentEnabled(EXPERIMENT_IDS.CONCURRENT_FILE_READS, enabled)
}
maxConcurrentFileReads={maxConcurrentFileReads ?? 15}
onMaxConcurrentFileReadsChange={(value) =>
setCachedStateField("maxConcurrentFileReads", value)
}
/>
)
}
if (config[0] === "MULTI_FILE_APPLY_DIFF") {
return (
<ExperimentalFeature

View file

@ -290,7 +290,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ 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<SettingsViewRef, SettingsViewProps>(({ onDone, t
maxWorkspaceFiles={maxWorkspaceFiles ?? 200}
showRooIgnoredFiles={showRooIgnoredFiles}
maxReadFileLine={maxReadFileLine}
maxConcurrentFileReads={maxConcurrentFileReads}
setCachedStateField={setCachedStateField}
/>
)}
@ -656,7 +657,6 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
<ExperimentalSettings
setExperimentEnabled={setExperimentEnabled}
experiments={experiments}
maxConcurrentFileReads={maxConcurrentFileReads}
setCachedStateField={setCachedStateField}
codebaseIndexModels={codebaseIndexModels}
codebaseIndexConfig={codebaseIndexConfig}

View file

@ -1,172 +0,0 @@
import { render, screen, fireEvent } from "@testing-library/react"
import { ConcurrentFileReadsExperiment } from "../ConcurrentFileReadsExperiment"
// Mock the translation hook
jest.mock("@/i18n/TranslationContext", () => ({
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(
<ConcurrentFileReadsExperiment
enabled={false}
onEnabledChange={mockOnEnabledChange}
maxConcurrentFileReads={1}
onMaxConcurrentFileReadsChange={mockOnMaxConcurrentFileReadsChange}
/>,
)
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(
<ConcurrentFileReadsExperiment
enabled={true}
onEnabledChange={mockOnEnabledChange}
maxConcurrentFileReads={20}
onMaxConcurrentFileReadsChange={mockOnMaxConcurrentFileReadsChange}
/>,
)
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(
<ConcurrentFileReadsExperiment
enabled={false}
onEnabledChange={mockOnEnabledChange}
maxConcurrentFileReads={1}
onMaxConcurrentFileReadsChange={mockOnMaxConcurrentFileReadsChange}
/>,
)
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(
<ConcurrentFileReadsExperiment
enabled={true}
onEnabledChange={mockOnEnabledChange}
maxConcurrentFileReads={25}
onMaxConcurrentFileReadsChange={mockOnMaxConcurrentFileReadsChange}
/>,
)
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(
<ConcurrentFileReadsExperiment
enabled={false}
onEnabledChange={mockOnEnabledChange}
maxConcurrentFileReads={30}
onMaxConcurrentFileReadsChange={mockOnMaxConcurrentFileReadsChange}
/>,
)
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(
<ConcurrentFileReadsExperiment
enabled={true}
onEnabledChange={mockOnEnabledChange}
maxConcurrentFileReads={15}
onMaxConcurrentFileReadsChange={mockOnMaxConcurrentFileReadsChange}
/>,
)
// Verify initial value is displayed
expect(screen.getByText("15")).toBeInTheDocument()
// Simulate the slider change by re-rendering with new value
rerender(
<ConcurrentFileReadsExperiment
enabled={true}
onEnabledChange={mockOnEnabledChange}
maxConcurrentFileReads={50}
onMaxConcurrentFileReadsChange={mockOnMaxConcurrentFileReadsChange}
/>,
)
// Verify new value is displayed
expect(screen.getByText("50")).toBeInTheDocument()
})
it("should display minimum value of 2 when maxConcurrentFileReads is less than 2", () => {
render(
<ConcurrentFileReadsExperiment
enabled={true}
onEnabledChange={mockOnEnabledChange}
maxConcurrentFileReads={1}
onMaxConcurrentFileReadsChange={mockOnMaxConcurrentFileReadsChange}
/>,
)
// 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(
<ConcurrentFileReadsExperiment
enabled={false}
onEnabledChange={mockOnEnabledChange}
maxConcurrentFileReads={0}
onMaxConcurrentFileReadsChange={mockOnMaxConcurrentFileReadsChange}
/>,
)
const checkbox = screen.getByTestId("concurrent-file-reads-checkbox")
fireEvent.click(checkbox)
expect(mockOnEnabledChange).toHaveBeenCalledWith(true)
expect(mockOnMaxConcurrentFileReadsChange).toHaveBeenCalledWith(15)
})
})

View file

@ -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