Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR plumbs Copilot per-request usage credits (from copilot_usage.total_nano_aiu) through the chat debug event pipeline and surfaces an aggregated “Copilot Usage (AIC)” metric in the Agent Debug Logs overview.
Changes:
- Extend chat debug “model turn” events (proposed API + internal DTOs) with
copilotUsageNanoAiu. - Emit and persist the
copilot_usage.total_nano_aiuvalue from Copilot OTel spans/debug logs into chat debug model turn events. - Display total Copilot usage (converted to AIC) in the Chat Debug Overview “Summary” metrics.
Show a summary per file
| File | Description |
|---|---|
| src/vscode-dts/vscode.proposed.chatDebug.d.ts | Adds copilotUsageNanoAiu to the proposed ChatDebugModelTurnEvent API surface. |
| src/vs/workbench/contrib/chat/common/chatDebugService.ts | Extends internal model-turn debug event type with copilotUsageNanoAiu. |
| src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugOverviewView.ts | Aggregates nano-AIU usage and conditionally renders “Copilot Usage (AIC)” in the overview metrics. |
| src/vs/workbench/api/common/extHostTypes.ts | Adds copilotUsageNanoAiu to the extension-host type wrapper for model turn events. |
| src/vs/workbench/api/common/extHostChatDebug.ts | Serializes/deserializes copilotUsageNanoAiu between ext host objects and DTOs. |
| src/vs/workbench/api/common/extHost.protocol.ts | Extends the model-turn event DTO with copilotUsageNanoAiu. |
| src/vs/workbench/api/browser/mainThreadChatDebug.ts | Forwards copilotUsageNanoAiu through main-thread event serialization and revival. |
| extensions/copilot/src/platform/otel/common/genAiAttributes.ts | Introduces an OTel attribute key for copilot_usage.total_nano_aiu. |
| extensions/copilot/src/extension/trajectory/vscode-node/otelSpanToChatDebugEvent.ts | Maps the new OTel attribute into vscode.ChatDebugModelTurnEvent.copilotUsageNanoAiu. |
| extensions/copilot/src/extension/prompt/node/chatMLFetcher.ts | Attaches copilot_usage.total_nano_aiu onto inference spans as an attribute. |
| extensions/copilot/src/extension/chat/vscode-node/chatDebugFileLoggerService.ts | Includes copilotUsageNanoAiu when logging spans to the debug log file format. |
Copilot's findings
- Files reviewed: 10/11 changed files
- Comments generated: 1
dmitrivMS
approved these changes
May 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #314417
CC @vijayupadya