Fix Copilot desktop terminal agent detection - #9504
Open
Alberto Gimeno (gimenete) wants to merge 4 commits into
Open
Fix Copilot desktop terminal agent detection#9504Alberto Gimeno (gimenete) wants to merge 4 commits into
Alberto Gimeno (gimenete) wants to merge 4 commits into
Conversation
Match parent-process fallbacks against exact executable basenames so desktop hosts and installation paths containing agent terms do not force non-interactive behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
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
|
Thank you for your contribution Alberto Gimeno (@gimenete)! We will review the pull request and get back to you soon. |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes false agent detection for human-operated terminals in GitHub Copilot Desktop.
Changes:
- Matches exact executable basenames instead of substrings.
- Normalizes Windows paths, casing, and
.exesuffixes. - Adds coverage for supported agents and false-positive scenarios.
Show a summary per file
| File | Description |
|---|---|
cli/azd/internal/runcontext/agentdetect/detect_process.go |
Implements exact process-name matching. |
cli/azd/internal/runcontext/agentdetect/detect_test.go |
Tests executable variants and desktop-host exclusions. |
Review details
Tip
Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
Author
|
@microsoft-github-policy-service agree [company="GitHub"] |
Author
|
@microsoft-github-policy-service agree company="GitHub" |
Keep legacy substring and installation-path detection for Claude, Gemini, and OpenCode while restricting only Copilot to exact executable names. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The extension registry check was cancelled by its workflow concurrency guard and cannot be rerun by fork contributors. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Review details
Suppressed comments (1)
cli/azd/internal/runcontext/agentdetect/detect_process.go:95
- [azd-code-reviewer] This first check now also searches the full executable path, so path-only matches return
Details: info.Nameinstead of the path that actually matched. For example, the new Gemini installation-path case is detected from/usr/local/lib/google-gemini/bin/nodebut reports onlynode, which makes the detection log misleading. Keep full-path matching in the second branch so it retainsinfo.Executableas the evidence.
if processNameMatches(nameLower, info.Executable, pattern, entry.exactMatch) {
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Keep full executable path matching in the executable branch so path-only agent detection reports the path that triggered it. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
Fixes #9581
Summary
User-visible issue
In the GitHub Copilot desktop app on Windows, a human-operated integrated terminal has an ancestor process named
GitHub Copilot.exe. Broad substring matching classified that desktop host as Copilot CLI, causingazdto implicitly enable no-prompt mode and report non-TTY behavior. Commands such asazd upandazd pipeline configcould therefore skip prompts despite running in a real ConPTY.The fallback now ignores generic Copilot terms in host application names and installation directories while leaving other agents' existing fallback behavior unchanged. Actual Copilot App agent executions remain detected through the exact
AI_AGENT=github_copilot_app_agentmarker, and existing explicit environment andAZURE_DEV_USER_AGENTmarkers are unchanged.Tests
go test ./internal/runcontext/agentdetect ./internal/terminalgo test ./cmd -run 'TestParseGlobalFlags_AgentDetection|TestAgentDetectionIntegration'golangci-lint run ./internal/runcontext/agentdetect/...