From 9bdfc5c14b0dc0cdeb98f7ea3d20e9ebd4ffb119 Mon Sep 17 00:00:00 2001 From: Vijay Upadya <41652029+vijayupadya@users.noreply.github.com> Date: Thu, 19 Mar 2026 17:00:59 -0700 Subject: [PATCH] Agent debug log export: include session Id in filename and show success notification (#303334) * agent debug export notification * feedbackl updates --- .../actions/chatOpenAgentDebugPanelAction.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/chat/browser/actions/chatOpenAgentDebugPanelAction.ts b/src/vs/workbench/contrib/chat/browser/actions/chatOpenAgentDebugPanelAction.ts index 263c8839baf..0f48de3cae2 100644 --- a/src/vs/workbench/contrib/chat/browser/actions/chatOpenAgentDebugPanelAction.ts +++ b/src/vs/workbench/contrib/chat/browser/actions/chatOpenAgentDebugPanelAction.ts @@ -14,6 +14,7 @@ import { ContextKeyExpr } from '../../../../../platform/contextkey/common/contex import { IDialogService, IFileDialogService } from '../../../../../platform/dialogs/common/dialogs.js'; import { IFileService } from '../../../../../platform/files/common/files.js'; import { INotificationService, Severity } from '../../../../../platform/notification/common/notification.js'; +import { IOpenerService } from '../../../../../platform/opener/common/opener.js'; import { ITelemetryService } from '../../../../../platform/telemetry/common/telemetry.js'; import { ActiveEditorContext } from '../../../../common/contextkeys.js'; import { IEditorService } from '../../../../services/editor/common/editorService.js'; @@ -25,6 +26,7 @@ import { CHAT_CATEGORY, CHAT_CONFIG_MENU_ID } from './chatActions.js'; import { ChatDebugEditorInput } from '../chatDebug/chatDebugEditorInput.js'; import { Codicon } from '../../../../../base/common/codicons.js'; import { IChatDebugEditorOptions } from '../chatDebug/chatDebugTypes.js'; +import { LocalChatSessionUri } from '../../common/model/chatUri.js'; /** * Registers the Open Agent Debug Logs and Show Agent Debug Logs actions. @@ -127,6 +129,7 @@ export function registerChatOpenAgentDebugPanelAction() { const fileDialogService = accessor.get(IFileDialogService); const fileService = accessor.get(IFileService); const notificationService = accessor.get(INotificationService); + const openerService = accessor.get(IOpenerService); const telemetryService = accessor.get(ITelemetryService); const sessionResource = chatDebugService.activeSessionResource; @@ -135,7 +138,11 @@ export function registerChatOpenAgentDebugPanelAction() { return; } - const defaultUri = joinPath(await fileDialogService.defaultFilePath(), defaultDebugLogFileName); + const localSessionId = LocalChatSessionUri.parseLocalSessionId(sessionResource); + const rawIdentifier = localSessionId ?? (sessionResource.path.replace(/^\//, '') || sessionResource.authority); + const sessionIdentifier = rawIdentifier?.replace(/[/\\:*?"<>|.]+/g, '_').replace(/^_+|_+$/g, ''); + const exportFileName = sessionIdentifier ? `agent-debug-log-${sessionIdentifier}.json` : defaultDebugLogFileName; + const defaultUri = joinPath(await fileDialogService.defaultFilePath(), exportFileName); const outputPath = await fileDialogService.showSaveDialog({ defaultUri, filters: debugLogFilters }); if (!outputPath) { return; @@ -152,6 +159,15 @@ export function registerChatOpenAgentDebugPanelAction() { telemetryService.publicLog2('chatDebugLogExported', { fileSizeBytes: data.byteLength, }); + + notificationService.prompt( + Severity.Info, + localize('chatDebugLog.exportSuccess', "Agent debug log exported successfully."), + [{ + label: localize('chatDebugLog.openExportedFile', "Open File"), + run: () => openerService.open(outputPath) + }] + ); } });