Skip to content

.NET: Enable function approval response content DevUI Extension#6778

Open
Kumima wants to merge 2 commits into
microsoft:mainfrom
Kumima:dev-ui-function-approval
Open

.NET: Enable function approval response content DevUI Extension#6778
Kumima wants to merge 2 commits into
microsoft:mainfrom
Kumima:dev-ui-function-approval

Conversation

@Kumima

@Kumima Kumima commented Jun 27, 2026

Copy link
Copy Markdown

Motivation & Context

I can see there are some other MRs for this, and I did review those. Those are definitely AI generated without human tests. This is tested.

.NET DevUI relies on the default OpenAPI response endpoints. And it does not expect to accept the custom MessageFunctionApprovalResponseContent from DevUI. This MR enables function approval response content DevUI Extension, so that the tool approval response will be handled.

Concern:
This adds additional behavior into the OpenAPI response endpoints, which may make it not perfectly the same with the specification.

Verified:
image

Related Issue

Fixes #6006

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Copilot AI review requested due to automatic review settings June 27, 2026 08:02
@moonbox3 moonbox3 added the .NET Usage: [Issues, PRs], Target: .Net label Jun 27, 2026
@github-actions github-actions Bot changed the title [.NET] Enable function approval response content DevUI Extension .NET: [.NET] Enable function approval response content DevUI Extension Jun 27, 2026
@Kumima

Kumima commented Jun 27, 2026

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@Kumima Kumima changed the title .NET: [.NET] Enable function approval response content DevUI Extension .NET: Enable function approval response content DevUI Extension Jun 27, 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

This PR updates the .NET OpenAI Hosting “Responses” wire-model and conversion layer to recognize DevUI’s function_approval_response content discriminator and convert that payload into ToolApprovalResponseContent, addressing DevUI HITL approval failures (Fixes #6006).

Changes:

  • Adds a new ItemContent polymorphic derived type for "function_approval_response" and its associated payload model.
  • Extends ItemContentConverter.ToAIContent to convert the new wire type into ToolApprovalResponseContent + FunctionCallContent.
  • Introduces argument parsing for the approval response’s function_call.arguments payload.

Reviewed changes

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

File Description
dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Responses/Models/ItemResource.cs Adds the new ItemContentFunctionApprovalResponse wire-model type and discriminator registration.
dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Responses/Converters/ItemContentConverter.cs Converts function_approval_response items into ToolApprovalResponseContent and parses function-call arguments.

Comment on lines +447 to +451
/// <summary>
/// Represents function call information for approval response item.
/// </summary>
internal sealed class FunctionCall
{
[JsonDerivedType(typeof(ItemContentOutputText), "output_text")]
[JsonDerivedType(typeof(ItemContentOutputAudio), "output_audio")]
[JsonDerivedType(typeof(ItemContentRefusal), "refusal")]
[JsonDerivedType(typeof(ItemContentFunctionApprovalResponse), "function_approval_response")]
@Kumima

Kumima commented Jun 27, 2026

Copy link
Copy Markdown
Author

@rogerbarreto, could you take a look or assign reviewers?

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]: DEVUI Read unrecognized type discriminator id 'function_approval_response'.

3 participants