Browse Source

fix: use askApproval wrapper in insert_content and search_and_replace tools (#7649)

Fixes issue where isWriteProtected was incorrectly passed as the partial flag
to task.ask(), causing "Current ask promise was ignored (#1)" error.

Both tools now use the askApproval wrapper function which correctly handles
the parameter ordering, passing undefined for progressStatus and isWriteProtected
as the fourth parameter.

Fixes #7648

Co-authored-by: Roo Code <[email protected]>
roomote[bot] 4 tháng trước cách đây
mục cha
commit
e7f599bfb9

+ 1 - 3
src/core/tools/insertContentTool.ts

@@ -153,9 +153,7 @@ export async function insertContentTool(
 		}
 		}
 
 
 		// Ask for approval (same for both flows)
 		// Ask for approval (same for both flows)
-		const didApprove = await cline
-			.ask("tool", completeMessage, isWriteProtected)
-			.then((response) => response.response === "yesButtonClicked")
+		const didApprove = await askApproval("tool", completeMessage, undefined, isWriteProtected)
 
 
 		if (!didApprove) {
 		if (!didApprove) {
 			// Revert changes if diff view was shown
 			// Revert changes if diff view was shown

+ 1 - 3
src/core/tools/searchAndReplaceTool.ts

@@ -223,9 +223,7 @@ export async function searchAndReplaceTool(
 			cline.diffViewProvider.scrollToFirstDiff()
 			cline.diffViewProvider.scrollToFirstDiff()
 		}
 		}
 
 
-		const didApprove = await cline
-			.ask("tool", completeMessage, isWriteProtected)
-			.then((response) => response.response === "yesButtonClicked")
+		const didApprove = await askApproval("tool", completeMessage, undefined, isWriteProtected)
 
 
 		if (!didApprove) {
 		if (!didApprove) {
 			// Revert changes if diff view was shown
 			// Revert changes if diff view was shown