Repository navigation
managed settings: keep policy through transient refresh failures - #337583
Merged
Ross Wollman (rwoll) merged 8 commits intoSep 24, 2026
Merged
Conversation
Since #330896, a failed refresh after the one-hour cache boundary dropped server-managed settings, so policy-backed settings such as the Copilot OTel endpoint flapped back to defaults and triggered reload prompts. Retain the last successful response for up to 24 hours without renewing its timestamp, and carry managedSettingsFetchedAt forward when managed settings are not fetched. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Michael Lively (Yoyokrazy)
previously approved these changes
Sep 23, 2026
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Expiration does not clear managedSettingsActive, allowing governance state to persist indefinitely.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Preserves server-managed settings through transient refresh failures while maintaining bounded expiration.
Changes:
- Retains failed refresh data for up to 24 hours without renewing timestamps.
- Preserves timestamps across skipped managed-settings fetches.
- Adds regression coverage.
| File | Description |
|---|---|
defaultAccount.ts |
Implements retention and timestamp propagation. |
defaultAccount.test.ts |
Tests retention, expiry, and entitlement outages. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
managedSettingsActive was only ever set, so a server response containing only unprojected settings kept the channel marked active after a 404, an empty response, or retention expiry. Retain and clear it together with managedSettings. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Michael Lively (Yoyokrazy)
previously approved these changes
Sep 23, 2026
Harald Kirschner (digitarald)
previously approved these changes
Sep 23, 2026
Drop the 24-hour retention bound. Failed refreshes, including 401/403 responses that a token refresh or SSO sign-in may resolve, keep the last successful response without renewing its timestamp; only a service answer, sign-out, or account or scope change clears it. This matches the retention before #330896 while keeping its fix that a failure never renews the cache. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Ross Wollman (rwoll)
dismissed stale reviews from Harald Kirschner (digitarald) and Michael Lively (Yoyokrazy)
via
September 23, 2026 23:59
1b0a35c
Ross Wollman (rwoll)
enabled auto-merge (squash)
September 24, 2026 00:01
Ross Wollman (rwoll)
marked this pull request as draft
September 24, 2026 00:06
auto-merge was automatically disabled
September 24, 2026 00:06
Pull request was converted to draft
Ross Wollman (rwoll)
marked this pull request as ready for review
September 24, 2026 00:07
Ross Wollman (rwoll)
enabled auto-merge (squash)
September 24, 2026 00:07
roblourens
previously approved these changes
Sep 24, 2026
Contributor
|
Base:
|
Ross Wollman (rwoll)
marked this pull request as draft
September 24, 2026 00:28
auto-merge was automatically disabled
September 24, 2026 00:28
Pull request was converted to draft
Keep server-managed policy on any failed refresh, including 401/403, with its original timestamp so the failure never counts as a refresh. Revert the unrelated managedSettingsActive change and the managedSettingsFetchedAt carry-forward, which are not needed for this fix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Ross Wollman (rwoll)
marked this pull request as ready for review
September 24, 2026 00:49
Ross Wollman (rwoll)
enabled auto-merge (squash)
September 24, 2026 00:56
Member
Author
|
Joaquín Ruales (@jruales) - FYI, this only fixes one possible source of policy flapping. |
Joaquín Ruales (jruales)
approved these changes
Sep 24, 2026
Ross Wollman (rwoll)
deleted the
agents/otel-notification-investigation
branch
September 24, 2026 01:20
1 of 13 tasks
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.

Copilot's OTel reload notification (reworked in #336701) exposed a managed-settings refresh regression from #330896. Enterprise users see "Copilot OTel endpoint will change to http://localhost:4318 after reload." every few hours, especially after idle, and reloading clears chat.
Cause
Since #330896, a cached server-managed-settings response expires one hour after the last successful fetch. If a refresh fails after that (no response, 401/403, 429, 5xx, malformed), the policy is dropped rather than kept. A policy-backed OTel endpoint then reverts to its default and the notification appears. The next successful fetch restores the policy, so it keeps switching back and forth. Every other server-managed control switches back and forth in the same way, so for the length of the gap their restrictions are silently lifted.
Change
Keep the policy unless the service answers affirmatively that it should change. A failed refresh without
forceRemoteSettingsRefreshnow keeps the last successful response, however old, with its original timestamp. The failure therefore doesn't count as a refresh, and the next poll or focus retries. A 401/403 is treated as a failure because it can be temporary, for example while a token refreshes.This keeps #330896's fix that a failure never renews the cache timestamp, and reverts only its dropping of stale policy. Before #330896, failures also kept the previous policy, but they renewed the timestamp.
These still behave as before:
forceRemoteSettingsRefreshstill fails closed.Follow-up
getDefaultAccountForAuthenticationProviderreturnnull, sosetDefaultAccount(null)clears the policy without applying this retention. This path predates managed settings: fix stale cache case when moving to unavailable #330896 and changes account availability, so it needs a separate PR.managedSettingsActive(set when the server returns settings that no VS Code policy uses) is never cleared once set. This bug existed before this PR and will be fixed separately.Validation
defaultAccount.test.ts: 49 passing. The updated test fails without this change.