UBB fixes for agent host#321056
Closed
pwang347 wants to merge 2 commits into
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts agent-host chat/session behavior for usage-based billing and model selection fallbacks, aligning agent-host error handling with the main chat UI and adding a dedicated extension-point flag to control whether “Auto” is available for a session type.
Changes:
- Add
autoModelUnavailable/autoModelUnavailableForSessionTypeto distinguish “requires custom model pool” from “cannot use Auto”. - Surface agent-host terminal turn errors as structured
errorDetails(quota/rate-limit flags + friendly quota messaging) on the live invoke path. - Extend tests to validate the new structured error mapping and quota message behavior.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/test/common/mockChatSessionsService.ts | Adds mock implementation for autoModelUnavailableForSessionType. |
| src/vs/workbench/contrib/chat/test/browser/agentSessions/stateToProgressAdapter.test.ts | Adds unit tests for errorInfoToChatErrorDetails and buildQuotaExceededMessage. |
| src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts | Updates error-event tests to assert structured errorDetails, including quota behavior. |
| src/vs/workbench/contrib/chat/common/chatSessionsService.ts | Extends extension point + service interface with autoModelUnavailable. |
| src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts | Switches Auto-fallback gating logic to the new autoModelUnavailable signal. |
| src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts | Registers schema property + implements autoModelUnavailableForSessionType in service. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/stateToProgressAdapter.ts | Adds error-to-structured-details mapping and plan-aware quota message builder. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts | Injects entitlement service and returns structured errorDetails; suppresses inline markdown errors on live invoke path. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLanguageModelProvider.ts | Adds helper to derive whether Auto is unavailable for an agent-host provider. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatContribution.ts | Sets autoModelUnavailable on agent-host session contributions. |
| src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHost.contribution.ts | Propagates autoModelUnavailable for sessions window remote agent host sessions. |
| src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsProvider.ts | Uses autoModelUnavailableForSessionType for model picker options. |
| src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts | Uses autoModelUnavailableForSessionType for model picker options. |
| extensions/copilot/package.json | Sets autoModelUnavailable: true for the Claude agent session contribution. |
Copilot's findings
- Files reviewed: 14/14 changed files
- Comments generated: 6
Comment on lines
+181
to
+186
| /** | ||
| * Builds a user-friendly, localized quota-exceeded message keyed on the user's | ||
| * entitlement and (when known) quota reset date. The accompanying upgrade / | ||
| * manage-budget button is rendered separately by `ChatQuotaExceededPart` based | ||
| * on entitlement, so this text intentionally avoids duplicating that action. | ||
| */ |
Comment on lines
+195
to
+197
| return reset | ||
| ? localize('agentHost.quota.free.reset', "You've reached your monthly credit limit. Upgrade to Copilot Pro or wait until your credits reset on {0}.", reset) | ||
| : localize('agentHost.quota.free', "You've reached your monthly credit limit. Upgrade to Copilot Pro or wait for your credits to reset."); |
Comment on lines
+1504
to
+1507
| assert.strictEqual( | ||
| buildQuotaExceededMessage({ entitlement: ChatEntitlement.Free }), | ||
| 'You\'ve reached your monthly credit limit. Upgrade to Copilot Pro or wait for your credits to reset.', | ||
| ); |
| quotaResetDate: '2026-06-30T17:00:00.000Z', | ||
| quotaResetDateHasTime: true, | ||
| }); | ||
| assert.ok(message.startsWith('You\'ve reached your monthly credit limit. Upgrade to Copilot Pro or wait until your credits reset on ')); |
Comment on lines
+2185
to
+2188
| assert.deepStrictEqual(result.errorDetails, { | ||
| message: 'You\'ve reached your monthly credit limit. Upgrade to Copilot Pro or wait for your credits to reset.', | ||
| isQuotaExceeded: true, | ||
| }); |
Comment on lines
+1486
to
+1489
| assert.deepStrictEqual(details, { | ||
| message: 'You\'ve reached your monthly credit limit. Upgrade to Copilot Pro or wait for your credits to reset.', | ||
| isQuotaExceeded: true, | ||
| }); |
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.