feat(dashboard): per-tool token attribution chart in run header tooltip #1006
No reviewers
Labels
No labels
area:agents
area:dashboard
area:database
area:design
area:design-review
area:flows
area:infra
area:meta
area:security
area:sessions
area:webhook
area:workdir
security
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/claude-hooks!1006
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "dev/969"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds live per-tool token attribution to the context-window-meter tooltip.
Changes
ToolKindgains a synthetic"system"member for model-output tokens attributed when no tool call is openTaskRecord.usageByTool: Partial<Record<ToolKind, ToolUsage>>accumulates per-kind input token counts server-sideevent-log.tsattributes eachusage_deltato the first opentoolCallRowsentry's kind (or"system"), broadcasts the map inside the existing 250 ms-coalesced SSE envelopeuseTaskSSEpatchesusageByToolinto the React Query cache live<TokenAttributionChart>: stacked horizontal bar + legend sorted by descending share; top-3 kinds shown explicitly, remainder collapsed under "other (N kinds)" with nativetitlebreakdown on hover<ContextWindowMeter>wraps in a CSSgroup-hovertooltip panel that renders<TokenAttributionChart>when attribution data is presentTest plan
ctx X%meter — attribution chart appears once the firstusage_deltaarrivesusageByToolis absent (pre-#969 history rows)just qacleanCloses #969
apps/web/src/components/run-header-meters.tsxline 178:pointer-events-noneon the tooltip wrapper makes the entire panel non-interactive. The PR description promises "remaining kinds appear under 'other (N)' with hover breakdown" but the nativetitleon that row is unreachable because mouse events pass through the overlay. Worse, when the user moves their cursor from the meter into the tooltip area, events fall through to whatever is below.group, which ends the:hoverstate and collapses the tooltip immediately. Fix: removepointer-events-nonefrom that div — hovering over an absolutely-positioned child keeps the.groupancestor's:hoveractive, sogroup-hover:blockcontinues to work correctly.Minor (non-blocking):
packages/shared/src/task-record.tsJSDoc says "Onlyinput_tokensis tracked per kind" butevent-log.tsaccumulates bothinput_tokensandoutput_tokensintoToolUsage. Comment should say both fields are tracked.Both issues fixed in the latest push:
pointer-events-noneremoved — the tooltip wrapper no longer passes through mouse events, so hovering into the panel keeps the.groupancestor's:hoveractive andgroup-hover:blockcontinues to work correctly.usageByToolnow documents that bothinput_tokensandoutput_tokensare accumulated per kind (matching lines 797–798 ofevent-log.ts).Prior
pointer-events-noneissue resolved — tooltip is now interactive so the "other (N)"titlehover works. CI green.