From 896b0faff1bfca90557ca5067ca160b3d41498f7 Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Mon, 22 Jun 2026 11:37:37 +0900 Subject: fix(metrics): skip unanchored step-metrics — no more empty bubbles at tail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Step-metrics are only shown when anchored to their tool content (inline after the tool-call/result group). Steps whose chunks were trimmed (or text-only steps with no tool chunks) are now SKIPPED instead of piling up at the segment tail as empty 'step N · X tok' bubbles. The turn-total metrics row still shows the aggregate (tokens, duration, cache rate), so the conversation-level summary is preserved. Updated place.test.ts + ui.test.ts to anchor steps with tool-call groups where step-metrics are expected. --- src/features/chat/ui.test.ts | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'src/features/chat/ui.test.ts') diff --git a/src/features/chat/ui.test.ts b/src/features/chat/ui.test.ts index e541015..94db0ae 100644 --- a/src/features/chat/ui.test.ts +++ b/src/features/chat/ui.test.ts @@ -329,6 +329,18 @@ describe("ChatView", () => { chunk: { type: "text", text: "Hello!" }, provisional: false, }, + { + seq: 3, + role: "assistant", + chunk: { + type: "tool-call", + toolCallId: "tc1", + toolName: "test", + input: {}, + stepId: "t1#0" as StepId, + }, + provisional: false, + }, ]; const turnMetrics: TurnMetricsEntry[] = [ @@ -502,6 +514,18 @@ describe("ChatView", () => { chunk: { type: "text", text: "Response" }, provisional: false, }, + { + seq: 3, + role: "assistant", + chunk: { + type: "tool-call", + toolCallId: "tc1", + toolName: "test", + input: {}, + stepId: "t1#0" as StepId, + }, + provisional: false, + }, ]; const turnMetrics: TurnMetricsEntry[] = [ @@ -547,6 +571,18 @@ describe("ChatView", () => { chunk: { type: "text", text: "Hello!" }, provisional: false, }, + { + seq: 3, + role: "assistant", + chunk: { + type: "tool-call", + toolCallId: "tc1", + toolName: "test", + input: {}, + stepId: "t1#0" as StepId, + }, + provisional: false, + }, ]; const turnMetrics: TurnMetricsEntry[] = [ -- cgit v1.2.3