Uh oh!
There was an error while loading. Please reload this page.
.NET: fix forwarding conversationId to IChatClient in OpenAI Responses - #2632
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
This PR addresses an issue where the client's conversationId was incorrectly being forwarded to the underlying IChatClient via ChatOptions.ConversationId. The fix ensures that conversation management remains at the hosting layer level and is not passed down to the chat client, which may have its own conversation handling or none at all.
Key changes:
- Removed forwarding of
ConversationIdfrom request toChatOptionsin response executors - Added comprehensive tests to verify the fix works for both streaming and non-streaming scenarios
- Enhanced test infrastructure to track
ChatOptionspassed to mock chat clients
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Responses/AIAgentResponseExecutor.cs | Removed ConversationId assignment to ChatOptions with explanatory comment |
| dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Responses/HostedAgentResponseExecutor.cs | Removed ConversationId assignment to ChatOptions with explanatory comment |
| dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/TestHelpers.cs | Added LastChatOptions property to SimpleMockChatClient for test verification |
| dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/OpenAIResponsesIntegrationTests.cs | Added two integration tests and helper methods to verify conversationId is not forwarded to IChatClient |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
In #2477 the problem was raised: client's conversationId does not map to what
IChatClientexpects in the options.We should not forward the client's conversationId into
IChatClient.Contribution Checklist