Repository navigation
Add copilot-app LLM environment telemetry detection - #55440
Merged
marcpopMSFT merged 1 commit intoJul 23, 2026
Merged
Conversation
Add a new 'copilot-app' detection rule for the GitHub Copilot desktop application which sets AI_AGENT=github_copilot_app_agent. This is separate from the existing 'copilot-vscode' rule (VS Code agent mode) and 'copilot-cli' rule (CLI presence). Also fix the LLM environment tests to save/restore ambient environment variables so they pass correctly when the test process runs inside an LLM agent environment (e.g. the Copilot CLI app). Co-authored-by: Copilot <[email protected]>
|
Azure Pipelines: Successfully started running 1 pipeline(s). 2 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
baronfel
approved these changes
Jul 23, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the dotnet CLI’s LLM-environment telemetry to recognize the GitHub Copilot desktop app by detecting AI_AGENT=github_copilot_app_agent, and updates telemetry tests to be resilient to “ambient” agent environment variables when running under an LLM-hosted test process.
Changes:
- Add a new
"copilot-app"detection rule based onAI_AGENT=github_copilot_app_agent. - Add/adjust telemetry test cases for
"copilot-app"alone and combined"copilot-cli, copilot-app"detection. - Add test isolation to clear/restore all LLM-related environment variables per test case to avoid pollution from the runner’s environment.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Cli/dotnet/Telemetry/LLMEnvironmentDetectorForTelemetry.cs | Adds "copilot-app" detection based on AI_AGENT value. |
| test/dotnet.Tests/TelemetryTests/TelemetryCommonPropertiesTests.cs | Adds "copilot-app" test cases and improves env-var isolation for LLM detection tests. |
Member
Author
|
/backport to release/10.0.4xx |
Contributor
|
Started backporting to |
Contributor
|
@marcpopMSFT backporting to git am output$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: Add copilot-app LLM environment telemetry detection
Using index info to reconstruct a base tree...
M src/Cli/dotnet/Telemetry/LLMEnvironmentDetectorForTelemetry.cs
A test/dotnet.Tests/TelemetryTests/TelemetryCommonPropertiesTests.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Cli/dotnet/Telemetry/LLMEnvironmentDetectorForTelemetry.cs
CONFLICT (content): Merge conflict in src/Cli/dotnet/Telemetry/LLMEnvironmentDetectorForTelemetry.cs
CONFLICT (modify/delete): test/dotnet.Tests/TelemetryTests/TelemetryCommonPropertiesTests.cs deleted in HEAD and modified in Add copilot-app LLM environment telemetry detection. Version Add copilot-app LLM environment telemetry detection of test/dotnet.Tests/TelemetryTests/TelemetryCommonPropertiesTests.cs left in tree.
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Add copilot-app LLM environment telemetry detection
Error: The process '/usr/bin/git' failed with exit code 128 |
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.
Summary
Add a new
"copilot-app"detection rule for the GitHub Copilot desktop application (Copilot CLI app), which setsAI_AGENT=github_copilot_app_agentwhen running dotnet CLI commands.This is separate from:
"copilot-cli"— detects the CLI tool itself viaCOPILOT_CLI=1and related presence vars"copilot-vscode"— detects VS Code agent mode viaAI_AGENT=github_copilot_vscode_agentWhen running inside the Copilot desktop app, both
copilot-cliandcopilot-apprules will fire, resulting in a telemetry value like"copilot-cli, copilot-app".Changes
src/Cli/dotnet/Telemetry/LLMEnvironmentDetectorForTelemetry.cs: Added newEnvironmentVariableValueRule("AI_AGENT", "github_copilot_app_agent")rule mapped to"copilot-app".test/dotnet.Tests/TelemetryTests/TelemetryCommonPropertiesTests.cs:copilot-appdetection and combocopilot-cli+copilot-appdetection.CanDetectLLMStatusForEnvVarstest to save/restore all ambient LLM env vars before each test case, so tests pass correctly when the test process itself runs inside an LLM agent environment.TelemetryCommonPropertiesShouldReturnIsLLMDetectionresilient to ambient LLM env vars.