Skip to content

Commit 184c480

Browse files
authored
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
1 parent 2eca105 commit 184c480

File tree

12 files changed

+85
-364
lines changed

12 files changed

+85
-364
lines changed

packages/types/src/experiment.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@ import type { Keys, Equals, AssertEqual } from "./type-fu.js"
66
* ExperimentId
77
*/
88

9-
export const experimentIds = [
10-
"powerSteering",
11-
"concurrentFileReads",
12-
"disableCompletionCommand",
13-
"marketplace",
14-
"multiFileApplyDiff",
15-
] as const
9+
export const experimentIds = ["powerSteering", "disableCompletionCommand", "marketplace", "multiFileApplyDiff"] as const
1610

1711
export const experimentIdsSchema = z.enum(experimentIds)
1812

@@ -24,7 +18,6 @@ export type ExperimentId = z.infer<typeof experimentIdsSchema>
2418

2519
export const experimentsSchema = z.object({
2620
powerSteering: z.boolean().optional(),
27-
concurrentFileReads: z.boolean().optional(),
2821
disableCompletionCommand: z.boolean().optional(),
2922
marketplace: z.boolean().optional(),
3023
multiFileApplyDiff: z.boolean().optional(),

src/core/prompts/__tests__/__snapshots__/system.test.ts.snap

Lines changed: 52 additions & 52 deletions
Large diffs are not rendered by default.

src/core/prompts/tools/read-file.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ToolArgs } from "./types"
22

33
export function getReadFileDescription(args: ToolArgs): string {
4-
const maxConcurrentReads = args.settings?.maxConcurrentFileReads ?? 15
4+
const maxConcurrentReads = args.settings?.maxConcurrentFileReads ?? 5
55
const isMultipleReadsEnabled = maxConcurrentReads > 1
66

77
return `## read_file

src/core/webview/ClineProvider.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,7 +1436,7 @@ export class ClineProvider
14361436
language: language ?? formatLanguage(vscode.env.language),
14371437
renderContext: this.renderContext,
14381438
maxReadFileLine: maxReadFileLine ?? -1,
1439-
maxConcurrentFileReads: maxConcurrentFileReads ?? 15,
1439+
maxConcurrentFileReads: maxConcurrentFileReads ?? 5,
14401440
settingsImportedAt: this.settingsImportedAt,
14411441
terminalCompressProgressBar: terminalCompressProgressBar ?? true,
14421442
hasSystemPromptOverride,
@@ -1586,12 +1586,7 @@ export class ClineProvider
15861586
telemetrySetting: stateValues.telemetrySetting || "unset",
15871587
showRooIgnoredFiles: stateValues.showRooIgnoredFiles ?? true,
15881588
maxReadFileLine: stateValues.maxReadFileLine ?? -1,
1589-
maxConcurrentFileReads: experiments.isEnabled(
1590-
stateValues.experiments ?? experimentDefault,
1591-
EXPERIMENT_IDS.CONCURRENT_FILE_READS,
1592-
)
1593-
? (stateValues.maxConcurrentFileReads ?? 15)
1594-
: 1,
1589+
maxConcurrentFileReads: stateValues.maxConcurrentFileReads ?? 5,
15951590
historyPreviewCollapsed: stateValues.historyPreviewCollapsed ?? false,
15961591
cloudUserInfo,
15971592
cloudIsAuthenticated,

src/shared/__tests__/experiments.test.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ describe("experiments", () => {
2828
const experiments: Record<ExperimentId, boolean> = {
2929
powerSteering: false,
3030
marketplace: false,
31-
concurrentFileReads: false,
3231
disableCompletionCommand: false,
3332
multiFileApplyDiff: false,
3433
}
@@ -39,7 +38,6 @@ describe("experiments", () => {
3938
const experiments: Record<ExperimentId, boolean> = {
4039
powerSteering: true,
4140
marketplace: false,
42-
concurrentFileReads: false,
4341
disableCompletionCommand: false,
4442
multiFileApplyDiff: false,
4543
}
@@ -50,34 +48,11 @@ describe("experiments", () => {
5048
const experiments: Record<ExperimentId, boolean> = {
5149
powerSteering: false,
5250
marketplace: false,
53-
concurrentFileReads: false,
5451
disableCompletionCommand: false,
5552
multiFileApplyDiff: false,
5653
}
5754
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.POWER_STEERING)).toBe(false)
5855
})
59-
60-
it("returns false when CONCURRENT_FILE_READS experiment is not enabled", () => {
61-
const experiments: Record<ExperimentId, boolean> = {
62-
powerSteering: false,
63-
marketplace: false,
64-
concurrentFileReads: false,
65-
disableCompletionCommand: false,
66-
multiFileApplyDiff: false,
67-
}
68-
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.CONCURRENT_FILE_READS)).toBe(false)
69-
})
70-
71-
it("returns true when CONCURRENT_FILE_READS experiment is enabled", () => {
72-
const experiments: Record<ExperimentId, boolean> = {
73-
powerSteering: false,
74-
marketplace: false,
75-
concurrentFileReads: true,
76-
disableCompletionCommand: false,
77-
multiFileApplyDiff: false,
78-
}
79-
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.CONCURRENT_FILE_READS)).toBe(true)
80-
})
8156
})
8257
describe("MARKETPLACE", () => {
8358
it("is configured correctly", () => {
@@ -93,7 +68,6 @@ describe("experiments", () => {
9368
const experiments: Record<ExperimentId, boolean> = {
9469
powerSteering: false,
9570
marketplace: false,
96-
concurrentFileReads: false,
9771
disableCompletionCommand: false,
9872
multiFileApplyDiff: false,
9973
}
@@ -104,7 +78,6 @@ describe("experiments", () => {
10478
const experiments: Record<ExperimentId, boolean> = {
10579
powerSteering: false,
10680
marketplace: true,
107-
concurrentFileReads: false,
10881
disableCompletionCommand: false,
10982
multiFileApplyDiff: false,
11083
}
@@ -114,7 +87,6 @@ describe("experiments", () => {
11487
it("returns false when MARKETPLACE experiment is not present", () => {
11588
const experiments: Record<ExperimentId, boolean> = {
11689
powerSteering: false,
117-
concurrentFileReads: false,
11890
// marketplace missing
11991
} as any
12092
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.MARKETPLACE)).toBe(false)

src/shared/experiments.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type { AssertEqual, Equals, Keys, Values, ExperimentId, Experiments } fro
22

33
export const EXPERIMENT_IDS = {
44
MARKETPLACE: "marketplace",
5-
CONCURRENT_FILE_READS: "concurrentFileReads",
65
MULTI_FILE_APPLY_DIFF: "multiFileApplyDiff",
76
DISABLE_COMPLETION_COMMAND: "disableCompletionCommand",
87
POWER_STEERING: "powerSteering",
@@ -18,7 +17,6 @@ interface ExperimentConfig {
1817

1918
export const experimentConfigsMap: Record<ExperimentKey, ExperimentConfig> = {
2019
MARKETPLACE: { enabled: false },
21-
CONCURRENT_FILE_READS: { enabled: false },
2220
MULTI_FILE_APPLY_DIFF: { enabled: false },
2321
DISABLE_COMPLETION_COMMAND: { enabled: false },
2422
POWER_STEERING: { enabled: false },

webview-ui/src/components/settings/ConcurrentFileReadsExperiment.tsx

Lines changed: 0 additions & 69 deletions
This file was deleted.

webview-ui/src/components/settings/ContextManagementSettings.tsx

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ type ContextManagementSettingsProps = HTMLAttributes<HTMLDivElement> & {
6161
maxWorkspaceFiles: number
6262
showRooIgnoredFiles?: boolean
6363
maxReadFileLine?: number
64+
maxConcurrentFileReads?: number
6465
setCachedStateField: SetCachedStateField<
6566
| "autoCondenseContext"
6667
| "autoCondenseContextPercent"
@@ -70,6 +71,7 @@ type ContextManagementSettingsProps = HTMLAttributes<HTMLDivElement> & {
7071
| "maxWorkspaceFiles"
7172
| "showRooIgnoredFiles"
7273
| "maxReadFileLine"
74+
| "maxConcurrentFileReads"
7375
>
7476
}
7577

@@ -84,6 +86,7 @@ export const ContextManagementSettings = ({
8486
showRooIgnoredFiles,
8587
setCachedStateField,
8688
maxReadFileLine,
89+
maxConcurrentFileReads,
8790
className,
8891
...props
8992
}: ContextManagementSettingsProps) => {
@@ -136,6 +139,26 @@ export const ContextManagementSettings = ({
136139
</div>
137140
</div>
138141

142+
<div>
143+
<span className="block font-medium mb-1">
144+
{t("settings:contextManagement.maxConcurrentFileReads.label")}
145+
</span>
146+
<div className="flex items-center gap-2">
147+
<Slider
148+
min={1}
149+
max={100}
150+
step={1}
151+
value={[Math.max(1, maxConcurrentFileReads ?? 5)]}
152+
onValueChange={([value]) => setCachedStateField("maxConcurrentFileReads", value)}
153+
data-testid="max-concurrent-file-reads-slider"
154+
/>
155+
<span className="w-10 text-sm">{Math.max(1, maxConcurrentFileReads ?? 5)}</span>
156+
</div>
157+
<div className="text-vscode-descriptionForeground text-sm mt-1 mb-3">
158+
{t("settings:contextManagement.maxConcurrentFileReads.description")}
159+
</div>
160+
</div>
161+
139162
<div>
140163
<VSCodeCheckbox
141164
checked={showRooIgnoredFiles}
@@ -145,7 +168,7 @@ export const ContextManagementSettings = ({
145168
{t("settings:contextManagement.rooignore.label")}
146169
</label>
147170
</VSCodeCheckbox>
148-
<div className="text-vscode-descriptionForeground text-sm mt-1">
171+
<div className="text-vscode-descriptionForeground text-sm mt-1 mb-3">
149172
{t("settings:contextManagement.rooignore.description")}
150173
</div>
151174
</div>
@@ -186,8 +209,7 @@ export const ContextManagementSettings = ({
186209
</div>
187210
</div>
188211
</Section>
189-
190-
<Section>
212+
<Section className="pt-2">
191213
<VSCodeCheckbox
192214
checked={autoCondenseContext}
193215
onChange={(e: any) => setCachedStateField("autoCondenseContext", e.target.checked)}

webview-ui/src/components/settings/ExperimentalSettings.tsx

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@ import { SectionHeader } from "./SectionHeader"
1414
import { Section } from "./Section"
1515
import { ExperimentalFeature } from "./ExperimentalFeature"
1616
import { CodeIndexSettings } from "./CodeIndexSettings"
17-
import { ConcurrentFileReadsExperiment } from "./ConcurrentFileReadsExperiment"
1817

1918
type ExperimentalSettingsProps = HTMLAttributes<HTMLDivElement> & {
2019
experiments: Experiments
2120
setExperimentEnabled: SetExperimentEnabled
22-
maxConcurrentFileReads?: number
23-
setCachedStateField: SetCachedStateField<"codebaseIndexConfig" | "maxConcurrentFileReads">
21+
setCachedStateField: SetCachedStateField<"codebaseIndexConfig">
2422
// CodeIndexSettings props
2523
codebaseIndexModels: CodebaseIndexModels | undefined
2624
codebaseIndexConfig: CodebaseIndexConfig | undefined
@@ -32,7 +30,6 @@ type ExperimentalSettingsProps = HTMLAttributes<HTMLDivElement> & {
3230
export const ExperimentalSettings = ({
3331
experiments,
3432
setExperimentEnabled,
35-
maxConcurrentFileReads,
3633
setCachedStateField,
3734
codebaseIndexModels,
3835
codebaseIndexConfig,
@@ -57,21 +54,6 @@ export const ExperimentalSettings = ({
5754
{Object.entries(experimentConfigsMap)
5855
.filter((config) => config[0] !== "DIFF_STRATEGY" && config[0] !== "MULTI_SEARCH_AND_REPLACE")
5956
.map((config) => {
60-
if (config[0] === "CONCURRENT_FILE_READS") {
61-
return (
62-
<ConcurrentFileReadsExperiment
63-
key={config[0]}
64-
enabled={experiments[EXPERIMENT_IDS.CONCURRENT_FILE_READS] ?? false}
65-
onEnabledChange={(enabled) =>
66-
setExperimentEnabled(EXPERIMENT_IDS.CONCURRENT_FILE_READS, enabled)
67-
}
68-
maxConcurrentFileReads={maxConcurrentFileReads ?? 15}
69-
onMaxConcurrentFileReadsChange={(value) =>
70-
setCachedStateField("maxConcurrentFileReads", value)
71-
}
72-
/>
73-
)
74-
}
7557
if (config[0] === "MULTI_FILE_APPLY_DIFF") {
7658
return (
7759
<ExperimentalFeature

webview-ui/src/components/settings/SettingsView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
290290
vscode.postMessage({ type: "maxWorkspaceFiles", value: maxWorkspaceFiles ?? 200 })
291291
vscode.postMessage({ type: "showRooIgnoredFiles", bool: showRooIgnoredFiles })
292292
vscode.postMessage({ type: "maxReadFileLine", value: maxReadFileLine ?? -1 })
293-
vscode.postMessage({ type: "maxConcurrentFileReads", value: cachedState.maxConcurrentFileReads ?? 15 })
293+
vscode.postMessage({ type: "maxConcurrentFileReads", value: cachedState.maxConcurrentFileReads ?? 5 })
294294
vscode.postMessage({ type: "currentApiConfigName", text: currentApiConfigName })
295295
vscode.postMessage({ type: "updateExperimental", values: experiments })
296296
vscode.postMessage({ type: "alwaysAllowModeSwitch", bool: alwaysAllowModeSwitch })
@@ -627,6 +627,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
627627
maxWorkspaceFiles={maxWorkspaceFiles ?? 200}
628628
showRooIgnoredFiles={showRooIgnoredFiles}
629629
maxReadFileLine={maxReadFileLine}
630+
maxConcurrentFileReads={maxConcurrentFileReads}
630631
setCachedStateField={setCachedStateField}
631632
/>
632633
)}
@@ -656,7 +657,6 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
656657
<ExperimentalSettings
657658
setExperimentEnabled={setExperimentEnabled}
658659
experiments={experiments}
659-
maxConcurrentFileReads={maxConcurrentFileReads}
660660
setCachedStateField={setCachedStateField}
661661
codebaseIndexModels={codebaseIndexModels}
662662
codebaseIndexConfig={codebaseIndexConfig}

0 commit comments

Comments
 (0)