-
-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Severity: CRITICAL
Summary
computeThroughput in live.pure.ts divides by 60000 (assuming milliseconds), but ActivitySample.timestamp is stored in seconds by the reducer (use-dashboard-state.ts:236 does Math.floor(action.payload.timestamp / 1000)). This causes throughput to be displayed 1000x higher than actual.
Reproduction
If 10 tool calls happen over 60 seconds, the timestamp difference is 60 (seconds). The function calculates 60 / 60000 = 0.001 min, yielding 10 / 0.001 = 10000.0/min instead of the correct 10.0/min.
Root Cause
File: apps/mcp-server/src/tui/components/live.pure.ts:60
// Current (bug) — assumes milliseconds
const durationMin = (last.timestamp - first.timestamp) / 60000;
// Fix — timestamps are in seconds
const durationMin = (last.timestamp - first.timestamp) / 60;Why tests missed it: live.pure.spec.ts:152-176 uses millisecond values (60000, 30000) directly in test data, which don't match the reducer's actual output format (seconds).
Fix Plan
- Change
/60000to/60incomputeThroughput - Update test data in
live.pure.spec.tsto use second-based timestamps matching reducer output - Add test for reverse-order samples (guard at
durationMin <= 0)
Files to Modify
apps/mcp-server/src/tui/components/live.pure.ts:60apps/mcp-server/src/tui/components/live.pure.spec.ts:152-176
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working