webui: suppress patch edit count when tool call fails
Instead of showing misleading edit counts like '66 edits' when a patch
tool call fails, now shows 'failed' when tool_error is true.
Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: s8ccc88517ab9d41ak
diff --git a/webui/src/web-components/sketch-tool-card.ts b/webui/src/web-components/sketch-tool-card.ts
index 300558b..44c8df9 100644
--- a/webui/src/web-components/sketch-tool-card.ts
+++ b/webui/src/web-components/sketch-tool-card.ts
@@ -232,11 +232,14 @@
render() {
const patchInput = JSON.parse(this.toolCall?.input);
+ const toolFailed = this.toolCall?.result_message?.tool_error;
const summaryContent = html`<span
class="text-gray-600 font-mono overflow-hidden text-ellipsis whitespace-nowrap rounded"
>
- ${patchInput?.path}: ${patchInput.patches.length}
- edit${patchInput.patches.length > 1 ? "s" : ""}
+ ${toolFailed
+ ? `${patchInput?.path}: failed`
+ : `${patchInput?.path}: ${patchInput.patches.length} edit${patchInput.patches.length > 1 ? "s" : ""}`
+ }
</span>`;
const inputContent = html``;