-
Notifications
You must be signed in to change notification settings - Fork 36.7k
introduce maxRequestsLimit #281970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
introduce maxRequestsLimit #281970
Conversation
There was a problem hiding this 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
maximumproperty 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, |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
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;
})(),
| 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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't actually work as-is because this only drives a validation warning, it won't limit the real value. The setting is read in the extension and we would have to enforce it there.
No description provided.