From 1182025c4cdac8b437fb758764f31f7ec6b64661 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Thu, 7 May 2026 22:40:55 -0700 Subject: [PATCH] feat(web): refine run stage metric column Render sub-second tool/command durations in milliseconds (e.g. 321ms) instead of 0.3s. Round token counts to whole k/M. Wrap assistant token metric in a tooltip showing the input/output breakdown. Allow Tooltip labels to be arbitrary React nodes. Co-Authored-By: Claude Opus 4.7 (1M context) --- apps/fabro-web/app/components/ui.tsx | 6 +-- apps/fabro-web/app/routes/run-stages.tsx | 49 ++++++++++++++++++------ 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/apps/fabro-web/app/components/ui.tsx b/apps/fabro-web/app/components/ui.tsx index 6c4701ca8..485941dbf 100644 --- a/apps/fabro-web/app/components/ui.tsx +++ b/apps/fabro-web/app/components/ui.tsx @@ -68,7 +68,7 @@ export function Tooltip({ label, children, }: { - label: string; + label: React.ReactNode; children: React.ReactNode; }) { const [open, setOpen] = useState(false); @@ -92,7 +92,7 @@ export function Tooltip({ {rect && portalTarget ? createPortal( - {label} - , + , portalTarget, ) : null} diff --git a/apps/fabro-web/app/routes/run-stages.tsx b/apps/fabro-web/app/routes/run-stages.tsx index 39ec1a7c8..c564c75f2 100644 --- a/apps/fabro-web/app/routes/run-stages.tsx +++ b/apps/fabro-web/app/routes/run-stages.tsx @@ -433,8 +433,8 @@ function formatDurationMs(ms: number): string { function formatTokenCount(n: number): string { if (n < 1000) return `${n}`; - if (n < 1_000_000) return `${(n / 1000).toFixed(1)}k`; - return `${(n / 1_000_000).toFixed(1)}M`; + if (n < 1_000_000) return `${Math.round(n / 1000)}k`; + return `${Math.round(n / 1_000_000)}M`; } export function turnMetric(turn: TurnType): string | null { @@ -488,6 +488,17 @@ function EventRow({ }) { const metric = turnMetric(turn); const MetricIcon = metric == null ? null : turn.kind === "assistant" ? CircleStackIcon : ClockIcon; + const metricSpan = ( + + {turn.kind === "tool" && turn.isError && ( + + Error + + )} + {MetricIcon && + ); return (