Skip to content

Fix Copilot desktop terminal agent detection - #9504

Merged
JeffreyCA merged 4 commits into
Azure:mainfrom
gimenete:gimenete-fix-copilot-terminal-detection
Aug 14, 2026
Merged

Fix Copilot desktop terminal agent detection#9504
JeffreyCA merged 4 commits into
Azure:mainfrom
gimenete:gimenete-fix-copilot-terminal-detection

Conversation

@gimenete

@gimenete Alberto Gimeno (gimenete) commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Fixes #9581

Summary

  • match Copilot parent-process fallback only against exact executable basenames
  • preserve existing substring and installation-path fallback behavior for Claude, Gemini, and OpenCode
  • preserve the existing explicit environment and user-agent marker detection paths
  • cover supported fallback executable names and Windows path normalization

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, causing azd to implicitly enable no-prompt mode and report non-TTY behavior. Commands such as azd up and azd pipeline config could 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_agent marker, and existing explicit environment and AZURE_DEV_USER_AGENT markers are unchanged.

Tests

  • go test ./internal/runcontext/agentdetect ./internal/terminal
  • go test ./cmd -run 'TestParseGlobalFlags_AgentDetection|TestAgentDetectionIntegration'
  • golangci-lint run ./internal/runcontext/agentdetect/...

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

Copy link
Copy Markdown
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.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the customer-reported identify a customer issue label Aug 10, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Thank you for your contribution Alberto Gimeno (@gimenete)! We will review the pull request and get back to you soon.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .exe suffixes.
  • 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

@gimenete

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree [company="GitHub"]

@gimenete

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree company="GitHub"

Comment thread cli/azd/internal/runcontext/agentdetect/detect_process.go Outdated
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>
Copilot AI review requested due to automatic review settings August 14, 2026 06:20
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.Name instead of the path that actually matched. For example, the new Gemini installation-path case is detected from /usr/local/lib/google-gemini/bin/node but reports only node, which makes the detection log misleading. Keep full-path matching in the second branch so it retains info.Executable as 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>
Copilot AI review requested due to automatic review settings August 14, 2026 06:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@JeffreyCA

Copy link
Copy Markdown
Contributor

Thank for the fix!

@JeffreyCA
JeffreyCA merged commit cc21e52 into Azure:main Aug 14, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

customer-reported identify a customer issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Issue] azd disables prompts in GitHub Copilot desktop terminals on Windows

4 participants