.NET - Fix missing id on function_call_output in Foundry Hosting#6246
Merged
Conversation
The Foundry storage layer was rejecting responses with "ID cannot be null or empty (Parameter 'id')" because function_call_output items emitted by OutputConverter had no id on the wire. OutputItemFunctionToolCallOutput's public ctor only sets CallId and Output; Id is read-only and only the SDK's internal ctor populates it. OutputItemBuilder<T>.ApplyAutoStamps fills ResponseId and AgentReference but not Id, so the itemId passed to AddOutputItem<T>(itemId) was used only for event sequencing and the serialized item went out with id=null. Switch to stream.OutputItemFunctionCallOutput(callId, output), the SDK convenience method that uses the internal ctor and stamps the id. Add a regression test asserting the added/done events carry a non-empty matching Id. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a Foundry Hosting serialization issue where function_call_output items could be emitted with a missing id, causing the Foundry storage layer to reject responses.
Changes:
- Switch function-result emission in
OutputConverterto use the Responses SDKstream.OutputItemFunctionCallOutput(...)convenience method soOutputItemFunctionToolCallOutput.Idis populated. - Add a regression unit test asserting
OutputItemFunctionToolCallOutputhas a non-emptyId, and that theadded/doneevents carry the sameId.
Show a summary per file
| File | Description |
|---|---|
| dotnet/src/Microsoft.Agents.AI.Foundry.Hosting/OutputConverter.cs | Uses SDK helper to construct/stamp function_call_output items with a populated id. |
| dotnet/tests/Microsoft.Agents.AI.Foundry.Hosting.UnitTests/OutputConverterTests.cs | Adds regression coverage ensuring function_call_output items have non-empty, matching ids across added/done events. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 0
peibekwe
reviewed
Jun 1, 2026
peibekwe
approved these changes
Jun 1, 2026
TaoChenOSU
approved these changes
Jun 1, 2026
The ubuntu-latest dotnet-build/test jobs were hitting No space left on device because the runner image only ships ~14 GB free on /. The full multi-TFM build plus the dotnet pack + console-app install-check exhausts that easily. Add a reusable composite action .github/actions/free-runner-disk-space that runs on Linux runners only and: * removes pre-installed toolchains we never use here (Android SDK, GHC/Haskell, CodeQL, PyPy, Ruby, Go, boost, vcpkg, etc.), prunes docker images, and disables swap (reclaims ~25-30 GB on /) * relocates the NuGet package cache to /mnt/nuget via NUGET_PACKAGES env, since /mnt has ~75 GB free on hosted runners Wire the action into the four ubuntu-touching jobs in dotnet-build-and-test.yml (dotnet-build, dotnet-test, dotnet-foundry-hosted-it, dotnet-test-functions). The action self-guards with runner.os == 'Linux' so the matrix legs that run on windows are unaffected. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
peibekwe
approved these changes
Jun 1, 2026
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.
The Foundry storage layer was rejecting responses with "ID cannot be null or empty (Parameter 'id')" because function_call_output items emitted by OutputConverter had no id on the wire.
OutputItemFunctionToolCallOutput's public ctor only sets CallId and Output; Id is read-only and only the SDK's internal ctor populates it. OutputItemBuilder.ApplyAutoStamps fills ResponseId and AgentReference but not Id, so the itemId passed to AddOutputItem(itemId) was used only for event sequencing and the serialized item went out with id=null.
Switch to stream.OutputItemFunctionCallOutput(callId, output), the SDK convenience method that uses the internal ctor and stamps the id. Add a regression test asserting the added/done events carry a non-empty matching Id.
Contribution Checklist