mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-12 09:50:11 -05:00
* fix: cache CCA disabled results with 5-min TTL to reduce /enabled traffic
The checkCCAEnabled() method previously only cached enabled=true results
(introduced in 19541d79ea). For the majority of users whose repos have CCA
disabled, every provideChatSessionProviderOptions() call bypassed the cache
and hit the jobs/:owner/:repo/enabled CAPI endpoint unconditionally. With
growing adoption, this became significant upstream traffic.
Fix: cache all /enabled results. enabled=true keeps the 30-min TTL.
enabled=false/undefined uses a new 5-min TTL (CCA_DISABLED_CACHE_TTL_MS),
short enough that users who just enabled CCA won't wait long, but long enough
to dramatically reduce repeated calls.
To support the shorter TTL for disabled entries without changing the enabled
TTL, TtlCache.set() now accepts an optional per-entry ttlMs override that
takes precedence over the cache-wide TTL.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: surface unexpected /enabled status codes (e.g. 429) in telemetry
Previously, isCCAEnabled's default case returned { enabled: undefined }
with no statusCode, swallowing 429 rate-limit and 5xx responses.
Changes:
- Widen CCAEnabledResult.statusCode from 401|403|422 to number so
unexpected codes can be propagated
- Return statusCode: response.status in isCCAEnabled's default case
- Add sendTelemetryErrorEvent('copilot.codingAgent.CCAIsEnabledUnexpectedStatus')
in checkCCAEnabled for any status code outside {401, 403, 422}, with
isRateLimited flag for quick 429 filtering in dashboards
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* refactor: hoist knownStatusCodes to constant and add GDPR annotation
- Extract CCA_KNOWN_STATUS_CODES to file-level Set to avoid re-creating
it on every call and centralize the list of handled status codes
- Add __GDPR__ comment block for the new
copilot.codingAgent.CCAIsEnabledUnexpectedStatus telemetry error event
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>