diff options
Diffstat (limited to 'src/features/chat/logic')
| -rw-r--r-- | src/features/chat/logic/tool-summary.test.ts | 14 | ||||
| -rw-r--r-- | src/features/chat/logic/tool-summary.ts | 4 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/features/chat/logic/tool-summary.test.ts b/src/features/chat/logic/tool-summary.test.ts index 381842a..876ede2 100644 --- a/src/features/chat/logic/tool-summary.test.ts +++ b/src/features/chat/logic/tool-summary.test.ts @@ -85,6 +85,18 @@ describe("tool summaries", () => { ]); expect(view("edit_file", { path: "a" }).callBadges).toEqual([]); }); + it("omits edit diffstats after failure while retaining attempted edits in call details", () => { + const input = { path: "src/missing.ts", oldString: "foo", newString: "bar" }; + const card = view("edit_file", input, "Error: oldString not found", true); + expect(card.callBadges).toEqual([]); + expect(card.callDetail).toEqual({ + kind: "edit", + path: input.path, + oldText: "foo", + newText: "bar", + }); + expect(card.resultSummary).toBe("failed"); + }); it("preserves exact shell commands in the expanded detail", () => { expect(view("run_shell", { command: "ls\n pwd" }).callDetail).toEqual({ kind: "command", @@ -228,7 +240,7 @@ describe("tool summaries", () => { }); expect(viewToolEntry(e).callDetail).toEqual({ kind: "unavailable", - text: "The call is in earlier, unloaded history. Its response is shown below.", + text: "This call is earlier in the conversation. Show earlier messages to see it.", }); }); }); diff --git a/src/features/chat/logic/tool-summary.ts b/src/features/chat/logic/tool-summary.ts index 2e7680c..3ea4a8e 100644 --- a/src/features/chat/logic/tool-summary.ts +++ b/src/features/chat/logic/tool-summary.ts @@ -251,7 +251,7 @@ export function viewToolEntry(entry: ToolEntry): ToolCardView { ? "Call in earlier history" : oneLine(builtInSummary || generic || serialize(input)); const callBadges: ToolCardView["callBadges"][number][] = []; - if (entry.toolName === "edit_file" && entry.call !== null) { + if (entry.toolName === "edit_file" && entry.call !== null && !entry.result?.isError) { if (typeof args.oldString === "string" && typeof args.newString === "string") { callBadges.push( { label: `+${lineCount(args.newString)}`, tone: "success" }, @@ -272,7 +272,7 @@ export function viewToolEntry(entry: ToolEntry): ToolCardView { entry.call === null ? { kind: "unavailable", - text: "The call is in earlier, unloaded history. Its response is shown below.", + text: "This call is earlier in the conversation. Show earlier messages to see it.", } : detail(entry.toolName, input, args), resultSummary, |
