Managed OTel policy changes break new chats until the Agent Host restarts
Error
Error: (sendFailed) Request session.create failed with message: Standalone managed telemetry preparation failed: Managed telemetry conflicts with the already selected OTel configurationSummary
Changing managed telemetry policy between sessions on a running Agent Host can break new chats. We reproduced the exact error by changing only telemetry.serviceName; restarting the host with the new policy unchanged restored chat. Policy requests returned HTTP 200.
Environment
- Reproduced: macOS, Code OSS
1.141.0atc2f1ef2d05c, SDK1.0.16, runtime1.0.90. - Originally reported: Windows, Insiders
1.141.0atec2e580674cdb512aa9b2a9596ab35d8a9590f1e, same SDK/runtime. The original policy-change sequence is unverified.
Reproduction
- From a built VS Code checkout, start the mock server:
npm run mock-policy-serverOpen http://127.0.0.1:3000, follow Setup > System proxy, and enable Proxyman's platform proxy. Set VS Code's
http.proxytohttp://localhost:9090(Proxyman), not port 3000 (the mock server).Mock Managed Settings with HTTP 200 / JSON and the following body. Leave other endpoints on passthrough:
{
"forceRemoteSettingsRefresh": false,
"telemetry": {
"enabled": true,
"endpoint": "http://localhost:4319",
"captureContent": true,
"lockCaptureContent": true,
"serviceName": "testtesttest"
}
}This disables the unrelated startup refresh gate. Use harmless prompts because content capture is enabled.
- Fully quit Code OSS, then launch from the checkout root with an isolated policy cache:
COPILOT_CACHE_HOME="$PWD/.build/otel-repro-cache" ./scripts/code.sh --log traceRun Developer: Sync Account Policy, then Developer: Restart Local Agent Host. Create a new Agent Host chat and send Hi. It succeeds.
- Change only
telemetry.serviceNametotesttesttest-warm-change. From the checkout root, clear only the isolated policy cache:
rm -r -- .build/otel-repro-cache/managed-settingsWithout syncing policy, reloading, or restarting, create another new Agent Host chat and send Hi. It fails with the exact error above.
- Keep the changed policy. Run Developer: Restart Local Agent Host, create a new chat, and send
Hi. It succeeds again.
Scope
serviceName is the minimal verified reproduction, not a reason to scope the fix to that field. Please also cover changes to collector endpoints, headers/credentials, resource attributes, protocols, content-capture policy, and telemetry enablement. Those transitions were not individually live-tested here.
Expected behavior
Coordinate safe recovery, or offer an explicit restart-and-retry action, preserving the message and history. Recovery must continue to enforce the required exporter and privacy policy.
Version context
Related runtime PR: github/copilot-agent-runtime#22864 (repository access required).
Relevant dependency updates: #338512 adopted SDK 1.0.15-preview.4 / runtime 1.0.89-7; #339018 upgraded to the reproduced SDK 1.0.16 / runtime 1.0.90. Earlier builds were not live-tested in this reproduction.
- Authored with GitHub Copilot on behalf of @rwoll.*
Source: microsoft/vscode