[cherry-pick] [cherry-pick] Managed settings: reuse cached policy more often - #333707
Open
vs-code-engineering[bot] wants to merge 1 commit into
Open
[cherry-pick] [cherry-pick] Managed settings: reuse cached policy more often#333707vs-code-engineering[bot] wants to merge 1 commit into
vs-code-engineering[bot] wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Reuses fresh, scoped managed-settings cache entries to avoid redundant startup requests.
Changes:
- Reuses eligible cached managed settings.
- Preserves forced refresh, compatibility, staleness, and scope safeguards.
- Expands focused cache behavior tests.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
defaultAccount.ts |
Updates cache reuse and scope validation. |
defaultAccount.test.ts |
Tests caching, refresh, failures, and scope changes. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| const cachedScope = accountPolicyData?.managedSettingsScope; | ||
| // Only reuse a cache captured for the current provider and endpoint (a legacy cache with no recorded | ||
| // scope is trusted), so a previous GitHub Enterprise host's policy is not applied after a scope switch. | ||
| const cacheScopeMatches = !cachedScope || this.getManagedSettingsScopeKey(cachedScope) === this.getManagedSettingsScopeKey(scope); |
Comment on lines
+99
to
+102
| // Without forceRefresh the fresh cache is served with no network round-trip. | ||
| const cached = await provider['getManagedSettings'](sessions, cachedPolicy); | ||
| // The forceRefresh command bypasses the fresh cache and fetches. | ||
| const forced = await provider['getManagedSettings'](sessions, cachedPolicy, { forceRefresh: true, retryManagedSettings: true }); |
Comment on lines
+1170
to
+1171
| // When forceRemoteSettingsRefresh is effective, reuse also requires this scope's freshness to be | ||
| // satisfied; an outstanding compatibility error always forces revalidation. |
Dmitriy Vasyura (dmitrivMS)
approved these changes
Sep 1, 2026
Alex Ross (alexr00)
approved these changes
Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-pick of #333704 from
release/1.136.Cherry-pick of #333697 from
main.Summary
Reuse fresh, correctly scoped managed-settings cache entries during startup so window reloads do not re-fetch
/copilot_internal/managed_settingsfor every signed-in GitHub session. Explicit refreshes, stale caches, scope changes, compatibility errors, andforceRemoteSettingsRefreshcontinue to require live requests.Validation
DefaultAccountProvidertests passed onrelease/1.136