Skip to content

.NET - Fix missing id on function_call_output in Foundry Hosting#6246

Merged
alliscode merged 2 commits into
microsoft:mainfrom
alliscode:ha-storage-issue
Jun 1, 2026
Merged

.NET - Fix missing id on function_call_output in Foundry Hosting#6246
alliscode merged 2 commits into
microsoft:mainfrom
alliscode:ha-storage-issue

Conversation

@alliscode
Copy link
Copy Markdown
Member

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

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

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>
Copilot AI review requested due to automatic review settings June 1, 2026 17:41
@moonbox3 moonbox3 added the .NET label Jun 1, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 OutputConverter to use the Responses SDK stream.OutputItemFunctionCallOutput(...) convenience method so OutputItemFunctionToolCallOutput.Id is populated.
  • Add a regression unit test asserting OutputItemFunctionToolCallOutput has a non-empty Id, and that the added/done events carry the same Id.
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

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Automated Code Review

Reviewers: 4 | Confidence: 91% | Result: All clear

Reviewed: Correctness, Security Reliability, Test Coverage, Design Approach


Automated review by alliscode's agents

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>
@alliscode alliscode added this pull request to the merge queue Jun 1, 2026
Merged via the queue into microsoft:main with commit b298113 Jun 1, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants