Skip to content

Detect existing Copilot MCP setup in project configurations - #22234

Open
Ella Hathaway (ellahathaway) wants to merge 1 commit into
mainfrom
ellahathaway-glowing-journey
Open

Ella Hathaway (ellahathaway) wants to merge 1 commit into
mainfrom
ellahathaway-glowing-journey

Conversation

@ellahathaway

Copy link
Copy Markdown
Contributor

Description

Refresh the telemetry hook when a project already configures Aspire MCP only in .vscode/mcp.json or .github/copilot/mcp.json. Previously, aspire agent init ignored these repair-only files when deciding whether Aspire was already configured.

Check each configuration independently so an unreadable file does not hide a valid registration, without modifying repair-only files. This addresses the finding in #22231; the fix can be backported to release/17.0 separately.

User-facing usage

With Aspire MCP already configured in either project file, running aspire agent init --agents copilot --scope project --skills none --mcp=false refreshes the Copilot telemetry hook.

Validation

  • ./restore.cmd: passed (13 existing package vulnerability warnings).
  • dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class '*.AgentInitClientSelectionTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true': passed (197 tests; MSBUILDTERMINALLOGGER=false).

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

Refresh telemetry hooks when an existing project MCP registration is in a repair-only Copilot configuration file.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 22234

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 22234"

@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

2 / 101 PR test projects · 4 PR jobs, from 2 changed files.

Selected PR test projects (2 / 101)

Aspire.Cli.EndToEnd.Tests, Aspire.Cli.Tests

Selected PR jobs (4)

cli-starter-validation, extension-e2e, polyglot, typescript-api-compat


How these were chosen — grouped by what changed

📦 affected project Aspire.Cli
→ 1 test: Aspire.Cli.EndToEnd.Tests

🧪 tests/Aspire.Cli.Tests/Commands/AgentInitClientSelectionTests.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

Job reasons

Job Triggered by
cli-starter-validation affected project Aspire.Cli
extension-e2e • src/Aspire.Cli/Commands/AgentInitCommand.cs
• affected project Aspire.Cli
polyglot affected project Aspire.Cli
typescript-api-compat affected project Aspire.Cli

Selection computed for commit c8d6973.

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.

🟢 Approval recommended

No active review issues remain for the Copilot MCP registration detection update.

No open issues 🎉

What changed in this PR

Updates aspire agent init to recognize existing Copilot MCP registrations in project configurations and refresh telemetry hooks without modifying those files.

Changes:

  • Detects Aspire registrations in .vscode/mcp.json and .github/copilot/mcp.json.
  • Checks each configuration independently so an unreadable file does not hide a valid registration.
  • Adds regression tests for hook selection, malformed or missing registrations, and configuration preservation.
File Description
tests/​Aspire.Cli.Tests/​Commands/​AgentInitClientSelectionTests.cs Tests project configuration detection and verifies files remain unchanged.
src/​Aspire.Cli/​Commands/​AgentInitCommand.cs Includes repair-only configurations in detection and handles read failures per file.

Review effort: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants