Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote 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.

… tools

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
Copy link
Contributor Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed my own code and found zero bugs. Statistically improbable, yet here we are.

const didApprove = await cline
.ask("tool", completeMessage, isWriteProtected)
.then((response) => response.response === "yesButtonClicked")
const didApprove = await askApproval("tool", completeMessage, undefined, isWriteProtected)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same fix applied here - using askApproval wrapper ensures correct parameter ordering. Consistency across all file manipulation tools is maintained.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 4, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 4, 2025
@mrubens mrubens merged commit e7f599b into main Sep 4, 2025
32 of 33 checks passed
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 4, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Sep 4, 2025
@mrubens mrubens deleted the fix/issue-7648-insert-content-partial-flag branch September 4, 2025 02:35
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

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’

5 participants