Reduce noise from quota exceeded input notification#322005
Draft
pwang347 wants to merge 1 commit into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces repeated chat “credit limit reached” input notifications by persisting a user dismissal of the quota-exhausted banner across window reloads, and clearing that persisted dismissal once quota becomes available again.
Changes:
- Persist a boolean flag in
IStorageServicewhen the user dismisses the exhausted/quota-exceeded notification. - Suppress re-showing the exhausted notification (including managed-plan blocked / overage-at-100% variants) while the persisted dismissal is set.
- Add unit tests to validate dismissal persistence across “reloads” and that the notification can re-appear after quota recovery.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/browser/chatQuotaNotification.ts | Persists and checks an “exhausted dismissed” storage flag to avoid re-showing quota-exceeded notifications across reloads until quota recovers. |
| src/vs/workbench/contrib/chat/test/browser/chatQuotaNotification.test.ts | Extends the mock notification service to support dismissal events and adds tests covering dismissal persistence and reset-on-recovery. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 3
Comment on lines
117
to
+133
| private _update(): void { | ||
| const entitlement = this._chatEntitlementService.entitlement; | ||
| const isCopilot = this._isCopilotModelSelected(); | ||
|
|
||
| // Defer new notifications when a BYOK model is selected or the model | ||
| // selection hasn't loaded yet — quota only applies to Copilot models. | ||
| // Already-shown notifications stay visible. | ||
| if (!isCopilot) { | ||
| return; | ||
| } | ||
|
|
||
| // Once quota recovers (credit is available again) drop any persisted | ||
| // dismissal so the quota-exceeded notification can show the next time | ||
| // quota runs out. | ||
| if (!this._isExhaustedState()) { | ||
| this._clearExhaustedDismissed(); | ||
| } |
Comment on lines
+275
to
+279
| const notification = first.notificationMock.getNotification(); | ||
| assert.ok(notification); | ||
| first.notificationMock.dismiss(notification!.id); | ||
|
|
||
| // Reload: new contribution with the same (persisted) storage and still-exhausted quota. |
Comment on lines
+297
to
+304
| first.notificationMock.dismiss(first.notificationMock.getNotification()!.id); | ||
|
|
||
| // Quota recovers — persisted dismissal is cleared. | ||
| updateQuotas(first.entitlementMock, { premiumChat: makeQuotaSnapshot(50) }); | ||
|
|
||
| // Reload while exhausted again — notification shows because the flag was cleared. | ||
| const second = createContribution( | ||
| { quotas: { usageBasedBilling: true, premiumChat: makeQuotaSnapshot(0) } }, |
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.