Utilize pipelining of grep_search -> read_file to eliminate turns (#19574)

This commit is contained in:
Christian Gunderman
2026-02-21 00:36:10 +00:00
committed by GitHub
parent 727f9b67b1
commit 5d98ed5820
10 changed files with 590 additions and 165 deletions
+11
View File
@@ -30,6 +30,7 @@ import { ApprovalMode } from '../policy/types.js';
import { CoreToolCallStatus } from '../scheduler/types.js';
import { DEFAULT_DIFF_OPTIONS, getDiffStat } from './diffOptions.js';
import { getDiffContextSnippet } from './diff-utils.js';
import {
type ModifiableDeclarativeTool,
type ModifyContext,
@@ -871,6 +872,16 @@ class EditToolInvocation
? `Created new file: ${this.params.file_path} with provided content.`
: `Successfully modified file: ${this.params.file_path} (${editData.occurrences} replacements).`,
];
// Return a diff of the file before and after the write so that the agent
// can avoid the need to spend a turn doing a verification read.
const snippet = getDiffContextSnippet(
editData.currentContent ?? '',
finalContent,
5,
);
llmSuccessMessageParts.push(`Here is the updated code:
${snippet}`);
const fuzzyFeedback = getFuzzyMatchFeedback(editData);
if (fuzzyFeedback) {
llmSuccessMessageParts.push(fuzzyFeedback);