Desktop app: enterprise managed settings ignored for telemetry, and exported spans omit GitHub repo/org/branch attributes
まだ誰も着手していません。
- 主要言語
- Shell
- スター
- 11.2k
- フォーク
- 1.9k
- 平均マージ
- 14時間 16分
- マージ済み PR(30日)
- 6
説明
Describe the bug
The GitHub Copilot desktop app (Windows) does not apply enterprise managed settings for telemetry. The same managed-settings.json policy that successfully configures OTel export for Copilot CLI on the same machine, for the same user, produces no export at all from the desktop app.
The app ships instrumented and is capable of exporting — it emits the same span shapes as the CLI (invoke_agent, chat <model>, execute_tool <name>), because it runs the CLI runtime internally. It just never picks up the policy that says where to send them.
The only configuration route that works is user-scope environment variables, which has two consequences:
- Where the collector requires authentication, the credential has to be written into the user's environment — a static token in
HKCU:\Environment, readable by any process running as that user and persisted across reboots. Managed settings avoid this by fetching the credential at runtime and never storing it in usable form; the environment-variable route gives that property up. This applies only to authenticated collectors, but that is a normal enterprise setup and presumably whytelemetry.headersis a supported managed setting in the first place. OTEL_EXPORTER_OTLP_ENDPOINTis not app-scoped, so setting it for the desktop app also exposes it to the CLI on the same machine. This applies regardless of collector authentication.
Beyond the credential handling, the general problem is that enterprise telemetry policy does not reach this surface at all. Any managed telemetry setting — endpoint, protocol, captureContent, lockCaptureContent — is silently ignored. lockCaptureContent is worth calling out: a policy whose purpose is to prevent prompt content being captured simply does not apply here.
Separately, when export is forced on via environment variables, the resulting spans omit the GitHub context attributes that the CLI and VS Code emit, so desktop usage cannot be attributed to a repository or organisation. Details below.
Affected version
- GitHub Copilot desktop app 1.1.16 (Windows)
- GitHub Copilot CLI 1.0.83 (same machine, same user — policy applies correctly here)
Steps to reproduce the behavior
-
Configure enterprise managed settings with a working telemetry block:
{ "telemetry": { "enabled": true, "endpoint": "https://<collector-host>", "protocol": "http/protobuf", "headers": { "Authorization": "Bearer <token>" }, "captureContent": false, "lockCaptureContent": true } } -
Run Copilot CLI, send a prompt. ✅ Spans arrive. The policy is valid and reachable.
-
Ensure no
OTEL_*/COPILOT_OTEL_*environment variables are set for the user. -
Fully quit the desktop app from the system tray (closing the window is not sufficient), relaunch, send a message.
-
❌ No OTLP requests are made. Nothing is exported.
-
Now set the following as user-scope environment variables, quit from the tray again, relaunch, send a message:
COPILOT_OTEL_ENABLED=true OTEL_EXPORTER_OTLP_ENDPOINT=https://<collector-host> OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf OTEL_EXPORTER_OTLP_HEADERS=Authorization=Bearer <token> -
✅ The app exports OTLP traces, using the same endpoint and token the managed policy already specified.
The delta between step 5 and step 7 is only where the configuration came from.
-
With the app open on a GitHub-hosted repo on a named branch, inspect the
invoke_agentspans that now arrive. -
❌ None of
github.copilot.git.repository,github.copilot.git.branch,github.copilot.git.commit_shaorgithub.copilot.github.orgare present.
Exported spans omit GitHub repo/org/branch attributes
Once export is enabled, the spans are the right shape — same names (invoke_agent, chat <model>, execute_tool <name>), same gen_ai.* and token / nano_aiu attributes — but they omit the GitHub context attributes that CLI and VS Code Chat emit when in a git repo:
github.copilot.git.repositorygithub.copilot.git.branchgithub.copilot.git.commit_shagithub.copilot.github.org
Desktop usage is therefore visible in aggregate but cannot be attributed to a repository or organisation, which is what most enterprise reporting on this data needs.
Note also that environment variables cannot substitute here even in principle: a single desktop instance holds several projects open at once and switches between them, so no process-scoped value could describe the repository for a given session.
Expected behavior
Two things, independently useful:
- The desktop app should honour enterprise managed settings for telemetry, as the CLI does, so that a single enterprise policy governs every Copilot surface.
- Desktop-app spans should carry the same GitHub context attributes as the CLI and VS Code, resolved from the project and workspace the session already belongs to.
Additional context
The shared cache is not a viable workaround. The desktop app shares %LOCALAPPDATA%\copilot with the CLI, so the CLI's fetched policy is on disk and readable. But the cached copy stores the header redacted at rest, so it cannot be replayed:
%LOCALAPPDATA%\copilot\managed-settings\<account-hash>.json
// Disposable cache for enterprise managed settings, safe to delete. Managed automatically.
{"schemaVersion":1,"retrievedAtMs":...,"account":"...","response":{"telemetry":{
"enabled":true,
"endpoint":"https://<collector-host>",
"protocol":"http/protobuf",
"headers":{"Authorization":"******"}, <-- redacted; live value only ever arrives via a fetch
"captureContent":false,"lockCaptureContent":true}}}
The endpoint survives the round trip but the credential does not, so a host that does not fetch cannot authenticate regardless of what the CLI has cached.
Likely cause of the managed-settings half (inference, not confirmed from source). Self-fetching managed settings appears to be opt-in per session: the SDK exposes an enableManagedSettings flag, documented as making the runtime self-fetch enterprise managed settings at session bootstrap, and the host application has to ask for it. The CLI does; the desktop app appears not to. The missing repo attributes look like a separate gap in the same area — the host not passing its project/workspace context into the runtime's OTel tracker. Happy to be corrected on either mechanism; the observed behaviour in steps 1–9 stands regardless.
No user-facing workaround for the managed-settings half. enableManagedSettings is an SDK API field set in the app's own code. There is no setting, flag or environment variable that flips it from outside, which is what leaves environment variables as the only route.
Verification note. github.exe never connects to the collector itself — it spawns copilot.exe child processes that do the exporting, so looking for github.exe in a connection list suggests a failure that has not happened. Check process parentage instead:
$ip = (Resolve-DnsName '<collector-host>').IPAddress
Get-NetTCPConnection | Where-Object { $_.RemoteAddress -in $ip } |
Select-Object -ExpandProperty OwningProcess -Unique | ForEach-Object {
$p = Get-CimInstance Win32_Process -Filter "ProcessId=$_"
$par = Get-CimInstance Win32_Process -Filter "ProcessId=$($p.ParentProcessId)"
"{0} <- parent {1}" -f $p.Name, $par.Name }
copilot.exe <- parent github.exe is the desktop app exporting; copilot.exe <- parent powershell.exe is the ordinary CLI. The app also reads its environment once at process start, and Explorer caches the environment it hands to the apps it launches — so a tray quit and relaunch is required, and occasionally a sign-out/sign-in.
Environment. Windows 11, x86_64. Desktop app launched from the Start menu / tray, opened on a GitHub-hosted repository on a named branch using a Local (branch) workspace.
Possibly related:
- #4669 — managed
telemetry.headersprevented CLI export (fixed). That is the CLI mishandling a policy it did fetch; this is a host never fetching one. - #3477 — enterprise OTel auth options.
- #3909 — server-managed settings for the local CLI.
- #4556 — server-managed
extraKnownMarketplacesfetched but never applied in the desktop app, which may share a root cause in how the desktop host consumes managed settings.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
デスクトップホストのブートストラップから開始し、SDK の enableManagedSettings パス、copilot.exe プロセス、およびプロジェクトまたはワークスペースのコンテキストを受け取る OTel トラッカーを追跡します。完了の条件は、管理対象のテレメトリ設定がデスクトップアプリによって適用され、その invoke_agent スパンに指定された GitHub リポジトリ、ブランチ、コミット、組織の属性が含まれることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- github, powershell
- 領域
- desktop, observability-sre
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100