From d9d4a448948e7d55dc9d22d33add4ef0893d7ca9 Mon Sep 17 00:00:00 2001 From: Pedram Amini Date: Sun, 1 Feb 2026 22:24:04 -0600 Subject: [PATCH] feat(history): add elapsed time tracking for USER history entries Add elapsed time calculation when creating USER history entries via the saveToHistory/synopsis feature. Time is calculated from lastSynopsisTime (if a previous synopsis exists) or tabCreatedAt (for first synopsis). This complements the existing elapsed time tracking for AUTO entries. --- src/renderer/App.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/renderer/App.tsx b/src/renderer/App.tsx index 9f24c3f8..8e83e92c 100644 --- a/src/renderer/App.tsx +++ b/src/renderer/App.tsx @@ -1993,6 +1993,7 @@ function MaestroConsoleInner() { tabName?: string; tabId?: string; lastSynopsisTime?: number; + tabCreatedAt?: number; toolType?: ToolType; sessionConfig?: { customPath?: string; @@ -2136,6 +2137,7 @@ function MaestroConsoleInner() { tabName, tabId: completedTab?.id, lastSynopsisTime: completedTab?.lastSynopsisTime, // Track when last synopsis was generated + tabCreatedAt: completedTab?.createdAt, // Track tab creation for elapsed time calculation toolType: currentSession.toolType, // Pass tool type for multi-provider support sessionConfig: { customPath: currentSession.customPath, @@ -2519,6 +2521,13 @@ function MaestroConsoleInner() { // IMPORTANT: Pass explicit sessionId and projectPath to prevent cross-agent bleed // when user switches agents while synopsis is running in background + // Calculate elapsed time since last synopsis (or tab creation if no previous synopsis) + const elapsedTimeMs = synopsisData!.lastSynopsisTime + ? synopsisTime - synopsisData!.lastSynopsisTime + : synopsisData!.tabCreatedAt + ? synopsisTime - synopsisData!.tabCreatedAt + : undefined; + addHistoryEntryRef.current({ type: 'USER', summary: parsed.shortSummary, @@ -2528,6 +2537,7 @@ function MaestroConsoleInner() { sessionId: synopsisData!.sessionId, projectPath: synopsisData!.cwd, sessionName: synopsisData!.tabName, + elapsedTimeMs, }); // Update lastSynopsisTime on the tab so future synopses know the time window