Skip to content

Fix recorded test failures for Responses client and align GetRealtimeClient with GetResponsesClient#1106

Open
ShivangiReja wants to merge 3 commits intoopenai:mainfrom
ShivangiReja:Shreja_FixTests
Open

Fix recorded test failures for Responses client and align GetRealtimeClient with GetResponsesClient#1106
ShivangiReja wants to merge 3 commits intoopenai:mainfrom
ShivangiReja:Shreja_FixTests

Conversation

@ShivangiReja
Copy link
Copy Markdown
Collaborator

Recorded tests for ResponsesClient were failing because the test helpers (CreateResponsesClientOptions) only copied the 4 OpenAI-specific properties from OpenAIClientOptions, dropping base ClientPipelineOptions state including the test framework's recording Transport. Same shape of bug existed in OpenAIClient.GetRealtimeClient().

Changes:

  • OpenAITestEnvironment now copies base pipeline properties (Transport, RetryPolicy, MessageLoggingPolicy, NetworkTimeout, ClientLoggingOptions, EnableDistributedTracing) via a new CopyPipelineOptions helper so recorded/playback tests work.
  • OpenAIClient.GetRealtimeClient() now reuses Pipeline directly, mirroring GetResponsesClient().
  • Removed RealtimeClientOptions.FromClientOptions (no longer needed).
  • RealtimeClientSettings.Options changed to RealtimeClientOptions added config-binding ctor on RealtimeClientOptions.
  • Added reflection-based guard tests in RealtimeClientOptionsSmokeTests and ResponsesSmokeTests to fail when new ClientPipelineOptions properties are added upstream, preventing silent regressions in the test helper.

Copilot AI review requested due to automatic review settings April 17, 2026 21:14
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.CopyPipelineOptions and use it when creating ResponsesClientOptions/RealtimeClientOptions in tests.
  • Add reflection-based guard tests asserting the known set of public settable ClientPipelineOptions properties.
  • Update realtime configuration binding to use RealtimeClientOptions and adjust OpenAIClient.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.

Comment thread tests/Responses/ResponsesSmokeTests.cs Outdated
Comment thread tests/Realtime/RealtimeClientOptionsSmokeTests.cs
Comment thread src/Custom/OpenAIClient.cs
/// Used by ClientSettings classes to bind nested "Options" section.
/// </summary>
internal static RealtimeClientOptions FromClientOptions(OpenAIClientOptions options)
internal RealtimeClientOptions(IConfigurationSection section)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should this constructor forward to the ClientPipelineOptions constructor?

internal RealtimeClientOptions(IConfigurationSection section) : base(section)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think yes. I have updated all 3: OpenAIClientOptions, RealtimeClientOptions, and ResponsesClientOptions.

Comment thread tests/Responses/ResponsesSmokeTests.cs Outdated
Copilot AI review requested due to automatic review settings April 17, 2026 22:34
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants