Sync quota snapshots#318460
Draft
pwang347 wants to merge 1 commit into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds quota snapshot synchronization between the VS Code workbench and the Copilot extension, exposing proposed API surface for quota updates and wiring those updates through extension host/main thread services.
Changes:
- Adds proposed
ChatQuotaSnapshot(s)API and quota update/event methods undervscode.chat. - Introduces extension host/main thread quota actors and forwards quota snapshots through chat usage progress.
- Updates the Copilot extension quota service/contribution to consume quota snapshots pushed from core.
Show a summary per file
| File | Description |
|---|---|
src/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts |
Adds proposed quota snapshot types and chat quota sync API. |
src/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts |
Adds optional quota snapshot payload to chat usage reporting. |
src/vs/workbench/services/chat/common/chatEntitlementService.ts |
Allows quota acceptance to be silent and exports quota shape. |
src/vs/workbench/api/common/extHostChatQuota.ts |
Adds extension-host quota event/update bridge. |
src/vs/workbench/api/common/extHostChatAgents2.ts |
Forwards quota snapshots in chat usage DTOs. |
src/vs/workbench/api/common/extHost.protocol.ts |
Adds quota DTOs and RPC shape identifiers. |
src/vs/workbench/api/common/extHost.api.impl.ts |
Exposes proposed quota API on vscode.chat. |
src/vs/workbench/api/browser/mainThreadChatQuota.ts |
Adds main-thread quota customer syncing entitlement changes to extensions. |
src/vs/workbench/api/browser/mainThreadChatAgents2.ts |
Applies quota snapshots received with chat progress. |
src/vs/workbench/api/browser/extensionHost.contribution.ts |
Registers the main-thread quota customer. |
extensions/copilot/src/platform/chat/common/chatQuotaServiceImpl.ts |
Adds core quota snapshot ingestion in Copilot quota service. |
extensions/copilot/src/platform/chat/common/chatQuotaService.ts |
Extends Copilot quota service interface/types for core snapshots. |
extensions/copilot/src/extension/chat/vscode-node/chatQuota.contribution.ts |
Subscribes Copilot extension to core quota change events. |
Copilot's findings
- Files reviewed: 11/13 changed files
- Comments generated: 4
| @@ -190,6 +191,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I | |||
| rpcProtocol.set(ExtHostContext.ExtHostDataChannels, extHostDataChannels); | |||
| rpcProtocol.set(ExtHostContext.ExtHostMeteredConnection, extHostMeteredConnection); | |||
| rpcProtocol.set(ExtHostContext.ExtHostGitExtension, extHostGitExtensionService); | |||
Comment on lines
+93
to
+98
| this._quotaInfo = { | ||
| quota: snapshot.entitlement ?? 0, | ||
| unlimited: snapshot.unlimited, | ||
| hasQuota: snapshot.hasQuota ?? true, | ||
| percentRemaining: snapshot.percentRemaining, | ||
| additionalUsageUsed: 0, |
| percentRemaining: snapshot.percentRemaining, | ||
| additionalUsageUsed: 0, | ||
| additionalUsageEnabled: quotas.additionalUsageEnabled ?? false, | ||
| resetDate: this._quotaInfo?.resetDate ?? new Date(), |
| this._quotaInfo = undefined; | ||
| } | ||
|
|
||
| acceptCoreQuotas(quotas: CoreQuotaSnapshots): void { |
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.
No description provided.