Skip to content

Commit 7caf702

Browse files
committed
fix(tools): treat no-op file writes and edits as terminal tool-loop results
1 parent 053f313 commit 7caf702

3 files changed

Lines changed: 4 additions & 10 deletions

File tree

src/agents/sessions/tools/edit.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ export function createEditToolDefinition(
393393
return {
394394
...textResult(
395395
`No changes: one or more edits have identical old and new text in ${path}.`,
396-
{ status: "blocked" as const, reason: "no-op-edit" as const },
396+
undefined,
397397
),
398398
terminate: true,
399399
};
@@ -430,10 +430,7 @@ export function createEditToolDefinition(
430430
// No changes after applying edits — no-op.
431431
if (baseContent === newContent) {
432432
return {
433-
...textResult(`No changes: edits produced no diff in ${path}.`, {
434-
status: "blocked" as const,
435-
reason: "no-op-edit" as const,
436-
}),
433+
...textResult(`No changes: edits produced no diff in ${path}.`, undefined),
437434
terminate: true,
438435
};
439436
}

src/agents/sessions/tools/write.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ describe("write tool", () => {
9898
type: "text",
9999
text: `No changes: content is identical to existing ${filePath}`,
100100
});
101-
expect(result.details).toEqual({ status: "blocked", reason: "no-op-write" });
101+
expect(result.details).toBeUndefined();
102102
expect(result.terminate).toBe(true);
103103
});
104104

src/agents/sessions/tools/write.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -396,10 +396,7 @@ export function createWriteToolDefinition(
396396
const precheck = await readOriginalWriteState(absolutePath, content, ops);
397397
if (precheck.state === "same") {
398398
return {
399-
...textResult(`No changes: content is identical to existing ${path}`, {
400-
status: "blocked" as const,
401-
reason: "no-op-write" as const,
402-
}),
399+
...textResult(`No changes: content is identical to existing ${path}`, undefined),
403400
terminate: true,
404401
};
405402
}

0 commit comments

Comments
 (0)