fix(webui): style tool-call failure from a structured field, not a string prefix

chatStreamEvent gained a Failed bool, set from ToolCallEvent.Err !=
"" -- the field the rest of the codebase already treats as
authoritative -- rather than the browser sniffing summary.startsWith
"failed:" on rendered text. A successful tool whose own output starts
with that literal string (a grep hit, a log line read back) was being
styled as a failed step.
This commit is contained in:
sam committed 2026-08-15 01:48:29 +10:00
1 parent 707af1dde5
commit c2e8638d24
4 files changed
+36 -9

No files matched your search

+6 -2
View File
@@ -21,8 +21,12 @@ export function appendToolCall(host, event) {
parameters && el("code.chat-tool-parameters", parameters),
el("span.chat-tool-summary", summary),
);
// A failure reads as a completed step unless it is marked as one.
if (summary.startsWith("failed:")) line.className = "chat-tool failed";
// A failure reads as a completed step unless it is marked as one. Styled
// from the structured `failed` field the server sends, not by sniffing
// the summary text: a successful tool can print output that itself starts
// with "failed:" (e.g. a grep hit, a log line), which a string prefix
// check would misread as the tool call itself having failed.
if (event.failed) line.className = "chat-tool failed";
toolList(host).append(line);
return line;