Conversation
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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.
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.
introduce maxRequestsLimit (#281970) Co-authored-by: Isidor Nikolic <inikolic@microsoft.com>
No description provided.