Skip to content

Comments

.NET: Update to the latest version of GitHub.Copilot.SDK#4151

Open
Copilot wants to merge 3 commits intomainfrom
copilot/update-github-copilot-sdk-again
Open

.NET: Update to the latest version of GitHub.Copilot.SDK#4151
Copilot wants to merge 3 commits intomainfrom
copilot/update-github-copilot-sdk-again

Conversation

Copy link
Contributor

Copilot AI commented Feb 22, 2026

Motivation and Context

The GitHub.Copilot.SDK now exposes Clone() on SessionConfig and ResumeSessionConfig. This replaces the brittle manual property-by-property copy logic in CopySessionConfig, which must be updated every time the SDK adds a new config property.

Description

Bumps GitHub.Copilot.SDK from 0.1.230.1.25 and uses the SDK's built-in Clone() to replace custom config copying in CopySessionConfig.

  • Directory.Packages.props: Version bump from 0.1.23 to 0.1.25
  • CopySessionConfig: Replaced 17-property manual copy with source.Clone() + set Streaming = true, making it forward-compatible with new SDK properties
  • Unit tests: Updated CopySessionConfig test assertions from Assert.SameAssert.NotSame for Tools and McpServers since Clone() creates independent collection instances

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? No

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

… copying

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
…feedback

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Copilot AI changed the title [WIP] Update to the latest version of GitHub.Copilot.SDK Update to the latest version of GitHub.Copilot.SDK Feb 22, 2026
Copilot AI requested a review from stephentoub February 22, 2026 12:58
@stephentoub stephentoub marked this pull request as ready for review February 22, 2026 12:59
Copilot AI review requested due to automatic review settings February 22, 2026 12:59
Copilot AI deployed to integration February 22, 2026 12:59 Active
@github-actions github-actions bot changed the title Update to the latest version of GitHub.Copilot.SDK .NET: Update to the latest version of GitHub.Copilot.SDK Feb 22, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the .NET GitHub Copilot agent integration to use newly introduced Clone() support in GitHub.Copilot.SDK for safer, forward-compatible session config copying.

Changes:

  • Bump GitHub.Copilot.SDK from 0.1.23 to 0.1.25.
  • Replace manual SessionConfig property copying with source.Clone() + Streaming = true.
  • Adjust unit tests to reflect cloned (non-shared) collection instances.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
dotnet/Directory.Packages.props Updates the referenced GitHub.Copilot.SDK package version to 0.1.25.
dotnet/src/Microsoft.Agents.AI.GitHub.Copilot/GitHubCopilotAgent.cs Uses SDK Clone() for SessionConfig copying and forces streaming on.
dotnet/tests/Microsoft.Agents.AI.GitHub.Copilot.UnitTests/GitHubCopilotAgentTests.cs Updates assertions to account for cloned collections in SessionConfig.
Comments suppressed due to low confidence (1)

dotnet/tests/Microsoft.Agents.AI.GitHub.Copilot.UnitTests/GitHubCopilotAgentTests.cs:152

  • Similarly for McpServers, the test now only checks the dictionary instance is different and has one entry. Add assertions that the expected key exists and that the corresponding value was preserved (e.g., same config instance or expected equality) so the test fails if Clone() drops or alters MCP server entries.
        Assert.NotSame(mcpServers, result.McpServers);
        Assert.Single(result.McpServers!);

/// Clones a <see cref="SessionConfig"/> and sets <see cref="SessionConfig.Streaming"/> to <c>true</c>.
/// </summary>
internal static SessionConfig CopySessionConfig(SessionConfig source)
{
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

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

CopySessionConfig now calls source.Clone() without validating source. Since this file consistently uses Throw.IfNull(...) for argument validation, consider adding an explicit null check so callers get an ArgumentNullException instead of a potential NullReferenceException if the method is ever reused elsewhere.

Suggested change
{
{
Throw.IfNull(source);

Copilot uses AI. Check for mistakes.
Comment on lines +140 to +141
Assert.NotSame(tools, result.Tools);
Assert.Single(result.Tools!);
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

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

The updated assertions for Tools only check that the cloned collection is a different instance and has a single item, but they no longer verify that the cloned config preserved the original tool entry. Add an assertion that the tool element in result.Tools matches the corresponding element from tools (e.g., same reference or expected equality) to keep the test validating copy correctness, not just count.

This issue also appears on line 151 of the same file.

Copilot uses AI. Check for mistakes.
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.

3 participants