Skip to content

.NET: fix: preserve Responses logprobs field - #5860

Merged
Roger Barreto (rogerbarreto) merged 3 commits into
microsoft:mainfrom
he-yufeng:fix/openai-hosting-logprobs
Aug 24, 2026
Merged

.NET: fix: preserve Responses logprobs field#5860
Roger Barreto (rogerbarreto) merged 3 commits into
microsoft:mainfrom
he-yufeng:fix/openai-hosting-logprobs

Conversation

@he-yufeng

Copy link
Copy Markdown
Contributor

Summary

  • add the missing logprobs field to the Responses CreateResponse and Response models
  • keep logprobs alongside top_logprobs during JSON deserialize / reserialize round trips
  • cover request and response payloads in OpenAI hosting serialization tests

Fixes #5854.

To verify

  • dotnet test --project tests\Microsoft.Agents.AI.Hosting.OpenAI.UnitTests\Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj -f net10.0 --no-restore --filter-class Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.OpenAIResponsesSerializationTests
  • dotnet build src\Microsoft.Agents.AI.Hosting.OpenAI\Microsoft.Agents.AI.Hosting.OpenAI.csproj -f net10.0 --no-restore --tl:off
  • dotnet build tests\Microsoft.Agents.AI.Hosting.OpenAI.UnitTests\Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj -f net10.0 --no-restore --tl:off
  • dotnet format src\Microsoft.Agents.AI.Hosting.OpenAI\Microsoft.Agents.AI.Hosting.OpenAI.csproj --verify-no-changes --no-restore
  • dotnet format tests\Microsoft.Agents.AI.Hosting.OpenAI.UnitTests\Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj --verify-no-changes --no-restore

Copilot AI review requested due to automatic review settings May 14, 2026 19:07
@moonbox3 Evan Mattson (moonbox3) added the .NET Usage: [Issues, PRs], Target: .Net label May 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR fixes loss of the logprobs field during .NET Responses request/response JSON serialization round-trips by adding the missing model properties and extending serialization tests to cover the behavior.

Changes:

  • Add nullable logprobs to CreateResponse and Response models.
  • Add unit tests to validate logprobs + top_logprobs deserialize/reserialize round trips.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/OpenAIResponsesSerializationTests.cs Adds round-trip serialization tests for logprobs and top_logprobs in request/response payloads.
dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Responses/Models/Response.cs Adds Logprobs JSON-mapped property to preserve response payload field.
dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Responses/Models/CreateResponse.cs Adds Logprobs JSON-mapped property to preserve request payload field.

@justinyoo

Copy link
Copy Markdown

Hi, Team. Just follow up for the catch up on the current status of this.

@he-yufeng

Copy link
Copy Markdown
Contributor Author

Addressed the remaining propagation gap in 5ead97d. Logprobs is now copied alongside TopLogprobs in all three CreateResponse -> Response synthesis paths: non-streaming agent responses, streaming response snapshots, and the in-memory response service.

Validation on Windows: project restore/build succeeded, OpenAIResponsesSerializationTests passed, all 38 OpenAIResponsesIntegrationTests passed, targeted dotnet format verification passed with the existing workspace-load warning, and git diff --check passed.

@he-yufeng
Yufeng He (he-yufeng) force-pushed the fix/openai-hosting-logprobs branch from 5ead97d to f82bad6 Compare June 9, 2026 10:37
@he-yufeng

Copy link
Copy Markdown
Contributor Author

Rebased the logprobs propagation fix onto current main. The final six-file behavior diff is unchanged, the hosting project builds with zero warnings/errors, and the earlier focused serialization/integration test results remain applicable.

@he-yufeng
Yufeng He (he-yufeng) force-pushed the fix/openai-hosting-logprobs branch from f82bad6 to 2172407 Compare June 11, 2026 22:25
@he-yufeng

Copy link
Copy Markdown
Contributor Author

Updated and rebased the branch onto current main.

This addresses the remaining review threads:

  • renamed the create-side logprobs test/variable to match the CreateResponse model being deserialized
  • changed the nullable bool assertions to check HasValue and then Value
  • kept the earlier Logprobs propagation fix across all three CreateResponse -> Response synthesis paths

Validation:

  • dotnet build .\dotnet\tests\Microsoft.Agents.AI.Hosting.OpenAI.UnitTests\Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj -f net10.0 --tl:off (0 warnings, 0 errors)
  • dotnet .\dotnet\tests\Microsoft.Agents.AI.Hosting.OpenAI.UnitTests\bin\Debug\net10.0\Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.dll --filter-class Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.OpenAIResponsesSerializationTests --no-progress (53 passed)
  • dotnet format dotnet\agent-framework-dotnet.slnx --verify-no-changes --no-restore --include ... (passed; existing workspace-load warning only)
  • git diff --check upstream/main..HEAD

@he-yufeng
Yufeng He (he-yufeng) force-pushed the fix/openai-hosting-logprobs branch from 2172407 to facab90 Compare June 12, 2026 03:33
@he-yufeng

Copy link
Copy Markdown
Contributor Author

Rebased this branch onto current main and pushed the updated head facab905.

Validation run locally from dotnet/:

  • dotnet build .\src\Microsoft.Agents.AI.Hosting.OpenAI\Microsoft.Agents.AI.Hosting.OpenAI.csproj -f net10.0 --tl:off -> passed, 0 warnings/errors
  • dotnet run --project .\tests\Microsoft.Agents.AI.Hosting.OpenAI.UnitTests\Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj -f net10.0 -> passed, 390 tests
  • git diff --check upstream/main..HEAD -> passed

Note: I used dotnet run --project for the test project because the local .NET 10 dotnet test runner rejected this project under the repository's MTP global runner setting before executing tests.

@he-yufeng
Yufeng He (he-yufeng) force-pushed the fix/openai-hosting-logprobs branch from facab90 to c2e48bd Compare June 12, 2026 11:15
@he-yufeng

Copy link
Copy Markdown
Contributor Author

Rebased this branch onto current main and pushed the updated head c2e48bd.

Validation run locally from dotnet/:

  • dotnet build .\src\Microsoft.Agents.AI.Hosting.OpenAI\Microsoft.Agents.AI.Hosting.OpenAI.csproj -f net10.0 --tl:off -> passed, 0 warnings/errors
  • dotnet run --project .\tests\Microsoft.Agents.AI.Hosting.OpenAI.UnitTests\Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj -f net10.0 -> passed, 390 tests
  • git diff --check upstream/main..HEAD -> passed

The PR diff remains scoped to the six .NET OpenAI hosting/logprobs files after the rebase.

@he-yufeng
Yufeng He (he-yufeng) force-pushed the fix/openai-hosting-logprobs branch from c2e48bd to 766e32e Compare June 12, 2026 15:13
@he-yufeng

Copy link
Copy Markdown
Contributor Author

Rebased this branch onto current main and pushed head 766e32e67.

Validation run locally from dotnet/:

  • git diff --check upstream/main..HEAD -> passed
  • dotnet build .\src\Microsoft.Agents.AI.Hosting.OpenAI\Microsoft.Agents.AI.Hosting.OpenAI.csproj -f net10.0 --tl:off -> passed, 0 warnings/errors
  • dotnet run --project .\tests\Microsoft.Agents.AI.Hosting.OpenAI.UnitTests\Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj -f net10.0 -- --no-progress -> passed, 390 tests

@he-yufeng
Yufeng He (he-yufeng) force-pushed the fix/openai-hosting-logprobs branch from 766e32e to c80b6a3 Compare June 12, 2026 16:56
@he-yufeng
Yufeng He (he-yufeng) force-pushed the fix/openai-hosting-logprobs branch from c80b6a3 to 8ed968b Compare June 12, 2026 20:41
@moonbox3

Copy link
Copy Markdown
Contributor

Yufeng He (@he-yufeng) going forward, please post replies on the actual PR comments, not as follow up comments. It's hard for us to know which comments are actually resolved.

@he-yufeng

Copy link
Copy Markdown
Contributor Author

Nudge on this one: every review point from June is addressed and the branch is still mergeable with green checks. The Responses logprobs field now survives serialization both directions. Could use another pass when you have a minute.

This was referenced Aug 31, 2026
Mohammed Sanaullah (sanaullahmohammed) pushed a commit to sanaullahmohammed/NexusOps that referenced this pull request Sep 3, 2026
Updated
[Microsoft.Agents.AI](https://github.com/microsoft/agent-framework) from
1.19.0 to 1.20.0.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.Agents.AI's
releases](https://github.com/microsoft/agent-framework/releases)._

## 1.20.0

## What's Changed
* .NET: Bump AWSSDK.Extensions.Bedrock.MEAI from 4.0.6.10 to 4.0.101.8
by @​dependabot[bot] in
microsoft/agent-framework#7829
* .NET: Stabilize Foundry recovery tests by @​rogerbarreto in
microsoft/agent-framework#7817
* .NET: fix: preserve Responses logprobs field by @​he-yufeng in
microsoft/agent-framework#5860
* .NET: Honor cancellation for Foundry-hosted workflow responses by
@​rogerbarreto with @​Copilot in
microsoft/agent-framework#7842
* .NET: Use Responses API for hosted web search in AG-UI by
@​rogerbarreto with @​Copilot in
microsoft/agent-framework#7843
* .NET: Bump Aspire.Hosting from 13.1.0 to 13.5.2 by @​dependabot[bot]
in microsoft/agent-framework#7826
* .NET: Suppress false positive Zip Slip alert by @​SergeyMenshykh in
microsoft/agent-framework#7858
* .NET: added Mem0Sharp integration for in-memory storage in agent
samples. by @​jihadkhawaja in
microsoft/agent-framework#7792
* .NET: Annotate DevUI aggregator static-analysis false positives by
@​SergeyMenshykh in
microsoft/agent-framework#7864
* .NET: Rename CommunityToolkit.VectorData.CosmosNoSql to AzureCosmosDB
by @​adamsitnik in
microsoft/agent-framework#7878
* .NET: chore: upgrades aspnet openapi dependency by @​baywet in
microsoft/agent-framework#7870
* .NET: Simplify A2A function tool samples by @​SergeyMenshykh in
microsoft/agent-framework#7861
* .NET: Bump Azure.AI.AgentServer.Invocations from 1.0.0-beta.5 to
1.0.0-beta.6 by @​dependabot[bot] in
microsoft/agent-framework#7886
* .NET: docs: updates the contributing information for CFS users by
@​baywet in microsoft/agent-framework#7869
* Bump CommunityToolkit.VectorData.InMemory from 1.0.0 to 1.0.1 by
@​dependabot[bot] in
microsoft/agent-framework#7888
* .NET: Remove retired OpenAI Assistants integration tests by
@​rogerbarreto in microsoft/agent-framework#7896
* .NET: Simplify A2A client-server sample by @​SergeyMenshykh in
microsoft/agent-framework#7891
* Bump Dapr.AI.Microsoft.Extensions from 1.18.4 to 1.18.5 by
@​dependabot[bot] in
microsoft/agent-framework#7889
* .NET: docs/workflow fileinput sample dotnet by @​baywet in
microsoft/agent-framework#7913
* .NET: Add timeout for wait-for-first-completion by @​westey-m in
microsoft/agent-framework#7911
* .NET: Fix duplicate Foundry AgentHost port binding by @​rogerbarreto
in microsoft/agent-framework#7932
* .NET: tests: removes dependency on fluent assersion because of
licensing concerns by @​baywet in
microsoft/agent-framework#7938
* .NET: docs(decisions): resolve duplicate ADR sequence numbers (0016,
0021, 0024) by @​jluocsa in
microsoft/agent-framework#6046
* .NET: Bump Azure.Core from 1.61.0 to 1.62.0 by @​dependabot[bot] in
microsoft/agent-framework#7954
* .NET: Improve Cosmos DB Emulator startup reliability by @​TheovanKraay
in microsoft/agent-framework#3932
* .NET: add public API analyzers by @​baywet in
microsoft/agent-framework#7935
* .NET: Update version for 1.20.0 release by @​SergeyMenshykh in
microsoft/agent-framework#7972

## New Contributors
* @​madanmishra1223 made their first contribution in
microsoft/agent-framework#7705
* @​YashvantHange made their first contribution in
microsoft/agent-framework#7850
* @​jihadkhawaja made their first contribution in
microsoft/agent-framework#7792
* @​adamsitnik made their first contribution in
microsoft/agent-framework#7878
* @​baywet made their first contribution in
microsoft/agent-framework#7870
* @​Namraa310806 made their first contribution in
microsoft/agent-framework#7901
* @​Sweetteabittersugar made their first contribution in
microsoft/agent-framework#7903
* @​shoemoney made their first contribution in
microsoft/agent-framework#7837
* @​jluocsa made their first contribution in
microsoft/agent-framework#6046

**Full Changelog**:
microsoft/agent-framework@dotnet-1.19.0...dotnet-1.20.0

Commits viewable in [compare
view](microsoft/agent-framework@dotnet-1.19.0...dotnet-1.20.0).
</details>

Updated
[Microsoft.Agents.AI.OpenAI](https://github.com/microsoft/agent-framework)
from 1.19.0 to 1.20.0.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.Agents.AI.OpenAI's
releases](https://github.com/microsoft/agent-framework/releases)._

## 1.20.0

## What's Changed
* .NET: Bump AWSSDK.Extensions.Bedrock.MEAI from 4.0.6.10 to 4.0.101.8
by @​dependabot[bot] in
microsoft/agent-framework#7829
* .NET: Stabilize Foundry recovery tests by @​rogerbarreto in
microsoft/agent-framework#7817
* .NET: fix: preserve Responses logprobs field by @​he-yufeng in
microsoft/agent-framework#5860
* .NET: Honor cancellation for Foundry-hosted workflow responses by
@​rogerbarreto with @​Copilot in
microsoft/agent-framework#7842
* .NET: Use Responses API for hosted web search in AG-UI by
@​rogerbarreto with @​Copilot in
microsoft/agent-framework#7843
* .NET: Bump Aspire.Hosting from 13.1.0 to 13.5.2 by @​dependabot[bot]
in microsoft/agent-framework#7826
* .NET: Suppress false positive Zip Slip alert by @​SergeyMenshykh in
microsoft/agent-framework#7858
* .NET: added Mem0Sharp integration for in-memory storage in agent
samples. by @​jihadkhawaja in
microsoft/agent-framework#7792
* .NET: Annotate DevUI aggregator static-analysis false positives by
@​SergeyMenshykh in
microsoft/agent-framework#7864
* .NET: Rename CommunityToolkit.VectorData.CosmosNoSql to AzureCosmosDB
by @​adamsitnik in
microsoft/agent-framework#7878
* .NET: chore: upgrades aspnet openapi dependency by @​baywet in
microsoft/agent-framework#7870
* .NET: Simplify A2A function tool samples by @​SergeyMenshykh in
microsoft/agent-framework#7861
* .NET: Bump Azure.AI.AgentServer.Invocations from 1.0.0-beta.5 to
1.0.0-beta.6 by @​dependabot[bot] in
microsoft/agent-framework#7886
* .NET: docs: updates the contributing information for CFS users by
@​baywet in microsoft/agent-framework#7869
* Bump CommunityToolkit.VectorData.InMemory from 1.0.0 to 1.0.1 by
@​dependabot[bot] in
microsoft/agent-framework#7888
* .NET: Remove retired OpenAI Assistants integration tests by
@​rogerbarreto in microsoft/agent-framework#7896
* .NET: Simplify A2A client-server sample by @​SergeyMenshykh in
microsoft/agent-framework#7891
* Bump Dapr.AI.Microsoft.Extensions from 1.18.4 to 1.18.5 by
@​dependabot[bot] in
microsoft/agent-framework#7889
* .NET: docs/workflow fileinput sample dotnet by @​baywet in
microsoft/agent-framework#7913
* .NET: Add timeout for wait-for-first-completion by @​westey-m in
microsoft/agent-framework#7911
* .NET: Fix duplicate Foundry AgentHost port binding by @​rogerbarreto
in microsoft/agent-framework#7932
* .NET: tests: removes dependency on fluent assersion because of
licensing concerns by @​baywet in
microsoft/agent-framework#7938
* .NET: docs(decisions): resolve duplicate ADR sequence numbers (0016,
0021, 0024) by @​jluocsa in
microsoft/agent-framework#6046
* .NET: Bump Azure.Core from 1.61.0 to 1.62.0 by @​dependabot[bot] in
microsoft/agent-framework#7954
* .NET: Improve Cosmos DB Emulator startup reliability by @​TheovanKraay
in microsoft/agent-framework#3932
* .NET: add public API analyzers by @​baywet in
microsoft/agent-framework#7935
* .NET: Update version for 1.20.0 release by @​SergeyMenshykh in
microsoft/agent-framework#7972

## New Contributors
* @​madanmishra1223 made their first contribution in
microsoft/agent-framework#7705
* @​YashvantHange made their first contribution in
microsoft/agent-framework#7850
* @​jihadkhawaja made their first contribution in
microsoft/agent-framework#7792
* @​adamsitnik made their first contribution in
microsoft/agent-framework#7878
* @​baywet made their first contribution in
microsoft/agent-framework#7870
* @​Namraa310806 made their first contribution in
microsoft/agent-framework#7901
* @​Sweetteabittersugar made their first contribution in
microsoft/agent-framework#7903
* @​shoemoney made their first contribution in
microsoft/agent-framework#7837
* @​jluocsa made their first contribution in
microsoft/agent-framework#6046

**Full Changelog**:
microsoft/agent-framework@dotnet-1.19.0...dotnet-1.20.0

Commits viewable in [compare
view](microsoft/agent-framework@dotnet-1.19.0...dotnet-1.20.0).
</details>

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NET Usage: [Issues, PRs], Target: .Net

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: [Bug]: Azure.AI.AgentServer.Responses.PayloadValidationException: Required property 'logprobs' is missing

5 participants