fix: use askApproval wrapper in insert_content and search_and_replace tools #7649
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes issue #7648 where
insert_contentandsearch_and_replacetools incorrectly passisWriteProtectedas the third parameter totask.ask(), which is interpreted as thepartialflag instead of the intendedisProtectedparameter.Problem
The tools were calling
cline.ask()directly with incorrect parameter ordering:cline.ask("tool", completeMessage, isWriteProtected)partialflag (boolean)isWriteProtectedwas being misinterpreted as the partial flagThis caused the error: "Current ask promise was ignored (#1)" when the tools were used on write-protected files.
Solution
Both tools now use the
askApprovalwrapper function (similar towriteToFileTool.ts):askApproval("tool", completeMessage, undefined, isWriteProtected)undefinedforprogressStatus(3rd param)isWriteProtectedas the 4th parameterChanges
src/core/tools/insertContentTool.ts: Line 156 - Use askApproval wrappersrc/core/tools/searchAndReplaceTool.ts: Line 226 - Use askApproval wrapperTesting
Review Confidence
Implementation review showed 95% confidence with recommendation to proceed.
Fixes #7648
Important
Fixes parameter misinterpretation in
insertContentToolandsearchAndReplaceToolby usingaskApprovalwrapper for correctisWriteProtectedhandling.insertContentToolandsearchAndReplaceToolby usingaskApprovalwrapper.isWriteProtectedparameter usage, ensuring it is not misinterpreted aspartialflag.insertContentTool.ts: Line 156 - Replaces directcline.ask()call withaskApproval.searchAndReplaceTool.ts: Line 226 - Replaces directcline.ask()call withaskApproval.This description was created by
for 3dfa105. You can customize this summary. It will automatically update as commits are pushed.