Skip to content

Add onDidReceiveChatDebugEvent API to send chat customization events#300617

Merged
vijayupadya merged 4 commits intomainfrom
vijayu/sendDebugCoreEvents
Mar 11, 2026
Merged

Add onDidReceiveChatDebugEvent API to send chat customization events#300617
vijayupadya merged 4 commits intomainfrom
vijayu/sendDebugCoreEvents

Conversation

@vijayupadya
Copy link
Contributor

Add a new proposed API event onDidReceiveChatDebugEvent on vscode.chat that fires when VS Code core logs a debug event (e.g., prompt discovery, skill/instruction loading). This enables extensions to capture core-originated events in real-time.

Copilot AI review requested due to automatic review settings March 11, 2026 01:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new proposed chatDebug API surface that streams VS Code core-originated chat debug events to extensions in real time, enabling extensions to capture core debug activity (e.g., prompt discovery / skill loading) as it happens.

Changes:

  • Add proposed API vscode.chat.onDidReceiveChatDebugEvent (Event<ChatDebugEvent>).
  • Forward core events from IChatDebugService.onDidAddEvent (main thread) to the extension host via a new ExtHost RPC method.
  • Enrich prompt discovery debug log details payload with file/folder information.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/vscode-dts/vscode.proposed.chatDebug.d.ts Adds the new proposed vscode.chat.onDidReceiveChatDebugEvent event.
src/vs/workbench/contrib/chat/browser/promptsDebugContribution.ts Expands prompt discovery log details to include file/folder paths to surface in forwarded event payloads.
src/vs/workbench/api/common/extHostChatDebug.ts Adds an ExtHost emitter and RPC handler to receive and re-emit core debug events.
src/vs/workbench/api/common/extHost.protocol.ts Extends the ExtHost shape with $onCoreDebugEvent for main-thread-to-ext-host forwarding.
src/vs/workbench/api/common/extHost.api.impl.ts Wires the proposed vscode.chat.onDidReceiveChatDebugEvent API to the ExtHost event.
src/vs/workbench/api/browser/mainThreadChatDebug.ts Forwards core debug events to the extension host in real time.
Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/chat/browser/promptsDebugContribution.ts:62

  • f.uri.path.split('/').pop() can return an empty string (e.g. when the path ends with /). Because ?? doesn’t treat '' as nullish, this would produce blank entries in the loaded/skipped arrays. Consider using a helper that guarantees a non-empty basename (or falling back when the basename is empty).
				const loaded = info.files.filter(f => f.status === 'loaded').map(f => f.name ?? f.uri.path.split('/').pop() ?? f.uri.toString());
				const skipped = info.files.filter(f => f.status === 'skipped').map(f => f.name ?? f.uri.path.split('/').pop() ?? f.uri.toString());
				const folders = info.sourceFolders?.map(sf => sf.uri.path) ?? [];

Comment on lines +54 to +58
// Enrich details with file paths so they appear in the event
// payload (e.g. forwarded via onDidReceiveChatDebugEvent to the
// extension's JSONL file logger).
let details = entry.details;
if (entry.discoveryInfo) {
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new details enrichment logic isn’t covered by existing tests (e.g. details undefined, formatting, and any truncation behavior you add). Adding a focused unit test in promptsDebugContribution.test.ts would help prevent regressions since this string is now part of the payload forwarded to extensions.

Copilot uses AI. Check for mistakes.
* Join a list of strings, truncating after {@link MAX_LIST_ITEMS} entries.
* Full details are available via {@link IChatDebugService.resolveEvent}.
*/
function truncateList(items: string[]): string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is just for discovery events, maybe no need to truncate?

pwang347
pwang347 previously approved these changes Mar 11, 2026
@vijayupadya vijayupadya marked this pull request as ready for review March 11, 2026 03:45
@vijayupadya vijayupadya merged commit 112d873 into main Mar 11, 2026
20 checks passed
@vijayupadya vijayupadya deleted the vijayu/sendDebugCoreEvents branch March 11, 2026 03:45
@vs-code-engineering vs-code-engineering bot added this to the 1.112.0 milestone Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants