fix(sessions): Top tools counts each tool call once
The session analysis page's Top tools list counted every event carrying a tool_name, so each call was counted twice (its PreToolUse and its PostToolUse) while the Tool calls total beside it counted once — a session with 840 calls showed Bash at 1,533. The list now counts the same way as the total: PreToolUse, or PostToolUse in a session with none (imported).
This commit is contained in:
@@ -702,7 +702,7 @@ router.get("/:id/file", async (req, res) => {
|
||||
function sessionStats(sessionId) {
|
||||
const totalEvents = stmts.sessionEventCount.get(sessionId)?.count ?? 0;
|
||||
const eventsByType = stmts.sessionEventTypeCounts.all(sessionId);
|
||||
const tools = stmts.sessionToolUsageCounts.all(sessionId);
|
||||
const tools = stmts.sessionToolUsageCounts.all(sessionId, sessionId);
|
||||
// Exact totals: `tools_used` is a top-15 list, so its sum is not the count.
|
||||
// A tool call is a PreToolUse; a session with none (imported) counts PostToolUse.
|
||||
const toolTotals = stmts.sessionToolCallTotals.get(sessionId) || {};
|
||||
|
||||
Reference in New Issue
Block a user