Skip to content

UBB fixes for agent host#321056

Closed
pwang347 wants to merge 2 commits into
mainfrom
pawang/agentHostBilling
Closed

UBB fixes for agent host#321056
pwang347 wants to merge 2 commits into
mainfrom
pawang/agentHostBilling

Conversation

@pwang347

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings June 11, 2026 23:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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 / autoModelUnavailableForSessionType to 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,
});
@pwang347 pwang347 closed this Jun 12, 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.

2 participants