webui: filter out empty messages
This shouldn't happen, but they do sometimes.
They're ugly but are harmless (or so it appears).
Filter them away.
Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: sc3177fd6d7337586k
diff --git a/webui/src/web-components/aggregateAgentMessages.ts b/webui/src/web-components/aggregateAgentMessages.ts
index 5347540..edd98d1 100644
--- a/webui/src/web-components/aggregateAgentMessages.ts
+++ b/webui/src/web-components/aggregateAgentMessages.ts
@@ -18,6 +18,14 @@
if (msg.type == "slug" || msg.type == "compact") {
return false;
}
+ // Filter out messages with empty/missing content unless they have tool_calls or commits
+ const hasContent = msg.content && msg.content.trim().length > 0;
+ const hasToolCalls = msg.tool_calls && msg.tool_calls.length > 0;
+ const hasCommits = msg.commits && msg.commits.length > 0;
+
+ if (!hasContent && !hasToolCalls && !hasCommits) {
+ return false;
+ }
if (seenIds.has(msg.idx)) {
return false; // Skip if idx is already seen
}