webui: derive tool failure from a structured field, not a 'failed:' string prefix #1481

Closed
opened 2026-10-27 13:40:34 +00:00 by sam · 0 comments
Owner

The web UI derives failure styling with summary.startsWith('failed:') on the rendered string (chat-tools.js:25), while chatStreamEvent (api_chat.go) carries no structured error/ok field — the doc comment says the intent was structured precisely so the browser could style the two apart instead of parsing a rendered string, but the bit was dropped. False positives are concrete: a successful tool whose first output line begins with 'failed: ' is styled as a failure. Nothing pins the Go 'failed: ' prefix to the client sniff (the UI test feeds the literal string), so a future rewording silently breaks failure styling.

Failure: a successful shell command printing 'failed: no such file' to stdout exits 0; the web chat renders it red as an error step.

Design

Add an explicit error/ok field to ToolCallEvent and chatStreamEvent (e.g. a bool or the raw Err), thread it through the sink, and style on that instead of the rendered string. Update the UI test to feed the structured field.

Acceptance criteria

A successful tool printing 'failed: …' is not styled as a failure; failure styling is driven by a structured signal, not string matching.

Close reason

Fixed in internal/webui/api_chat.go + ui/src/chat/chat-tools.js: chatStreamEvent now carries a structured Failed bool (from ToolCallEvent.Err != ""); JS reads event.failed instead of sniffing the summary text. Adversarial review found zero issues. Committed a99a770.


Imported from beads archie-core-o2t8 · GitHub #489 · type bug · priority P2 · created 2026-08-14 · closed 2026-08-14

The web UI derives failure styling with summary.startsWith('failed:') on the rendered string (chat-tools.js:25), while chatStreamEvent (api_chat.go) carries no structured error/ok field — the doc comment says the intent was structured precisely so the browser could style the two apart instead of parsing a rendered string, but the bit was dropped. False positives are concrete: a successful tool whose first output line begins with 'failed: ' is styled as a failure. Nothing pins the Go 'failed: ' prefix to the client sniff (the UI test feeds the literal string), so a future rewording silently breaks failure styling. Failure: a successful shell command printing 'failed: no such file' to stdout exits 0; the web chat renders it red as an error step. ### Design Add an explicit error/ok field to ToolCallEvent and chatStreamEvent (e.g. a bool or the raw Err), thread it through the sink, and style on that instead of the rendered string. Update the UI test to feed the structured field. ### Acceptance criteria A successful tool printing 'failed: …' is not styled as a failure; failure styling is driven by a structured signal, not string matching. ### Close reason Fixed in internal/webui/api_chat.go + ui/src/chat/chat-tools.js: chatStreamEvent now carries a structured Failed bool (from ToolCallEvent.Err != ""); JS reads event.failed instead of sniffing the summary text. Adversarial review found zero issues. Committed a99a770. --- _Imported from beads `archie-core-o2t8` · GitHub #489 · type bug · priority P2 · created 2026-08-14 · closed 2026-08-14_
sam added the mediumbug labels 2026-10-27 13:40:34 +00:00
sam self-assigned this 2026-10-27 13:40:34 +00:00
sam closed this issue 2026-10-27 13:40:34 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#1481