microsoft / microsoft/vscode

Ensure enterprise Copilot OTel settings override environment variables

Open
#336,840 0 comments 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

triage-needed
Dominant language
TypeScript
Stars
193k
Forks
42.7k
PR merge metrics
PR metrics pending

Description

Description

Enterprise-managed Copilot OTel settings can currently be overridden by process environment variables in the VS Code Copilot extension. For example, COPILOT_OTEL_ENABLED=false can disable telemetry enabled by managed settings, and OTEL_EXPORTER_OTLP_ENDPOINT can redirect telemetry away from a managed collector.

The Rust Copilot runtime's managed telemetry API already treats managed values as authoritative. The gap is in the VS Code extension resolver: policy-backed values exposed through Configuration.inspect(...).defaultValue are passed into the ordinary setting* inputs, where environment variables have higher precedence.

Expected behavior

Recognized enterprise-managed OTel values take precedence over environment variables for the corresponding fields. Environment variables may continue to supply fields omitted by policy where that is the intended contract.

At minimum, managed values should govern:

  • enablement
  • exporter type and output destination
  • OTLP endpoint and protocol
  • content capture
  • service name
  • resource attributes and headers on key collisions

Actual behavior

The current resolver permits environment variables to disable, redirect, or alter managed OTel configuration. microsoft/vscode#336701 documents this as an accepted gap while fixing the separate late-policy initialization race.

Suggested fix

Preserve policy provenance when resolving the policy-backed defaults, and pass recognized managed values through the existing policy* inputs to resolveOTelConfig instead of treating them as ordinary settings. Add regression coverage for managed-over-environment precedence, including endpoint redirection and file-export diversion.

Created from a Slack conversation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the VS Code Copilot extension resolver around Configuration.inspect(...).defaultValue and resolveOTelConfig, tracing how setting* and policy* inputs are populated. Add regression coverage for managed-over-environment precedence, including endpoint redirection and file-export diversion. Done means recognized managed OTel values remain authoritative while environment variables still fill policy-omitted fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
observability-sre
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.