.NET: Update GitHub.Copilot.SDK to 0.1.23 and copy new session config prope… (#3788)

* Update GitHub.Copilot.SDK to 0.1.23 and copy new session config properties

- Bump GitHub.Copilot.SDK from 0.1.18 to 0.1.23
- Add new SessionConfig properties: ReasoningEffort, Hooks, OnUserInputRequest,
  WorkingDirectory, ConfigDir, InfiniteSessions
- Add missing ResumeSessionConfig properties: Model, SystemMessage,
  AvailableTools, ExcludedTools, ReasoningEffort, Hooks, OnUserInputRequest,
  WorkingDirectory, ConfigDir, InfiniteSessions
- Fix UserMessageDataAttachmentsItem -> UserMessageDataAttachmentsItemFile
  for new polymorphic attachment API
- Add unit tests for new session config properties

* Address PR review: centralize config mapping and improve test coverage

- Extract CopySessionConfig/CopyResumeSessionConfig as internal static helpers
  to eliminate duplicated mapping logic between RunCoreStreamingAsync and
  CreateResumeConfig (addresses reviewer comment on drift risk)
- Add InternalsVisibleTo for unit test project
- Replace shallow constructor tests with comprehensive property-verification
  tests that validate every config property is correctly copied, including
  OnUserInputRequest (addresses reviewer comments on test coverage)

* Remove accidentally committed git-lfs hooks
This commit is contained in:
Chandramouleswaran
2026-02-12 18:31:20 +00:00
committed by GitHub
parent a2856d3b92
commit 0c67dbbce5
4 changed files with 183 additions and 25 deletions
@@ -147,21 +147,7 @@ public sealed class GitHubCopilotAgent : AIAgent, IAsyncDisposable
// Create or resume a session with streaming enabled
SessionConfig sessionConfig = this._sessionConfig != null
? new SessionConfig
{
Model = this._sessionConfig.Model,
Tools = this._sessionConfig.Tools,
SystemMessage = this._sessionConfig.SystemMessage,
AvailableTools = this._sessionConfig.AvailableTools,
ExcludedTools = this._sessionConfig.ExcludedTools,
Provider = this._sessionConfig.Provider,
OnPermissionRequest = this._sessionConfig.OnPermissionRequest,
McpServers = this._sessionConfig.McpServers,
CustomAgents = this._sessionConfig.CustomAgents,
SkillDirectories = this._sessionConfig.SkillDirectories,
DisabledSkills = this._sessionConfig.DisabledSkills,
Streaming = true
}
? CopySessionConfig(this._sessionConfig)
: new SessionConfig { Streaming = true };
CopilotSession copilotSession;
@@ -283,16 +269,64 @@ public sealed class GitHubCopilotAgent : AIAgent, IAsyncDisposable
}
private ResumeSessionConfig CreateResumeConfig()
{
return CopyResumeSessionConfig(this._sessionConfig);
}
/// <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>.
/// </summary>
internal static SessionConfig CopySessionConfig(SessionConfig source)
{
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
};
}
/// <summary>
/// Copies all supported properties from a source <see cref="SessionConfig"/> into a new
/// <see cref="ResumeSessionConfig"/> with <see cref="ResumeSessionConfig.Streaming"/> set to <c>true</c>.
/// </summary>
internal static ResumeSessionConfig CopyResumeSessionConfig(SessionConfig? source)
{
return new ResumeSessionConfig
{
Tools = this._sessionConfig?.Tools,
Provider = this._sessionConfig?.Provider,
OnPermissionRequest = this._sessionConfig?.OnPermissionRequest,
McpServers = this._sessionConfig?.McpServers,
CustomAgents = this._sessionConfig?.CustomAgents,
SkillDirectories = this._sessionConfig?.SkillDirectories,
DisabledSkills = this._sessionConfig?.DisabledSkills,
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
};
}
@@ -427,9 +461,8 @@ public sealed class GitHubCopilotAgent : AIAgent, IAsyncDisposable
string tempFilePath = await dataContent.SaveToAsync(tempDir, cancellationToken).ConfigureAwait(false);
attachments ??= [];
attachments.Add(new UserMessageDataAttachmentsItem
attachments.Add(new UserMessageDataAttachmentsItemFile
{
Type = UserMessageDataAttachmentsItemType.File,
Path = tempFilePath,
DisplayName = Path.GetFileName(tempFilePath)
});
@@ -17,6 +17,10 @@
<ProjectReference Include="..\Microsoft.Agents.AI.Abstractions\Microsoft.Agents.AI.Abstractions.csproj" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="Microsoft.Agents.AI.GitHub.Copilot.UnitTests" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="GitHub.Copilot.SDK" />
</ItemGroup>