-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat: rename search_and_replace tool to edit and unify edit-family UI #11296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hannesrudolph
wants to merge
14
commits into
main
Choose a base branch
from
feat/rename-search-and-replace-to-edit
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,268
−970
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
All previously flagged issues are now resolved. No new issues in latest commit.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
01335c6 to
0a1377c
Compare
52ad6f3 to
285a161
Compare
…ture - Add new 'edit' tool with file_path, old_string, new_string, replace_all params - Keep search_and_replace as backward-compatible alias via TOOL_ALIASES - Create EditTool execution handler with replace_all and uniqueness checking - Update NativeToolCallParser for both edit and search_and_replace names - Update presentAssistantMessage routing for both tool names - Add alias resolution to isToolAllowedForMode for customTools validation - Reduce SearchAndReplaceTool.ts to re-export wrapper from EditTool - Add 16 new EditTool tests, update searchAndReplaceTool tests - MiniMax includedTools: ['search_and_replace'] continues to work via alias
- route edit/search/patch-related tool events through the appliedDiff chat UI branch - ensure apply_patch partial rows emit a deterministic non-empty path - add apply_patch partial regression tests - expand ChatRow diff-actions tests for unified behavior
09a6b8a to
793be28
Compare
daniel-lxs
approved these changes
Feb 11, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Enhancement
New feature or request
lgtm
This PR has been approved by a maintainer
size:XXL
This PR changes 1000+ lines, ignoring generated files.
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
Replaces the
search_and_replacetool with a newedittool that uses a flat, single-operation parameter model (file_path,old_string,new_string,replace_all), replacing the old batchoperationsarray. Keepssearch_and_replaceas a backward-compatible alias so models that reference it (e.g. MiniMax viaincludedTools) continue to work without changes. Unifies the chat UI rendering for all edit-family tool events.Behavioral note: The old
search_and_replaceaccepted an array of operations per call (with partial-success semantics). The newedittool handles exactly one replacement per invocation, enforces uniqueness by default, and rejects no-op edits whereold_string === new_string.Changes
edittool definition (src/core/prompts/tools/native-tools/edit.ts) withfile_path,old_string,new_string,replace_allparametersEditToolexecution handler (src/core/tools/EditTool.ts) withreplace_allsupport, uniqueness checking, and identical-string guardsearch_and_replace: "edit"toTOOL_ALIASES— models withincludedTools: ["search_and_replace"]get theedittool renamed assearch_and_replaceNativeToolCallParser.tshandles both"edit"and"search_and_replace"tool names with the new parameter structurepresentAssistantMessage.tsroutes both tool names toEditToolisToolAllowedForModenow resolves aliases when checking customTools and toolRequirements, ensuringsearch_and_replaceinincludedToolscorrectly maps toeditSearchAndReplaceTool.tsreduced to a 2-line re-export fromEditTool"edit"totoolNames,"replace_all"totoolParamNames, updatedNativeToolArgsfor botheditandsearch_and_replacecontainsXmlToolMarkup()guardrail inpresentAssistantMessage.tshas been removed — it was a leftover from the XML-to-native tool calling migration that added maintenance burden (short tool names like"edit"caused false positives on words like<editor>) without meaningful benefit since all tool calling is now nativeeditedExistingFile,appliedDiff,newFileCreated,searchAndReplace,search_and_replace,search_replace,edit,edit_file,apply_patch,apply_diff) render through a single branch inChatRow.tsxwith consistent diff icon, header text, and batch-diff supportapply_patchpartial preview fix: Partial approval rows now extract a deterministic non-empty path from patch headers, falling back to the workspace basename — eliminates blank initial approval rows during streamingTest Results
src/suite: 341 passed (29 pre-existing failures from missing@ai-sdk/amazon-bedrock— unrelated)packages/types: 170/170 passingTest details
EditTooltests covering basic replacement,replace_all, uniqueness errors, no-match errors, identical-string guard, missing params, approval flow, partial blocks, error recovery, and file trackingsearchAndReplaceTool.spec.tsreduced to alias verification (searchAndReplaceTool === editTool)applyPatchTool.partial.spec.tsfor partial path extraction (header parsing, multi-file determinism, truncated-header stability, fallback, outside-workspace detection)ChatRow.diff-actions.spec.tsxrewritten to verify unified edit rendering, jump-to-file fornewFileCreated, protected/outside-workspace messaging, and batch diff handlingHistoryPreview.spec.tsx, increased cache-clear timeout incustom-tool-registry.spec.tsImportant
Introduces a new
edittool to replacesearch_and_replace, unifies edit-related UI, and updates tests for backward compatibility.edittool with parametersfile_path,old_string,new_string,replace_all.edittool replacessearch_and_replace, which remains as an alias for backward compatibility.ChatRow.tsx.editedExistingFile,appliedDiff,newFileCreated,searchAndReplace,edit, etc.EditToolinEditTool.ts.presentAssistantMessage.ts.NativeToolCallParser.tsto handleeditandsearch_and_replacewith new parameters.validateToolUseto resolve tool aliases.EditToolineditTool.spec.ts.ChatRow.diff-actions.spec.tsxto verify unified edit rendering.searchAndReplaceTool.spec.ts.This description was created by
for a3361d8. You can customize this summary. It will automatically update as commits are pushed.