mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-29 09:43:49 +01:00
* Memoize getFirstNonCopilotModel in scenario automation endpoint provider In scenario-automation runs against a BYOK no-auth user, `ScenarioAutomationEndpointProviderImpl.getChatEndpoint` is invoked many times per agent step (main model + utility + utility-small + tool detection + per-MCP-call). Each call hit `getFirstNonCopilotModel`, which always called `lm.selectChatModels()` (empty selector). The empty selector fans out across every registered language-model vendor and re-resolves each one — sustained ~4 Hz for an entire 10-minute agent turn in BYOK eval runs, ~2.4k empty-selector calls per turn, with 99.99 percent reporting `no changes`. Cache the first non-copilot model for the lifetime of the provider and invalidate on `lm.onDidChangeChatModels`, debounced through a `MicrotaskDelay` `Delayer` so synchronous bursts collapse into a single invalidation. The change listener is installed lazily on first cache use, so production paths that never hit the no-auth branch do not subscribe. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Fix stray brace from autofix; add logging for visibility - Repair syntax error introduced by autofix (extra closing brace after the IIFE block in _resolveFirstNonCopilotModel that prematurely closed the class). - Add diagnostic logs so an eval bundle at default level shows the BYOK redirect engaging (info on resolve and on cache invalidation) and trace logs identifying which redirect branch ran for each request. - Promote the silent `no models found` throw to error and the capi-proxy family-resolve fallback from trace to warn so both are visible at default log level. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>