Auto-mark server-handled FunctionCallContent as InformationalOnly#7314
Merged
stephentoub merged 7 commits intomainfrom Feb 20, 2026
Merged
Auto-mark server-handled FunctionCallContent as InformationalOnly#7314stephentoub merged 7 commits intomainfrom
stephentoub merged 7 commits intomainfrom
Conversation
…ching FunctionResultContent exists For non-streaming: scan response messages for FCC/FRC pairs by CallId before processing function calls. For streaming: buffer updates once FCC is encountered, then check for FCC/FRC matches after stream ends. Both paths mark matched FCCs as InformationalOnly so they won't be invoked locally. Co-authored-by: stephentoub <[email protected]>
Co-authored-by: stephentoub <[email protected]>
Copilot
AI
changed the title
[WIP] Fix handling of FunctionCallContent and FunctionResultContent
Auto-mark server-handled FunctionCallContent as InformationalOnly
Feb 16, 2026
Member
|
Related to #7307 (comment) and microsoft/agent-framework#3967 |
Contributor
There was a problem hiding this comment.
Pull request overview
Updates FunctionInvokingChatClient to detect server-executed tool calls (FCC/FRC pairs) and avoid re-invoking those tools locally by auto-marking the matching FunctionCallContent as InformationalOnly, including for streaming scenarios.
Changes:
- Non-streaming: scan
ChatResponse.Messagesfor matchingFunctionResultContent.CallIdand mark correspondingFunctionCallContentasInformationalOnlybefore local invocation is considered. - Streaming: buffer updates after the first FCC, then after end-of-stream match FCC/FRC pairs across all updates, mark matched FCCs as
InformationalOnly, and remove them from the pending invocation list. - Add/update tests covering server-handled calls (pure server-handled, mixed server/local, and no-matching-FRC cases) and adjust an existing streaming-yield expectation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/Libraries/Microsoft.Extensions.AI/ChatCompletion/FunctionInvokingChatClient.cs | Adds FCC/FRC matching logic and adjusts streaming buffering to enable server-handled detection. |
| test/Libraries/Microsoft.Extensions.AI.Tests/ChatCompletion/FunctionInvokingChatClientTests.cs | Adds new test coverage validating server-handled FCCs are marked InformationalOnly and skipped locally. |
| test/Libraries/Microsoft.Extensions.AI.Tests/ChatCompletion/FunctionInvokingChatClientApprovalsTests.cs | Updates a streaming-yield assertion to reflect new buffering behavior once FCCs appear. |
...ies/Microsoft.Extensions.AI.Tests/ChatCompletion/FunctionInvokingChatClientApprovalsTests.cs
Show resolved
Hide resolved
test/Libraries/Microsoft.Extensions.AI.Tests/ChatCompletion/FunctionInvokingChatClientTests.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/FunctionInvokingChatClient.cs
Show resolved
Hide resolved
stephentoub
reviewed
Feb 17, 2026
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/FunctionInvokingChatClient.cs
Show resolved
Hide resolved
… comments - Rename FunctionCallContentIsYieldedImmediatelyIfNoApprovalRequiredWhenStreamingAsync to FunctionCallContentIsBufferedUntilEndOfStreamWhenStreamingAsync with updated summary - Remove unused fcc/frc local variables in ServerHandledFunctionCalls_MarkedAsInformationalOnly - Update streaming comment block to explain both server-handled FCC/FRC detection and approval buffering reasons for buffering after first FCC Co-authored-by: stephentoub <[email protected]>
jozkee
approved these changes
Feb 17, 2026
stephentoub
reviewed
Feb 19, 2026
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/FunctionInvokingChatClient.cs
Show resolved
Hide resolved
stephentoub
reviewed
Feb 19, 2026
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/FunctionInvokingChatClient.cs
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MarkServerHandledFunctionCallshelper that scans content for FCC/FRC pairs and marks matching FCCs asInformationalOnly = trueCopyFunctionCallsFunctionCallContentIsYieldedImmediatelyIfNoApprovalRequiredWhenStreamingAsynctoFunctionCallContentIsBufferedUntilEndOfStreamWhenStreamingAsyncwith updated summaryfcc/frcvariables inServerHandledFunctionCalls_MarkedAsInformationalOnly✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
Microsoft Reviewers: Open in CodeFlow