Skip to content

Conversation

RomneyDa
Copy link
Collaborator

@RomneyDa RomneyDa commented Aug 20, 2025

Description

  • Adds new multi edit and single edit and replace tools with more robust prompting and args approach inspired from Continue CLI's approach. Adds a simple search/replace tool, the current search and replace tool is hidden, claude and gpt-5 models get a multi-edit tool with array args, and edit_existing_file tool is reinstated for poorer models.
  • Hides existing search and replace tool for now
  • Consolidates and simplifies config-dependent tool loading
  • Also hides the empty expanded codeblock if no changes yet for edit tool UIs

This also adds a diff UI for search and replace tools, merged on separate PR
https://github.com/continuedev/continue/pull/7367/files

CON-3200
CON-2741
CON-3072
CON-3580


Summary by cubic

Adds two precise editing tools: Single Find and Replace and Multi Edit, with client-side implementations and thorough tests. Centralizes tool selection in core to pick the best editing tool per model and environment.

  • New Features

    • Single Find and Replace: exact, validated replacements with optional replace_all.
    • Multi Edit: batch multiple edits to one file atomically; sequential, with replace_all support; can create new files by starting with an empty old_string.
    • Tool gating: use Multi Edit for Claude and GPT‑5 models; otherwise use Single Find and Replace plus Edit Existing File.
  • Refactors

    • Centralized tool selection in core/tools/index.ts; removed GUI-side model filtering.
    • Config loaders now use getBaseToolDefinitions; config-dependent tools receive isRemote and modelName.
    • grepSearch enabled only on local workspaces.
    • Built-in tool names and client routing updated to include the new tools.
    • Added comprehensive tests for both client implementations and updated gating tests.

@RomneyDa RomneyDa requested a review from a team as a code owner August 20, 2025 23:39
@RomneyDa RomneyDa requested review from tingwai and removed request for a team August 20, 2025 23:39
@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Aug 20, 2025
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This PR introduces two new editing tools (singleFindAndReplace and multiEdit) to replace the existing edit tools, with dynamic selection based on model capabilities. While the implementation is generally solid with good test coverage, there are concerns about hardcoded model name checks, potential breaking changes for existing tools, and some edge cases that need attention.


💡 To request a new detailed review, comment @continue-detailed-review

Copy link

Code Review Summary

✅ Strengths

  • Architecture: The PR implements a well-designed strategy to introduce new edit tools (singleFindAndReplace and multiEdit) while maintaining backward compatibility with the existing editFile tool
  • Model-Based Tool Selection: Smart routing of tools based on model capabilities (Claude and GPT-5 get multiEdit, others get singleFindAndReplace)
  • Test Coverage: Comprehensive test suites for both new client tool implementations with good edge case coverage
  • Validation: Strong input validation and error handling with clear error messages
  • Atomic Operations: multiEdit tool ensures all edits succeed or none are applied, preventing partial file updates

⚠️ Issues Found

High

  • Model Name Matching Logic: The model name matching in core/tools/index.ts uses simple string contains checks (modelName?.includes("claude") || modelName?.includes("gpt-5")). This could incorrectly match model names like "claude-instant" or custom models containing these strings. Consider using more precise model name patterns or a whitelist approach.

Medium

  • Missing Integration Tests: While unit tests are comprehensive, there are no integration tests verifying the end-to-end flow from tool invocation through the IDE messenger to file modification
  • Incomplete Tool Migration: The old searchAndReplaceInFileTool is commented as "CURRENTLY NOT USED" but the code and tests are still present. This creates confusion about which tools are active

Low

  • Inconsistent Tool Descriptions: The multiEditTool description mentions it can create new files with empty old_string, but this behavior isn't clearly documented in the singleFindAndReplaceTool
  • Missing Environment Variable: The isRemote parameter is being passed but there's no clear documentation about how remote environments affect tool availability

💡 Suggestions

  • Model Configuration: Consider moving model-specific tool assignments to configuration rather than hardcoding them. This would allow easier updates as new models are released
  • Deprecation Strategy: Add clear deprecation notices to the old searchAndReplaceInFile tool and create a migration guide for users
  • Performance Optimization: For multiEdit, consider adding a dry-run mode to validate all edits before applying any changes
  • Documentation: Add examples to the tool descriptions showing common use cases like file creation, bulk renaming, and complex refactoring

🚀 Overall Assessment

APPROVE

This PR successfully introduces powerful new editing capabilities with a thoughtful migration strategy. The code quality is high with good test coverage and error handling. The issues identified are mostly about configuration flexibility and code cleanup rather than functional problems. The new tools provide a better user experience, especially for Claude models that can leverage the more sophisticated multiEdit tool.


💡 To request a new review, comment @continue-general-review

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

3 issues found across 16 files

React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.

@RomneyDa RomneyDa marked this pull request as draft August 22, 2025 01:09
@RomneyDa RomneyDa marked this pull request as ready for review August 22, 2025 18:45
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

3 issues found across 23 files

React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

approved by tomasz on #7367

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

approved by tomasz on #7367

gui/package.json Outdated
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

approved by tomasz on #7367

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

approved by tomasz on #7367

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

approved by tomasz on #7367

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

approved by tomasz on #7367

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

approved by tomasz on #7367

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

approved by tomasz on #7367

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

approved by tomasz on #7367

@@ -297,6 +254,19 @@ export const streamNormalInput = createAsyncThunk<
const newState = getState();
const toolSettings = newState.ui.toolSettings;
const allToolCallStates = selectCurrentToolCalls(newState);

await Promise.all(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

approved by tomasz on #7367

Copy link
Collaborator

@tingwai tingwai left a comment

Choose a reason for hiding this comment

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

Thanks for addressing comments!

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Aug 25, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 25, 2025
@RomneyDa RomneyDa merged commit b25d4af into main Aug 25, 2025
68 of 84 checks passed
@RomneyDa RomneyDa deleted the dallin/search_and_replace_makeover branch August 25, 2025 22:01
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Aug 25, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Aug 25, 2025
@github-actions github-actions bot added the tier 1 Big feature that took multiple weeks to launch and represents a big milestone for the product label Aug 25, 2025
@sestinj
Copy link
Contributor

sestinj commented Aug 25, 2025

🎉 This PR is included in version 1.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm This PR has been approved by a maintainer released size:XXL This PR changes 1000+ lines, ignoring generated files. tier 1 Big feature that took multiple weeks to launch and represents a big milestone for the product
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants