[cherry-pick] accounts: avoid more redundant managed settings requests - #333863
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The cache and retry changes are coherent, narrowly scoped, and supported by focused regression coverage.
Pull request overview
Reduces redundant default-account and managed-settings requests while preserving targeted entitlement freshness.
Changes:
- Adds entitlement-only refreshes and keeps normal refreshes cache-aware.
- Deduplicates matching sessions and stops managed-settings retries after
404. - Adds focused regression tests.
File summaries
| File | Description |
|---|---|
src/vs/workbench/services/chat/common/chatEntitlementService.ts |
Uses entitlement-only refreshes. |
src/vs/workbench/services/accounts/test/browser/defaultAccount.test.ts |
Covers caching, session deduplication, and 404 handling. |
src/vs/workbench/services/accounts/browser/defaultAccount.ts |
Refines cache bypass and authenticated request behavior. |
src/vs/platform/defaultAccount/common/defaultAccount.ts |
Adds the entitlement refresh option. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Allow the cherry-picked overlapping-scope regression test to override authentication sessions on release/1.136, matching the test helper capability it used on main. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bb2c691
|
Fixed the release-branch cherry-pick adaptation in The failure was not hygiene formatting: the combined Minimal fix: add the optional Validation on the cherry-pick branch:
|
|
Verified endpoint load against the exact pre-change baseline using compiled Code OSS launches and mock-policy-server. The release cherry-pick's production diff has the same stable patch ID as #333823 ( Across cold start, hot start, hot reload, explicit force sync, governed success, governed 500, and force 401 scenarios:
Hot reload fell from 7 default-account endpoint requests to 2: Full evidence is recorded in the session A/B report. |
Cherry-pick of #333823 from
main.Summary
forceRefreshas a simple boolean that bypasses every default-account cache404as the final cacheable no-policy result instead of retrying other sessions401authentication fallback and fail-closed forced-freshness behaviorWhy
A workbench reload could turn one managed-settings lookup into four sequential GETs. A chat entitlement update was forcing all account data to refresh, one GitHub session was selected once per matching scope alternative, and the shared request helper retried
404responses as though they indicated a bad token.The refresh contract remains simple: normal operation honors fresh caches;
forceRefresh: truerefreshes everything and is reserved for explicit policy sync/retry actions. Quota dashboards, quota reset checks, and upgrade flows explicitly refresh only entitlement data so they do not remain stale for up to one hour or invalidate unrelated caches.Launch validation
Using an isolated authenticated Code OSS Dev profile:
/copilot_internal/user; token, MCP, and managed-settings caches were reusedCouncil review
GPT-5.5, Claude Opus 4.6, and GPT-5.3-Codex unanimously found that making
forceResolveEntitlementfully cache-aware would regress quota-reset, dashboard, and post-upgrade freshness for up to one hour. The current implementation fixes that with a single entitlement-only refresh option and focused regression coverage.Validation
npm run hygienenpm run compile(zero errors)npm run valid-layers-check./scripts/test.sh --run src/vs/workbench/services/accounts/test/browser/defaultAccount.test.ts --run src/vs/workbench/services/chat/test/common/chatEntitlementService.test.ts --run src/vs/workbench/services/policies/test/browser/accountPolicyGateContribution.test.ts(59 passing)