Skip to content

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

Merged
mrubens merged 1 commit intomainfrom
fix/issue-7648-insert-content-partial-flag
Sep 4, 2025
Merged

fix: use askApproval wrapper in insert_content and search_and_replace tools#7649
mrubens merged 1 commit intomainfrom
fix/issue-7648-insert-content-partial-flag

Conversation

@roomote-v0
Copy link
Contributor

@roomote-v0 roomote-v0 bot commented Sep 4, 2025

Summary

This PR fixes issue #7648 where insert_content and search_and_replace tools incorrectly pass isWriteProtected as the third parameter to task.ask(), which is interpreted as the partial flag instead of the intended isProtected parameter.

Problem

The tools were calling cline.ask() directly with incorrect parameter ordering:

  • Incorrect: cline.ask("tool", completeMessage, isWriteProtected)
  • The third parameter is expected to be the partial flag (boolean)
  • isWriteProtected was being misinterpreted as the partial flag

This caused the error: "Current ask promise was ignored (#1)" when the tools were used on write-protected files.

Solution

Both tools now use the askApproval wrapper function (similar to writeToFileTool.ts):

  • Correct: askApproval("tool", completeMessage, undefined, isWriteProtected)
  • The wrapper correctly passes parameters in the right order
  • undefined for progressStatus (3rd param)
  • isWriteProtected as the 4th parameter

Changes

  • src/core/tools/insertContentTool.ts: Line 156 - Use askApproval wrapper
  • src/core/tools/searchAndReplaceTool.ts: Line 226 - Use askApproval wrapper

Testing

  • ✅ All existing tests pass (205 tests in core/tools)
  • ✅ Linting passes
  • ✅ Type checking passes

Review Confidence

Implementation review showed 95% confidence with recommendation to proceed.

Fixes #7648


Important

Fixes parameter misinterpretation in insertContentTool and searchAndReplaceTool by using askApproval wrapper for correct isWriteProtected handling.

  • Behavior:
    • Fixes parameter misinterpretation in insertContentTool and searchAndReplaceTool by using askApproval wrapper.
    • Corrects isWriteProtected parameter usage, ensuring it is not misinterpreted as partial flag.
  • Files:
    • insertContentTool.ts: Line 156 - Replaces direct cline.ask() call with askApproval.
    • searchAndReplaceTool.ts: Line 226 - Replaces direct cline.ask() call with askApproval.
  • Testing:
    • All existing tests pass (205 tests in core/tools).
    • Linting and type checking pass.

This description was created by Ellipsis for 3dfa105. You can customize this summary. It will automatically update as commits are pushed.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

Bug: insert_content passes isWriteProtected as the partial flag, causing ‘Current ask promise was ignored’

4 participants