Skip to content

Copilot OTel reload prompt loops when managed settings resolve after activation #338597

Description

Summary

Copilot Chat can show an OTel reload notification after every window reload or full application restart when managed settings resolve after the extension has already constructed its OTel service.

The confirmed notifications were:

  • Copilot OTel settings changed - a reload is required for the change to take effect.
  • after changing the local endpoint for diagnosis: Copilot OTel endpoint will change to … after reload.

Selecting Reload Window reproduces the same startup ordering, so the notification loops instead of applying the managed configuration.

Environment

  • VS Code Insiders, release/1.140
  • Commit 2dfd3b41fbc30a7270f0b84db51d67ab7568ebe3
  • Copilot OTel was already explicitly enabled locally
  • Managed Copilot settings were applied through the account-policy path

Runtime evidence

Initial run

18:12:05.453  Extension host starts, PID 9104
18:12:15.957  [DefaultAccount] Managed settings applied
~18:12:16.5  OTel stale-config check shows the generic reload notification
18:12:26.562  Window reload begins
18:12:27.630  New extension host starts, PID 18296
18:12:30.313  [DefaultAccount] Managed settings applied again
~18:12:30.8  The notification appears again

After a full application restart

18:45:42.181  Fresh Agent Host process starts
18:45:42.254  Fresh extension host starts, PID 14988
18:45:46.594  [DefaultAccount] Managed settings applied
~18:45:47.1  OTel shows the reload notification again

For the second run, the local OTel endpoint had intentionally been changed. The endpoint-specific notification proves that the managed endpoint became visible only after OTel initialization.

The Agent Host process itself started once per application run and was not the source of the notification.

Root cause

The Copilot extension constructs IOTelService once from IOTelConfigResolver.activeResolution. OTelStaleConfigMonitor later compares the current resolution with that startup snapshot.

When managed settings arrive late, the effective configuration drifts. Because OTel was already explicitly enabled locally, this branch applies:

if (active.hasEnterpriseSettings || active.config.enabledExplicitly || !isPolicyEnabledOtlp(current)) {
    // promptReload(...)
}

This occurs before the guarded automatic extension-host recovery path. The prompt offers workbench.action.reloadWindow, but reloading the window restarts account-policy initialization, causing managed settings to arrive late again.

The per-session automatic-restart guard is therefore not involved in this loop.

Relationship to previous work

#336701 intentionally routes already-enabled OTel configurations to an opt-in reload. The logs above show that a window reload is not a successful recovery action when the account-managed settings pipeline resolves after extension activation on every launch.

Expected behavior

Once managed OTel settings resolve, Copilot should apply them without entering a reload loop. No telemetry-producing Copilot work should continue indefinitely with the stale startup configuration.

Potential directions

Any complete fix should cover managed-settings data that arrives after service construction, not only late registration of extension policy references. Options include:

  1. await an account-managed-settings readiness barrier before constructing OTel;
  2. make the extension and embedded runtime OTel pipeline safely reconfigurable/lazily initialized; or
  3. restart only the extension host after policy settles, preserving the renderer's resolved account-policy state, instead of reloading the window.

At minimum, the informational drift path should not offer a recovery action that deterministically recreates the same race.

Diagnostics gap

The informational prompt path does not log describeOTelConfigDrift(active.config, current.config). Logging bounded field names only—not values—would make future incidents diagnosable without exposing collector URLs, headers, or other sensitive configuration.

🤖 Posted by GitHub Copilot on Harald's behalf.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

otelOTel (OpenTelemetry)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions