Skip to content

Improve CLI quota message#315797

Merged
lramos15 merged 1 commit into
mainfrom
lramos15/skilled-bison
May 11, 2026
Merged

Improve CLI quota message#315797
lramos15 merged 1 commit into
mainfrom
lramos15/skilled-bison

Conversation

@lramos15
Copy link
Copy Markdown
Member

Copilot AI review requested due to automatic review settings May 11, 2026 17:53
@lramos15 lramos15 enabled auto-merge (squash) May 11, 2026 17:53
@lramos15 lramos15 self-assigned this May 11, 2026
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 improves how Copilot CLI chat sessions surface quota-exceeded errors by reusing the per-plan quota messaging that already exists for other chat flows, so users get a consistent, polished quota message.

Changes:

  • Extracted per-plan quota messaging into a reusable helper (getQuotaMessageForPlan).
  • Added quota detection in Copilot CLI session error handling and rethrew as a dedicated CopilotCLIQuotaExceededError.
  • Updated CLI chat participants to convert that error into errorDetails with isQuotaExceeded: true.
Show a summary per file
File Description
extensions/copilot/src/platform/chat/common/commonTypes.ts Extracts quota message selection into getQuotaMessageForPlan for reuse.
extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts Maps CLI quota errors to errorDetails.isQuotaExceeded for the sessions UI flow.
extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessions.ts Maps CLI quota errors to errorDetails.isQuotaExceeded for the main CLI chat sessions flow.
extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSession.ts Detects quota errors from SDK events and throws a specialized quota error with the per-plan message.

Copilot's findings

Comments suppressed due to low confidence (1)

extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSession.ts:1485

  • When a quota error is detected, a CopilotCLIQuotaExceededError is thrown before updating the session status. Because _status was set to InProgress at the start of the request, this path leaves the session stuck InProgress (and can block subsequent requests via the “already busy” check and keep the session item showing as active). Set _status to Failed (and fire _statusChange) before throwing the quota error, and ensure any required cleanup/telemetry still happens for this terminal state.
			if (isQuotaError) {
				this._chatQuotaService.clearQuota();
				let plan: string | undefined;
				try {
					const copilotToken = await this._authenticationService.getCopilotToken();
					plan = copilotToken.copilotPlan;
				} catch { /* token unavailable */ }
				throw new CopilotCLIQuotaExceededError(getQuotaMessageForPlan(plan));
			}
  • Files reviewed: 4/4 changed files
  • Comments generated: 1

Comment on lines +1419 to +1423
if (event.data.errorType === 'quota' || event.data.statusCode === 402) {
isQuotaError = true;
} else {
requestStream?.markdown(l10n.t('\n\nError: ({0}) {1}', event.data.errorType, event.data.message));
}
@lramos15 lramos15 merged commit ef7c6a1 into main May 11, 2026
29 checks passed
@lramos15 lramos15 deleted the lramos15/skilled-bison branch May 11, 2026 18:34
@vs-code-engineering vs-code-engineering Bot added this to the 1.121.0 milestone May 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.

Quota exceeded message in CLI needs polish

3 participants