From d1524b3376546edeaeb74d8f5c3a5257289ea9cf Mon Sep 17 00:00:00 2001 From: Rohit C Prasad Date: Tue, 28 Jul 2026 11:42:44 -0700 Subject: [PATCH] Usage popover: label rows as session totals Section header 'Session totals' + pluralized cache rows make the cumulative semantics explicit. --- surfaces/gui/e2e/usage-chip.spec.ts | 4 +++- surfaces/gui/src/components/Composer.tsx | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/surfaces/gui/e2e/usage-chip.spec.ts b/surfaces/gui/e2e/usage-chip.spec.ts index 04ab5325..807ac6ea 100644 --- a/surfaces/gui/e2e/usage-chip.spec.ts +++ b/surfaces/gui/e2e/usage-chip.spec.ts @@ -30,9 +30,11 @@ test("usage chip appears after a turn and opens the breakdown popover", async ({ await expect(pop).toBeVisible(); await expect(pop).toContainText("Context window"); await expect(pop).toContainText("9.8k of 200k · 5%"); + await expect(pop).toContainText("Session totals"); await expect(pop).toContainText("Claude Opus 4.8 · Anthropic"); await expect(pop).toContainText("Input"); - await expect(pop).toContainText("Cache read"); + await expect(pop).toContainText("Cache reads"); + await expect(pop).toContainText("Cache writes"); // Total input = fresh 1k + cache_read 8k + cache_write 800 (cumulative billed input). await expect(pop).toContainText("Total input"); await expect(pop).toContainText("9.8k"); diff --git a/surfaces/gui/src/components/Composer.tsx b/surfaces/gui/src/components/Composer.tsx index f446796b..0e353a6a 100644 --- a/surfaces/gui/src/components/Composer.tsx +++ b/surfaces/gui/src/components/Composer.tsx @@ -650,7 +650,7 @@ function UsageChip({ ) : null}
- This session + Session totals
{Object.entries(usage.byModel).map(([id, t]) => ( @@ -660,8 +660,8 @@ function UsageChip({
{stat("Input", t.input)} - {t.cache_read > 0 && stat("Cache read", t.cache_read)} - {t.cache_write > 0 && stat("Cache write", t.cache_write)} + {t.cache_read > 0 && stat("Cache reads", t.cache_read)} + {t.cache_write > 0 && stat("Cache writes", t.cache_write)} {/* Cumulative billed input volume = fresh + cache reads + cache writes (each class bills at its own rate). Shown only when a cache split exists — otherwise it would duplicate Input. */}