Skip to content

Commit 986b3d2

Browse files
committed
fix: keep the original path if the experiment is disabled
1 parent 56050e8 commit 986b3d2

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/core/assistant-message/presentAssistantMessage.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { formatResponse } from "../prompts/responses"
3131
import { validateToolUse } from "../tools/validateToolUse"
3232
import { Task } from "../task/Task"
3333
import { codebaseSearchTool } from "../tools/codebaseSearchTool"
34-
import { experiments } from "../../shared/experiments"
34+
import { experiments, EXPERIMENT_IDS } from "../../shared/experiments"
3535
import { applyDiffToolLegacy } from "../tools/applyDiffTool"
3636

3737
/**
@@ -386,8 +386,20 @@ export async function presentAssistantMessage(cline: Task) {
386386
case "write_to_file":
387387
await writeToFileTool(cline, block, askApproval, handleError, pushToolResult, removeClosingTag)
388388
break
389-
case "apply_diff":
390-
if (experiments.get("MULTI_FILE_APPLY_DIFF")?.enabled) {
389+
case "apply_diff": {
390+
// Get the provider and state to check experiment settings
391+
const provider = cline.providerRef.deref()
392+
let isMultiFileApplyDiffEnabled = false
393+
394+
if (provider) {
395+
const state = await provider.getState()
396+
isMultiFileApplyDiffEnabled = experiments.isEnabled(
397+
state.experiments ?? {},
398+
EXPERIMENT_IDS.MULTI_FILE_APPLY_DIFF,
399+
)
400+
}
401+
402+
if (isMultiFileApplyDiffEnabled) {
391403
await applyDiffTool(cline, block, askApproval, handleError, pushToolResult, removeClosingTag)
392404
} else {
393405
await applyDiffToolLegacy(
@@ -400,6 +412,7 @@ export async function presentAssistantMessage(cline: Task) {
400412
)
401413
}
402414
break
415+
}
403416
case "insert_content":
404417
await insertContentTool(cline, block, askApproval, handleError, pushToolResult, removeClosingTag)
405418
break

0 commit comments

Comments
 (0)