Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dotnet/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<PackageVersion Include="Microsoft.SemanticKernel.Agents.AzureAI" Version="1.67.0-preview" />
<PackageVersion Include="Microsoft.SemanticKernel.Plugins.OpenApi" Version="1.67.0" />
<!-- Agent SDKs -->
<PackageVersion Include="GitHub.Copilot.SDK" Version="0.1.23" />
<PackageVersion Include="GitHub.Copilot.SDK" Version="0.1.25" />
<PackageVersion Include="Microsoft.Agents.CopilotStudio.Client" Version="1.3.171-beta" />
<!-- M365 Agents SDK -->
<PackageVersion Include="AdaptiveCards" Version="3.1.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,32 +274,13 @@ private ResumeSessionConfig CreateResumeConfig()
}

/// <summary>
/// Copies all supported properties from a source <see cref="SessionConfig"/> into a new instance
/// with <see cref="SessionConfig.Streaming"/> set to <c>true</c>.
/// 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.
return new SessionConfig
{
Model = source.Model,
ReasoningEffort = source.ReasoningEffort,
Tools = source.Tools,
SystemMessage = source.SystemMessage,
AvailableTools = source.AvailableTools,
ExcludedTools = source.ExcludedTools,
Provider = source.Provider,
OnPermissionRequest = source.OnPermissionRequest,
OnUserInputRequest = source.OnUserInputRequest,
Hooks = source.Hooks,
WorkingDirectory = source.WorkingDirectory,
ConfigDir = source.ConfigDir,
McpServers = source.McpServers,
CustomAgents = source.CustomAgents,
SkillDirectories = source.SkillDirectories,
DisabledSkills = source.DisabledSkills,
InfiniteSessions = source.InfiniteSessions,
Streaming = true
};
SessionConfig clone = source.Clone();
clone.Streaming = true;
return clone;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ public void CopySessionConfig_CopiesAllProperties()
// Assert
Assert.Equal("gpt-4o", result.Model);
Assert.Equal("high", result.ReasoningEffort);
Assert.Same(tools, result.Tools);
Assert.NotSame(tools, result.Tools);
Assert.Single(result.Tools!);
Comment on lines +140 to +141
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.
Assert.Same(systemMessage, result.SystemMessage);
Assert.Equal(new List<string> { "tool1", "tool2" }, result.AvailableTools);
Assert.Equal(new List<string> { "tool3" }, result.ExcludedTools);
Expand All @@ -147,7 +148,8 @@ public void CopySessionConfig_CopiesAllProperties()
Assert.Same(infiniteSessions, result.InfiniteSessions);
Assert.Same(permissionHandler, result.OnPermissionRequest);
Assert.Same(userInputHandler, result.OnUserInputRequest);
Assert.Same(mcpServers, result.McpServers);
Assert.NotSame(mcpServers, result.McpServers);
Assert.Single(result.McpServers!);
Assert.Equal(new List<string> { "skill1" }, result.DisabledSkills);
Assert.True(result.Streaming);
}
Expand Down
Loading