chat: log customization provider results to Agent Debug Logs#307285
chat: log customization provider results to Agent Debug Logs#307285joshspicer wants to merge 3 commits intomainfrom
Conversation
Adds a static Plugins instance so extensions can use
ChatSessionCustomizationType.Plugins instead of constructing
new ChatSessionCustomizationType('plugins') manually.
Also adds explicit mapping in mainThread section conversion.
…ider metadata Inverts the semantics from a blacklist (types to hide) to a whitelist (types to show). More natural API: providers declare what they support rather than what they don't. When omitted, all sections are shown.
Adds debug event logging for extension-contributed customization providers, following the same pattern as PromptsDebugContribution: - Logs each provideChatSessionCustomizations call with item count, type breakdown, and timing - Registers a resolve provider for expandable file list details - Uses category 'discovery' so events are filtered by the existing 'Chat Customization' toggle in Agent Debug Logs
There was a problem hiding this comment.
Pull request overview
This PR adds Agent Debug Logs instrumentation for extension-contributed chat session customization providers, and aligns the proposed API surface with the supportedTypes whitelist and the new Plugins customization type.
Changes:
- Add
ChatSessionCustomizationType.Pluginsand wire it through ext host types/serialization. - Rename provider metadata
unsupportedTypes→supportedTypesacross the proposed d.ts, DTOs, and ext host registration. - Log customization provider discovery results (counts, type breakdown, timing) to Agent Debug Logs and register a resolver for expandable file-list details.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vscode-dts/vscode.proposed.chatSessionCustomizationProvider.d.ts | Adds Plugins type and renames metadata capability field to supportedTypes. |
| src/vs/workbench/api/common/extHostTypes.ts | Exposes ChatSessionCustomizationType.Plugins in ext host types. |
| src/vs/workbench/api/common/extHostChatAgents2.ts | Sends supportedTypes to the main thread during provider registration. |
| src/vs/workbench/api/common/extHost.protocol.ts | Updates provider metadata DTO field name to supportedTypes. |
| src/vs/workbench/api/browser/mainThreadChatAgents2.ts | Logs provider results to Agent Debug Logs, adds resolver backing store, and computes hidden sections from supportedTypes. |
| const start = Date.now(); | ||
| const items = await this._proxy.$provideChatSessionCustomizations(handle, token); | ||
| const durationInMillis = Date.now() - start; | ||
| if (!items) { | ||
| return undefined; |
There was a problem hiding this comment.
This early return means discovery events aren’t logged when a provider returns undefined (unavailable) even though the PR description says each provideChatSessionCustomizations call is logged. Consider logging a 0/"unavailable" result (and duration) before returning so the debug log shows calls consistently.
| const start = Date.now(); | ||
| const items = await this._proxy.$provideChatSessionCustomizations(handle, token); | ||
| const durationInMillis = Date.now() - start; |
There was a problem hiding this comment.
Timing is measured with Date.now() but later formatted with toFixed(1), which will always yield *.0ms and is sensitive to system clock changes. Prefer StopWatch.create(true) (or performance.now) for high-resolution, monotonic timing so the debug logs show accurate durations.
| this._chatDebugService.log( | ||
| sessionResource, | ||
| `Customization Provider (${label})`, | ||
| details, | ||
| ChatDebugLogLevel.Info, | ||
| { id: eventId, category: 'discovery' }, |
There was a problem hiding this comment.
The debug event title/details strings here are user-visible in the Agent Debug Logs UI but are not localized. Other discovery/debug log entries (e.g. prompt discovery) use localize(...); please externalize these strings as well and avoid manual pluralization in the raw template string.
| byType.set(item.type, (byType.get(item.type) ?? 0) + 1); | ||
| } | ||
| const typeSummary = [...byType.entries()].map(([type, count]) => `${count} ${type}`).join(', '); | ||
| const details = `${items.length} items (${typeSummary}) in ${durationInMillis.toFixed(1)}ms`; |
There was a problem hiding this comment.
If a provider returns an empty array, typeSummary becomes an empty string and the log renders as 0 items () .... Handle the empty case to avoid the stray parentheses (and consider omitting the breakdown when there are no items).
| const details = `${items.length} items (${typeSummary}) in ${durationInMillis.toFixed(1)}ms`; | |
| const details = typeSummary | |
| ? `${items.length} items (${typeSummary}) in ${durationInMillis.toFixed(1)}ms` | |
| : `${items.length} items in ${durationInMillis.toFixed(1)}ms`; |
| uri: item.uri, | ||
| name: item.name, | ||
| status: 'loaded' as const, | ||
| storage: item.groupKey, |
There was a problem hiding this comment.
storage in IChatDebugFileEntry is meant to represent the storage/source label (and is used for grouping in the discovery renderer). Setting it to item.groupKey is misleading because groupKey is just a UI grouping hint for the customizations editor. Consider omitting storage here (or populating extensionId / a real source label) and, if you want to surface groupKey, include it in the file name/details instead.
| storage: item.groupKey, |
|
|
||
| return { | ||
| kind: 'fileList', | ||
| discoveryType: 'customization-provider', |
There was a problem hiding this comment.
discoveryType: 'customization-provider' will render in the discovery UI as "Customization-provider" (simple first-letter capitalization) and won’t map to any known discovery settings key. If this should appear as a first-class discovery type, consider either using a renderer-friendly identifier (or adding a special-case label/settings mapping in the discovery renderer) so the UI output is readable and consistent.
| discoveryType: 'customization-provider', | |
| discoveryType: 'customizationProvider', |
Adds debug event logging for extension-contributed customization providers to the Agent Debug Logs panel.\n\n- Logs each
provideChatSessionCustomizationscall with item count, type breakdown, and timing\n- Registers a resolve provider for expandable file list details\n- Uses category'discovery'so events are filtered by the existing "Chat Customization" toggle\n\nDepends on: #307278 (API changes)