Skip to content

Onboard NuGet MCP workflows to use Copilot SDK programmatic sessions - #7698

Merged
donnie-msft merged 6 commits into
devfrom
dev-donnie-msft-copilotApiChange
Sep 24, 2026
Merged

donnie-msft merged 6 commits into
devfrom
dev-donnie-msft-copilotApiChange

Conversation

@donnie-msft

Copy link
Copy Markdown
Contributor

Bug

Fixes: https://github.com/NuGet/Client.Engineering/issues/3945

Description

Updates the NuGet Visual Studio Copilot workflows to use the new Copilot SDK harness, when enabled.
If disabled, we retain the legacy implementation for the legacy VS Copilot experience.

Implementation

  • Uses SDK programmatic sessions when IsBackendModeEnabledAsync returns true. Otherwise, use the existing Copilot Thread-based APIs.

  • Adds a programmatic NuGet agent with:

    • IncludeBuiltInContributions = false
    • In-box NuGet MCP tool descriptors
    • Per-request solution context supplied through agent hooks
  • Supplies exact solution and project paths, plus applicable NuGet.Config, Directory.Packages.props, Directory.Build.props, and Directory.Build.targets files between each project directory and the solution root.

  • Creates persistent SDK sessions so conversations remain available after the initiating request completes.

  • Validates CopilotMessageResponse.Status:

    • Failures are logged, display a localized warning, and emit CopilotRequestFailed telemetry.
    • Success telemetry is emitted only after a successful response.
  • Updates the Copilot SDK package to 18.12.384 to obtain the required APIs.

    • Removes the unused Copilot package reference from NuGet.PackageManagement.UI which was causing type conflicts.

Design decisions and known limitations

  • Routing is determined before session creation. The SDK path is used when backend mode is enabled; SDK activation or request failures do not silently fall back to the legacy implementation.
  • SDK sessions intentionally select only the in-box NuGet MCP registration.
    • The com.microsoft/nuget registry registration is not used as a fallback because no supported session-aware API was found for determining the effective MCP server selection.

Validation

  • Verified the vulnerability Fixer & "Fix with Copilot" links end-to-end using the in-box NuGet MCP server in SDK mode.
  • Verified the legacy path remains available.
  • Added tests for:
    • In-box NuGet tool selection and registry exclusion
    • Exact solution, project, and configuration paths
    • Successful, failed, and no-chat-access SDK responses

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.

@donnie-msft
donnie-msft requested a review from a team as a code owner September 11, 2026 23:11
@donnie-msft donnie-msft changed the title Dev donnie msft copilot api change Onboard NuGet MCP workflows to use Copilot SDK programmatic sessions Sep 11, 2026
@donnie-msft
donnie-msft requested a review from zivkan September 17, 2026 00:06
zivkan
zivkan previously approved these changes Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants