dotnet / dotnet/aspnetcore

Components.AI: Honor ToolApprovalRequestContent.RequiresConfirmation

Open
#68,765 1 comment 0 reactions 0 assignees View on GitHub
area-blazor feature-blazor-builtin-components
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is your feature request related to a problem? Please describe the problem.

`FunctionApprovalHandler` treats every `ToolApprovalRequestContent` as requiring user input. Microsoft.Extensions.AI 10.8+ sets `RequiresConfirmation = false` on collateral approval requests created only because another tool call in the same response requires approval. Components.AI would incorrectly display an approval prompt and wait for the user for those calls.

### Describe the solution you'd like

Honor `RequiresConfirmation` when the Microsoft.Extensions.AI dependency exposes it:

- Render and await `FunctionApprovalBlock` only when confirmation is required.
- Automatically create an approved `ToolApprovalResponseContent` when confirmation is not required.
- Preserve call IDs, result ordering, and batch grouping when automatic and user-approved responses are mixed.
- Cover mixed batches when the required call is approved and when it is rejected.

### Additional context

Follow-up to #68227 approval behavior and https://github.com/dotnet/aspnetcore/pull/68329#discussion_r3843418038.

Depends on upgrading Microsoft.Extensions.AI from 10.6 to 10.8 or later. The property was introduced by https://github.com/dotnet/extensions/pull/7549 and is currently experimental.

Contributor guide

Open the contributing guide

Research direction

Start at FunctionApprovalHandler and trace how it creates FunctionApprovalBlock and ToolApprovalResponseContent for ToolApprovalRequestContent batches. Check the Microsoft.Extensions.AI dependency upgrade from 10.6 to 10.8 or later, then cover mixed batches where the required call is approved or rejected while preserving call IDs, result ordering, and grouping.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
ai, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.