Files
platform/todo/chat/show-how-long-a-turn-took-beside-its-cost.md
T

26 lines
1.3 KiB
Markdown

---
id: chat/show-how-long-a-turn-took-beside-its-cost
title: "Show how long a turn took, beside its cost and tokens"
theme: chat
status: open
created: 2026-08-21
date_source: stated
order: 1
---
**Show how long a turn took, beside its cost and tokens.** Wanted 2026-08-21. A timer running from the
start of each turn, and the elapsed time kept on the settled row — in the same place that already
renders cost and token count, not somewhere new.
That row is `MessageBubble.tsx:264`, and today it reads
`Done · ${message.cost.totalUSD.toFixed(3)} · {inputTokens + outputTokens} tokens`. Duration is the
third number that belongs there and is the only one missing.
Two things already exist and should be reused rather than rebuilt. `formatDuration` is in the same file
(~line 395), and the compaction row beside it already does exactly this job — its header comment says
the elapsed time is "honest for the window that watched it happen, and the settled row carries the
duration", which is the behaviour wanted here. What is missing is the field: `MessageCost` in
`Chat/types.ts:12` carries `totalUSD` and the token counters but no duration, while
`compact:done` carries `durationMs`. So the harness result has to bring it along, or the client has to
time the turn itself and keep it on the settled row.