Fix recorded test failures for Responses client and align GetRealtimeClient with GetResponsesClient#1106
Open
ShivangiReja wants to merge 3 commits intoopenai:mainfrom
Open
Fix recorded test failures for Responses client and align GetRealtimeClient with GetResponsesClient#1106ShivangiReja wants to merge 3 commits intoopenai:mainfrom
GetRealtimeClient with GetResponsesClient#1106ShivangiReja wants to merge 3 commits intoopenai:mainfrom
Conversation
…Client with GetResponsesClient
There was a problem hiding this comment.
Pull request overview
Fixes recorded/playback test failures by ensuring derived client options propagate base ClientPipelineOptions state (notably Transport) and adds guard tests to prevent future silent regressions.
Changes:
- Add
OpenAITestEnvironment.CopyPipelineOptionsand use it when creatingResponsesClientOptions/RealtimeClientOptionsin tests. - Add reflection-based guard tests asserting the known set of public settable
ClientPipelineOptionsproperties. - Update realtime configuration binding to use
RealtimeClientOptionsand adjustOpenAIClient.GetRealtimeClient()construction.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Utility/OpenAITestEnvironment.cs | Copies base pipeline options into ResponsesClientOptions/RealtimeClientOptions so recorded transports/retry/logging settings flow into test clients. |
| tests/Responses/ResponsesSmokeTests.cs | Adds guard test to lock in the set of ClientPipelineOptions public settable properties. |
| tests/Realtime/RealtimeClientOptionsSmokeTests.cs | Adds the same guard test for ClientPipelineOptions property set changes. |
| src/Custom/Realtime/RealtimeClientSettings.cs | Switches Options from OpenAIClientOptions to RealtimeClientOptions for config binding. |
| src/Custom/Realtime/RealtimeClientOptions.cs | Adds configuration-section constructor for settings binding. |
| src/Custom/Realtime/RealtimeClient.cs | Updates settings-based constructor to pass RealtimeClientOptions directly. |
| src/Custom/OpenAIClient.cs | Changes GetRealtimeClient() to reuse Pipeline and new RealtimeClientOptions. |
| api/OpenAI.netstandard2.0.cs | Updates public API surface to reflect RealtimeClientSettings.Options type change. |
| api/OpenAI.net8.0.cs | Updates public API surface to reflect RealtimeClientSettings.Options type change. |
| api/OpenAI.net10.0.cs | Updates public API surface to reflect RealtimeClientSettings.Options type change. |
| /// Used by ClientSettings classes to bind nested "Options" section. | ||
| /// </summary> | ||
| internal static RealtimeClientOptions FromClientOptions(OpenAIClientOptions options) | ||
| internal RealtimeClientOptions(IConfigurationSection section) |
Collaborator
There was a problem hiding this comment.
Should this constructor forward to the ClientPipelineOptions constructor?
internal RealtimeClientOptions(IConfigurationSection section) : base(section)
Collaborator
Author
There was a problem hiding this comment.
I think yes. I have updated all 3: OpenAIClientOptions, RealtimeClientOptions, and ResponsesClientOptions.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Recorded tests for
ResponsesClientwere failing because the test helpers (CreateResponsesClientOptions) only copied the 4 OpenAI-specific properties fromOpenAIClientOptions, dropping baseClientPipelineOptionsstate including the test framework's recordingTransport. Same shape of bug existed inOpenAIClient.GetRealtimeClient().Changes:
OpenAITestEnvironmentnow copies base pipeline properties (Transport,RetryPolicy,MessageLoggingPolicy,NetworkTimeout,ClientLoggingOptions,EnableDistributedTracing) via a newCopyPipelineOptionshelper so recorded/playback tests work.OpenAIClient.GetRealtimeClient()now reusesPipelinedirectly, mirroringGetResponsesClient().RealtimeClientOptions.FromClientOptions(no longer needed).RealtimeClientSettings.Optionschanged toRealtimeClientOptionsadded config-binding ctor onRealtimeClientOptions.RealtimeClientOptionsSmokeTestsandResponsesSmokeTeststo fail when newClientPipelineOptionsproperties are added upstream, preventing silent regressions in the test helper.