fix: distinguish GitHub Copilot VSCode execution environment - #9420
fix: distinguish GitHub Copilot VSCode execution environment#9420qinezh wants to merge 1 commit into
Conversation
|
Azure Pipelines: 20 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Thank you for your contribution @qinezh! We will review the pull request and get back to you soon. |
There was a problem hiding this comment.
Pull request overview
Distinguishes GitHub Copilot agent sessions in VS Code across detection, CLI behavior, and telemetry.
Changes:
- Adds exact
AI_AGENTdetection and Copilot precedence. - Maps the new agent type to
GitHub Copilot VSCode. - Adds detection, terminal, no-prompt, and telemetry tests.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
docs/reference/telemetry-data.md |
Documents the telemetry value. |
cli/azd/internal/tracing/resource/resource_test.go |
Tests execution-environment mapping. |
cli/azd/internal/tracing/resource/exec_environment.go |
Maps the new agent type. |
cli/azd/internal/tracing/fields/fields.go |
Defines the telemetry value. |
cli/azd/internal/terminal/terminal_test.go |
Tests non-TTY behavior. |
cli/azd/internal/runcontext/agentdetect/types.go |
Defines the agent type and display name. |
cli/azd/internal/runcontext/agentdetect/detect_test.go |
Tests exact matching and precedence. |
cli/azd/internal/runcontext/agentdetect/detect_env.go |
Detects the VS Code marker. |
cli/azd/cmd/auto_install_integration_test.go |
Tests automatic no-prompt behavior. |
jongio
left a comment
There was a problem hiding this comment.
Traced the detection path and the telemetry mapping. The new AI_AGENT entry sits ahead of the Copilot CLI env vars in knownEnvVarPatterns, so Copilot VSCode wins over Copilot CLI when both are present, and detectFromEnvVars requires an exact value match so github_copilot_vscode_agent_extra correctly falls through. Existing vscode-copilot and its telemetry value are untouched, so BI continuity holds. Ran the agentdetect, terminal, and tracing/resource packages locally and they pass.
Summary
vscode-copilotagent type andVS Code Azure GitHub Copilottelemetry value unchanged for BI compatibility; despite its historical name, this path represents the GitHub Copilot for Azure extension in VS Codegithub-copilot-vscodeagent type for generic GitHub Copilot agent sessions in VS Code, detected only from the exactAI_AGENT=github_copilot_vscode_agentmarkerGitHub Copilot VSCodethroughexecution.environment, with host-specific detection before Copilot CLI fallback markersTesting
go test ./internal/runcontext/agentdetect -count=1go test ./internal/terminal -count=1go test ./internal/tracing/resource -count=1go test ./cmd -run '^TestAgentDetectionIntegration$' -count=1Fixes #9419