fix: distinguish GitHub Copilot App execution environment - #9288
Merged
vhvb1989 merged 1 commit intoJul 24, 2026
Merged
Conversation
Detect the Copilot App-specific AI_AGENT value before Copilot CLI markers so execution.environment reports the correct caller. Add precedence coverage and keep agent test environments isolated.
qinezh
requested review from
JeffreyCA,
RickWinter,
hemarina,
richardpark-msft,
tg-msft and
vhvb1989
as code owners
July 24, 2026 03:43
|
Azure Pipelines: 7 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds distinct GitHub Copilot App detection and telemetry reporting.
Changes:
- Detects the exact
AI_AGENTmarker with CLI-marker precedence. - Adds agent and telemetry environment constants.
- Expands detection coverage and test isolation.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
docs/reference/telemetry-data.md |
Documents the telemetry value. |
cli/azd/internal/tracing/resource/exec_environment.go |
Maps the detected app to telemetry. |
cli/azd/internal/tracing/fields/fields.go |
Defines the telemetry value. |
cli/azd/internal/terminal/terminal_test.go |
Clears ambient AI_AGENT. |
cli/azd/internal/runcontext/agentdetect/types.go |
Defines the app agent type. |
cli/azd/internal/runcontext/agentdetect/detect_test.go |
Tests detection and precedence. |
cli/azd/internal/runcontext/agentdetect/detect_env.go |
Detects the exact app marker. |
cli/azd/cmd/auto_install_integration_test.go |
Isolates integration tests from AI_AGENT. |
jongio
approved these changes
Jul 24, 2026
jongio
left a comment
Member
There was a problem hiding this comment.
Reviewed the change. The exact AI_AGENT=github_copilot_app_agent match is gated ahead of the Copilot CLI markers and wired through both DisplayName and execEnvFromAgent. Precedence and the unrecognized-value case are covered by the new tests, and the targeted suites pass locally (agentdetect, tracing/resource, terminal, and the cmd agent-detection tests).
The three open automated-review comments look non-blocking:
environment-variables.md: existing host-detection markers likeCOPILOT_CLIandCLAUDE_CODEaren't listed there either, so omittingAI_AGENTstays consistent with the current convention.telemetry-schema.md: it documents fields, not theexecution.environmentvalue list. That enumeration lives intelemetry-data.md, which this PR updates.- resource-level test: there's no per-agent
execEnvFromAgenttest today, and the behavior being fixed is the detection precedence, which is already covered.
JeffreyCA
approved these changes
Jul 24, 2026
JeffreyCA
left a comment
Contributor
There was a problem hiding this comment.
Thank you, looks good!
Contributor
|
/check-enforcer evaluate |
vhvb1989
approved these changes
Jul 24, 2026
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
AI_AGENT=github_copilot_app_agentmarker before Copilot CLI fallback markersGitHub Copilot Appthroughexecution.environmentAI_AGENTvariableTesting
go test ./internal/runcontext/agentdetect ./internal/tracing/resource ./internal/terminalgo test ./cmd -run '^(TestParseGlobalFlags_AgentDetection|TestAgentDetectionIntegration)$'Fixes #9289