Fix OpenAIResponsesChatClient to respect "store":false in responses#7417
Merged
stephentoub merged 1 commit intodotnet:mainfrom Mar 20, 2026
Merged
Fix OpenAIResponsesChatClient to respect "store":false in responses#7417stephentoub merged 1 commit intodotnet:mainfrom
stephentoub merged 1 commit intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates OpenAIResponsesChatClient so that ConversationId is set to null when the actual OpenAI Responses API result indicates "store": false, even if the request options didn’t explicitly disable stored output. This aligns the abstraction with provider behavior (e.g., OpenRouter) and prevents consumers from assuming a resumable/stored conversation when it isn’t.
Changes:
- Update non-streaming response conversion to null out
ConversationIdwhen the response’s"store"field isfalse. - Update streaming response processing to track
"store": falseacross events and consistently emitConversationId = null. - Add test coverage for both non-streaming and streaming cases where the response (not the request) contains
"store": false.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIResponsesChatClient.cs |
Derives ConversationId based on both request options and the response’s "store" field (via Patch). |
test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIResponseClientTests.cs |
Adds regression tests ensuring ConversationId is null when the response includes "store": false (streaming + non-streaming). |
eiriktsarpalis
approved these changes
Mar 20, 2026
jozkee
pushed a commit
to jozkee/extensions
that referenced
this pull request
Apr 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7406
Microsoft Reviewers: Open in CodeFlow