Skip to content

Sync quota snapshots#318460

Draft
pwang347 wants to merge 1 commit into
mainfrom
pawang/syncUbb
Draft

Sync quota snapshots#318460
pwang347 wants to merge 1 commit into
mainfrom
pawang/syncUbb

Conversation

@pwang347
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings May 26, 2026 23:10
Copy link
Copy Markdown
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 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 under vscode.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 {
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.

2 participants