Skip to content

Conversation

@isidorn
Copy link
Collaborator

@isidorn isidorn commented Dec 8, 2025

No description provided.

@isidorn isidorn added this to the December / January 2026 milestone Dec 8, 2025
@isidorn isidorn self-assigned this Dec 8, 2025
Copilot AI review requested due to automatic review settings December 8, 2025 14:33
Copy link
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 introduces a new experiment-based configuration for limiting the maximum number of requests allowed per-turn when using a chat agent. The change adds a chatAgentMaxRequestsLimit experiment treatment that sets an upper bound on the chat.agent.maxRequests configuration setting.

  • Fetches an additional experiment treatment (chatAgentMaxRequestsLimit) alongside the existing per-tier treatments
  • Sets the maximum property in the configuration schema based on the experiment value

type: 'number',
markdownDescription: nls.localize('chat.agent.maxRequests', "The maximum number of requests to allow per-turn when using an agent. When the limit is reached, will ask to confirm to continue."),
default: defaultValue,
maximum: maxLimit,
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The maxLimit value from the experiment service can be undefined if the treatment is not set. When maximum: undefined is set in the configuration schema, it should either be omitted from the properties object or have a fallback value. Consider handling this case explicitly:

const configProperty: IConfigurationPropertySchema = {
	type: 'number',
	markdownDescription: nls.localize('chat.agent.maxRequests', "The maximum number of requests to allow per-turn when using an agent. When the limit is reached, will ask to confirm to continue."),
	default: defaultValue,
};
if (maxLimit !== undefined) {
	configProperty.maximum = maxLimit;
}

This ensures the maximum property is only added when a valid limit is available from the experiment.

See below for a potential fix:

						'chat.agent.maxRequests': (() => {
							const prop: any = {
								type: 'number',
								markdownDescription: nls.localize('chat.agent.maxRequests', "The maximum number of requests to allow per-turn when using an agent. When the limit is reached, will ask to confirm to continue."),
								default: defaultValue,
							};
							if (maxLimit !== undefined) {
								prop.maximum = maxLimit;
							}
							return prop;
						})(),

Copilot uses AI. Check for mistakes.
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.

3 participants