Skip to content

[BREAKING] Update OpenAI SDK to 2.9.1#4424

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/update-codebase-dependency-openai
Closed

[BREAKING] Update OpenAI SDK to 2.9.1#4424
Copilot wants to merge 2 commits intomainfrom
copilot/update-codebase-dependency-openai

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 3, 2026

Motivation and Context

OpenAI .NET SDK 2.9.1 introduces breaking API changes: model parameter removed from ResponsesClient constructor and GetResponsesClient(), now specified per-call or via ChatOptions.ModelId. This PR updates the codebase to the new API surface.

Description

Package updates (Directory.Packages.props):

  • OpenAI 2.8.0 → 2.9.1
  • System.ClientModel 1.8.1 → 1.9.0 (required by OpenAI 2.9.1)

Breaking API migration — model is no longer on the client, it's per-call:

// Before (2.8.0)
var client = new OpenAIClient(apiKey).GetResponsesClient(model);
client.CreateResponseAsync("Hello");

// After (2.9.1)
var client = new OpenAIClient(apiKey).GetResponsesClient();
client.CreateResponseAsync(model, "Hello");

// For IChatClient/AIAgent usage, model goes in ChatOptions
new ChatClientAgentOptions {
    ChatOptions = new() { ModelId = model, Instructions = "..." }
};

Files changed:

  • Samples: Updated 5 sample programs to pass model via ChatClientAgentOptions/ConfigureOptions instead of constructor
  • OpenAIResponsesIntegrationTests.cs: Removed model from CreateResponseClient, added "test-model" as first arg to all 36+ CreateResponseAsync/CreateResponseStreamingAsync calls
  • OpenAIResponseFixture.cs: Stores model name separately, passes via ChatOptions.ModelId

Known issue: Microsoft.Extensions.AI.OpenAI 10.3.0 has binary incompatibility with OpenAI 2.9.x — its compiled IL calls removed methods (ResponsesClient.get_Model(), ResponseResult.set_Instructions(string)). The fix merged in dotnet/extensions@8c71204 today. 9 tests in Microsoft.Agents.AI.OpenAI.UnitTests will pass once MEAI 10.4.0+ ships. The remaining 1595+ tests across 3 TFMs all pass.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • uy6vsblobprodcus34.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet restore --source REDACTED --source REDACTED ame cal/bin/git (dns block)
    • Triggering command: /usr/bin/dotnet dotnet restore src/Microsoft.Agents.AI.OpenAI/Microsoft.Agents.AI.OpenAI.csproj (dns block)
  • www.nuget.org
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

… API changes

Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>
@rogerbarreto rogerbarreto added the blocked external This label indicates whenever an issue or a PR cannot proceed due to an external dependency label Mar 3, 2026
Copilot AI changed the title [WIP] Update CodeBase dependency to use OpenAI 2.9.1 package [BREAKING] Update OpenAI SDK to 2.9.1 Mar 3, 2026
@rogerbarreto
Copy link
Copy Markdown
Member

@crickman crickman deleted the copilot/update-codebase-dependency-openai branch March 16, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked external This label indicates whenever an issue or a PR cannot proceed due to an external dependency

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants