From 5ad2b7fcd142c4fa8a55ffb7b22efe393963ed9f Mon Sep 17 00:00:00 2001 From: Osvaldo Ortega Date: Fri, 13 Mar 2026 13:09:38 -0700 Subject: [PATCH] Add logging for repository name resolution in AgentSessionsDataSource and AgentSessionsControl --- .../chat/browser/agentSessions/agentSessionsControl.ts | 4 +++- .../chat/browser/agentSessions/agentSessionsViewer.ts | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.ts b/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.ts index afefa7448ab..97260bb9db3 100644 --- a/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.ts +++ b/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.ts @@ -42,6 +42,7 @@ import { ChatEditorInput } from '../widgetHosts/editor/chatEditorInput.js'; import { IMouseEvent } from '../../../../../base/browser/mouseEvent.js'; import { IChatWidget } from '../chat.js'; import { IStorageService, StorageScope, StorageTarget } from '../../../../../platform/storage/common/storage.js'; +import { ILogService } from '../../../../../platform/log/common/log.js'; export interface IAgentSessionsControlOptions extends IAgentSessionsSorterOptions { readonly overrideStyles: IStyleOverride; @@ -108,6 +109,7 @@ export class AgentSessionsControl extends Disposable implements IAgentSessionsCo @ITelemetryService private readonly telemetryService: ITelemetryService, @IEditorService private readonly editorService: IEditorService, @IStorageService private readonly storageService: IStorageService, + @ILogService private readonly logService: ILogService, ) { super(); @@ -248,7 +250,7 @@ export class AgentSessionsControl extends Disposable implements IAgentSessionsCo ...this.options, isGroupedByRepository: () => this.options.filter.groupResults?.() === AgentSessionsGrouping.Repository, }, approvalModel, activeSessionResource)); - const sessionFilter = this._register(new AgentSessionsDataSource(this.options.filter, sorter)); + const sessionFilter = this._register(new AgentSessionsDataSource(this.options.filter, sorter, this.logService)); const list = this.sessionsList = this._register(this.instantiationService.createInstance(WorkbenchCompressibleAsyncDataTree, 'AgentSessionsView', container, diff --git a/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.ts b/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.ts index 6d3c8ea7135..f1a671dfa67 100644 --- a/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.ts +++ b/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.ts @@ -49,6 +49,7 @@ import { Button } from '../../../../../base/browser/ui/button/button.js'; import { defaultButtonStyles } from '../../../../../platform/theme/browser/defaultStyles.js'; import { AgentSessionApprovalModel } from './agentSessionApprovalModel.js'; import { BugIndicatingError } from '../../../../../base/common/errors.js'; +import { ILogService } from '../../../../../platform/log/common/log.js'; export type AgentSessionListItem = IAgentSession | IAgentSessionSection; @@ -751,6 +752,7 @@ export class AgentSessionsDataSource extends Disposable implements IAsyncDataSou constructor( private readonly filter: IAgentSessionsFilter | undefined, private readonly sorter: ITreeSorter, + private readonly logService?: ILogService, ) { super(); } @@ -884,6 +886,13 @@ export class AgentSessionsDataSource extends Disposable implements IAsyncDataSou } const repoName = this.getRepositoryName(session); + if (!repoName) { + this.logService?.warn('[AgentSessions] Could not determine repository name for session, categorizing as "Other"', { + resource: session.resource.toString(), + badge: session.badge ? (typeof session.badge === 'string' ? session.badge : session.badge.value) : undefined, + metadata: session.metadata, + }); + } const repoId = repoName || unknownKey; const repoLabel = repoName || unknownLabel;