Skip to content

.Net: Allow Kernel to be mutable by AgentChatCompletions #12538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

RogerBarreto
Copy link
Member

Motivation and Context

@RogerBarreto RogerBarreto self-assigned this Jun 19, 2025
@RogerBarreto RogerBarreto requested a review from a team as a code owner June 19, 2025 12:42
@markwallace-microsoft markwallace-microsoft added the .NET Issue or Pull requests regarding .NET code label Jun 19, 2025
@RogerBarreto RogerBarreto added this pull request to the merge queue Jun 20, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 20, 2025
@RogerBarreto RogerBarreto enabled auto-merge June 20, 2025 21:58
@RogerBarreto RogerBarreto added this pull request to the merge queue Jun 20, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 20, 2025
@markwallace-microsoft markwallace-microsoft added this pull request to the merge queue Jun 21, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 21, 2025
@markwallace-microsoft
Copy link
Member

@RogerBarreto is this integration test failure related to your changes?

[xUnit.net 00:05:48.23]     SemanticKernel.IntegrationTests.Connectors.AzureOpenAI.AzureOpenAIChatClientRequiredFunctionChoiceBehaviorTests.SpecifiedInPromptInstructsConnectorToInvokeKernelFunctionAutomaticallyAsync [FAIL]
[xUnit.net 00:05:48.23]       Polly.Timeout.TimeoutRejectedException : The operation didn't complete within the allowed timeout of '00:00:30'.
[xUnit.net 00:05:48.23]       ---- System.Threading.Tasks.TaskCanceledException : The operation was canceled.
[xUnit.net 00:05:48.23]       -------- System.IO.IOException : Unable to read data from the transport connection: Operation canceled.
[xUnit.net 00:05:48.23]       ------------ System.Net.Sockets.SocketException : Operation canceled

@@ -73,7 +73,7 @@ public override async IAsyncEnumerable<AgentResponseItem<ChatMessageContent>> In
() => new ChatHistoryAgentThread(),
cancellationToken).ConfigureAwait(false);

Kernel kernel = (options?.Kernel ?? this.Kernel).Clone();
Kernel kernel = options?.Kernel ?? this.Kernel;
Copy link
Contributor

Choose a reason for hiding this comment

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

This change will result in a regression elsewhere, since it means that AIContextProviders will permanently mutate the kernel plugin list, and this mutation is expected to be per iteration only.
Let's discuss this further in the standup before committing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's discuss this further in the standup before committing.

Agree, actually the AIContext feature introduced this regression. I'm happy suggesting an alternative path for impacted customers using Agents with "Kernel data based functions".

@RogerBarreto
Copy link
Member Author

@markwallace-microsoft This is unrelated error, I tried to run against my local configuration in Azure IT tests and passed as expected.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
.NET Issue or Pull requests regarding .NET code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

.Net: Bug: Kernel.Data no longer retains information across plugins since v1.54
5 participants