sessions - always prefer session label (#298926)

* sessions - always prefer session label

* Update src/vs/sessions/contrib/sessions/browser/sessionsTitleBarWidget.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Benjamin Pasero
2026-03-03 11:59:56 +01:00
committed by GitHub
parent 5c7e861e70
commit 858363ee8d

View File

@@ -233,20 +233,19 @@ export class SessionsTitleBarWidget extends BaseActionViewItem {
/**
* Get the label of the active chat session.
* Prefers the live model title over the snapshot label from the active session service.
* Falls back to a generic label if no active session is found.
*/
private _getActiveSessionLabel(): string {
const activeSession = this.activeSessionService.getActiveSession();
if (activeSession?.resource) {
const model = this.chatService.getSession(activeSession.resource);
if (model?.title) {
return model.title;
}
const label = activeSession?.label;
if (label) {
return label; // prefer session label to support renamed sessions
}
if (activeSession?.label) {
return activeSession.label;
if (activeSession) {
const activeModel = this.chatService.getSession(activeSession.resource);
if (activeModel?.title) {
return activeModel.title; // fall back to chat model title if available
}
}
return localize('agentSessions.newSession', "New Session");