Mark session as read when opened in Sessions window (#306603)

* Initial plan

* fix: mark session as read when opening it in Sessions window

When a session was marked as unread via the context menu, clicking on it
again did not change it back to read. This adds setRead(session, true) in
sessionsManagementService.openSession() and openChat(), following the same
pattern used in agentSessionsOpener.ts.

Agent-Logs-Url: https://github.com/microsoft/vscode/sessions/04e61e19-5790-4bc5-8075-95457ae5adbd

Co-authored-by: bpasero <900690+bpasero@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: bpasero <900690+bpasero@users.noreply.github.com>
This commit is contained in:
Copilot
2026-03-31 07:08:46 +00:00
committed by GitHub
parent 121d7eb3cd
commit bb01c58f40

View File

@@ -467,6 +467,9 @@ export class SessionsManagementService extends Disposable implements ISessionsMa
this.logService.info(`[SessionsManagement] openChat: ${chatResource.toString()} provider=${chat?.providerId}`);
this.isNewChatSessionContext.set(false);
this.setActiveSession(sessionData);
if (sessionData) {
this.setRead(sessionData, true); // mark as read when opened
}
await this.chatWidgetService.openSession(chatResource, ChatViewPaneTarget);
}
@@ -480,6 +483,7 @@ export class SessionsManagementService extends Disposable implements ISessionsMa
this.logService.info(`[SessionsManagement] openSession: ${sessionResource.toString()} provider=${sessionData.providerId}`);
this.isNewChatSessionContext.set(false);
this.setActiveSession(sessionData);
this.setRead(sessionData, true); // mark as read when opened
const activeChatResource = sessionData.activeChat.get().resource;
await this.chatWidgetService.openSession(activeChatResource, ChatViewPaneTarget, { preserveFocus: options?.preserveFocus });