From 87e6108688849dc201fcd2b50e4e36cd62a6a53e Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Sat, 24 Jan 2026 09:44:50 +0100 Subject: [PATCH] Agents control: every chat interaction shows 1-progress, 1-unread (fix #289831) (#290114) * Agents control: every chat interaction shows 1-progress, 1-unread (fix #289831) * Add chat widget service event listeners to agent title bar status widget (#290121) * Initial plan * Add chat widget service event listeners to update active/unread counts 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> --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: bpasero <900690+bpasero@users.noreply.github.com> --- .../experiments/agentTitleBarStatusWidget.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentTitleBarStatusWidget.ts b/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentTitleBarStatusWidget.ts index 5cbf617ce54..eaf1411e933 100644 --- a/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentTitleBarStatusWidget.ts +++ b/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentTitleBarStatusWidget.ts @@ -45,6 +45,7 @@ import { mainWindow } from '../../../../../../base/browser/window.js'; import { LayoutSettings } from '../../../../../services/layout/browser/layoutService.js'; import { ChatConfiguration } from '../../../common/constants.js'; import { ChatEntitlement, IChatEntitlementService } from '../../../../../services/chat/common/chatEntitlementService.js'; +import { IChatWidgetService } from '../../chat.js'; // Action IDs const TOGGLE_CHAT_ACTION_ID = 'workbench.action.chat.toggle'; @@ -108,6 +109,7 @@ export class AgentTitleBarStatusWidget extends BaseActionViewItem { @IStorageService private readonly storageService: IStorageService, @IConfigurationService private readonly configurationService: IConfigurationService, @IChatEntitlementService private readonly chatEntitlementService: IChatEntitlementService, + @IChatWidgetService private readonly chatWidgetService: IChatWidgetService, ) { super(undefined, action, options); @@ -172,6 +174,15 @@ export class AgentTitleBarStatusWidget extends BaseActionViewItem { this._lastRenderState = undefined; // Force re-render this._render(); })); + + // Re-render when chat widgets are added or backgrounded to update active/unread session counts + this._register(this.chatWidgetService.onDidAddWidget(() => { + this._render(); + })); + + this._register(this.chatWidgetService.onDidBackgroundSession(() => { + this._render(); + })); } override render(container: HTMLElement): void { @@ -294,9 +305,8 @@ export class AgentTitleBarStatusWidget extends BaseActionViewItem { ? sessions.filter(s => !excludedProviders.includes(s.providerType)) : sessions; - const activeSessions = filteredSessions.filter(s => isSessionInProgressStatus(s.status) && !s.isArchived()); - const unreadSessions = filteredSessions.filter(s => !s.isRead()); - // Sessions that need user attention (approval/confirmation/input) + const activeSessions = filteredSessions.filter(s => isSessionInProgressStatus(s.status) && !s.isArchived() && !this.chatWidgetService.getWidgetBySessionResource(s.resource)); + const unreadSessions = filteredSessions.filter(s => !s.isRead() && !this.chatWidgetService.getWidgetBySessionResource(s.resource)); const attentionNeededSessions = filteredSessions.filter(s => s.status === AgentSessionStatus.NeedsInput); return {