From 35d4291e40e23a92daf91995c2ce6bfca0254350 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 26 Jan 2026 09:45:49 +0100 Subject: [PATCH] refactor - simplify session grouping logic in `groupAgentSessionsByActive` --- .../agentSessions/agentSessionsViewer.ts | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.ts b/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.ts index 5177c71603fb0..64e667279eace 100644 --- a/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.ts +++ b/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.ts @@ -735,16 +735,11 @@ export function groupAgentSessionsByActive(sessions: IAgentSession[]): Map mostRecentSession.time) { - mostRecentSession = { session, time: sessionTime }; // always keep track of the most recent session - } - if (session.isArchived()) { historySessions.add(session); } else { + const sessionTime = session.timing.lastRequestEnded ?? session.timing.lastRequestStarted ?? session.timing.created; if ( isSessionInProgressStatus(session.status) || // in-progress !session.isRead() || // unread @@ -758,17 +753,6 @@ export function groupAgentSessionsByActive(sessions: IAgentSession[]): Map= startOfYesterday && - !activeSessions.has(mostRecentSession.session) - ) { - historySessions.delete(mostRecentSession.session); - activeSessions.add(mostRecentSession.session); - } - return new Map([ [AgentSessionSection.Active, { section: AgentSessionSection.Active, label: AgentSessionSectionLabels[AgentSessionSection.Active], sessions: [...activeSessions] }], [AgentSessionSection.History, { section: AgentSessionSection.History, label: localize('agentSessions.historySectionWithCount', "History ({0})", historySessions.size), sessions: [...historySessions] }],