Skip to content

.NET: [BREAKING] Clarify Foundry storage docs and user identity accessor - #10217

Merged
Roger Barreto (rogerbarreto) merged 3 commits into
microsoft:mainfrom
rogerbarreto:foundry-review-follow-up
Nov 10, 2026
Merged

Roger Barreto (rogerbarreto) merged 3 commits into
microsoft:mainfrom
rogerbarreto:foundry-review-follow-up

Conversation

@rogerbarreto

Copy link
Copy Markdown
Member

Motivation & Context

Address deferred review feedback from #10132. The storage options did not clearly distinguish requests sent to the inference service from hosted responses returned to callers. The user identity accessor also needs an explicitly Foundry-specific name.

Description & Review Guide

  • What are the major changes? Clarify XML documentation for inference-service storage and encrypted reasoning inclusion. Rename GetHostedUserId() to GetFoundryHostedUserId() and update callers, tests, samples, and current API notes. Document that the accessor reads saved session identity and that Responses hosting currently assigns it.
  • What is the impact of these changes? Callers must replace session.GetHostedUserId() with session.GetFoundryHostedUserId(). The serialized identity key remains unchanged, so existing saved sessions remain readable. No session-storage, identity-isolation, or agent lifetime behavior changes. Agent lifetime configuration is deferred to a separate PR. The locked AgentServer A2A implementation exposes user identity to its handler, supporting the protocol-independent Foundry name; this PR does not add A2A session identity assignment or change dependencies.
  • What do you want reviewers to focus on? Accuracy of the distinction between inference-service storage and Foundry response storage, the precise effect of requesting encrypted reasoning, and preservation of the saved identity key.

Related Issue

N/A: trivial change. Documentation corrections and an explicitly requested accessor naming correction address deferred feedback from merged #10132. No new hosting behavior or lifetime design is introduced.

AI Assistance

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

AI assistance details: Copilot assisted with source investigation, documentation, the accessor rename, regression tests, validation, and this PR description.

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 links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • 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.

Local validation on Windows using Debug/net10.0:

  • From dotnet: dotnet test --project tests\Microsoft.Agents.AI.Foundry.Hosting.UnitTests\Microsoft.Agents.AI.Foundry.Hosting.UnitTests.csproj -f net10.0 -c Debug --no-restore: passed, 592 succeeded, 1 existing skip, 0 failures.
  • From dotnet: dotnet build samples\04-hosting\FoundryHostedAgents\responses\Hosted-MemoryAgent\HostedMemoryAgent.csproj -c Debug -f net10.0 --no-restore --tl:off: passed, 0 warnings and 0 errors.
  • From dotnet: dotnet build tests\Foundry.Hosting.IntegrationTests.TestContainer\Foundry.Hosting.IntegrationTests.TestContainer.csproj -c Debug -f net10.0 --no-restore --tl:off: passed, 0 warnings and 0 errors.
  • In the CI image mcr.microsoft.com/dotnet/sdk:10.0, from dotnet, dotnet format <project> --verify-no-changes --verbosity diagnostic: passed separately for src/Microsoft.Agents.AI.Foundry.Hosting/Microsoft.Agents.AI.Foundry.Hosting.csproj, tests/Microsoft.Agents.AI.Foundry.Hosting.UnitTests/Microsoft.Agents.AI.Foundry.Hosting.UnitTests.csproj, samples/04-hosting/FoundryHostedAgents/responses/Hosted-MemoryAgent/HostedMemoryAgent.csproj, and tests/Foundry.Hosting.IntegrationTests.TestContainer/Foundry.Hosting.IntegrationTests.TestContainer.csproj. No formatting changes.
  • git diff --check: passed. Live Foundry integration tests and other target-framework test runs were not run.

Rename GetHostedUserId to GetFoundryHostedUserId to identify the
Foundry-specific contract. Preserve the serialized session key.

Clarify inference storage and encrypted reasoning XML documentation.
Leave agent lifetime configuration for a separate change.

BREAKING CHANGE: replace GetHostedUserId() calls with
GetFoundryHostedUserId().

Refs microsoft#10132
Copilot AI balanced review requested due to automatic review settings November 10, 2026 04:06
@agent-framework-automation agent-framework-automation Bot added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net breaking change Usage: [PRs], Target: all PRs that introduce changes that are not backward compatible labels Nov 10, 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.

🟢 Approval recommended

No active review issues are recorded for the Foundry-specific accessor rename and storage documentation updates.

No open issues 🎉

What changed in this PR

This follow-up to #10132 clarifies .NET Foundry Hosting storage documentation and makes the session identity accessor explicitly Foundry-specific. The accessor rename is breaking, but the saved identity key and hosting behavior remain unchanged.

Changes:

  • Distinguish inference-service storage and encrypted reasoning requests from hosted response storage.
  • Rename GetHostedUserId() to GetFoundryHostedUserId() across callers, samples, tests, and API notes.
  • Add regression tests for reading the existing identity key and rejecting a null session.
File Description
dotnet/​tests/​Microsoft.Agents.AI.Foundry.Hosting.UnitTests/​HostedUserIdTests.cs Update identity assertions to the renamed accessor.
dotnet/​tests/​Microsoft.Agents.AI.Foundry.Hosting.UnitTests/​AgentSessionExtensionsTests.cs Rename accessor tests and add compatibility and null-input coverage.
dotnet/​tests/​Microsoft.Agents.AI.Foundry.Hosting.UnitTests/​AgentFrameworkResponseHandlerTests.cs Update the session-reuse identity assertion.
dotnet/​tests/​Foundry.Hosting.IntegrationTests.TestContainer/​UserIdentityEchoAgent.cs Use the renamed accessor when echoing identity.
dotnet/​tests/​Foundry.Hosting.IntegrationTests.TestContainer/​Program.cs Update per-user memory identity lookup.
dotnet/​src/​Microsoft.Agents.AI.Foundry.Hosting/​FoundryResponsesServerOptions.cs Clarify storage and encrypted reasoning XML documentation.
dotnet/​src/​Microsoft.Agents.AI.Foundry.Hosting/​AgentSessionExtensions.cs Rename the public accessor and document saved-session identity semantics.
dotnet/​src/​Microsoft.Agents.AI.Foundry.Hosting/​AgentFrameworkResponseHandler.cs Use the renamed accessor for identity validation.
dotnet/​samples/​04-hosting/​FoundryHostedAgents/​responses/​Hosted-MemoryAgent/​Program.cs Update the local-source accessor call and explanatory comment.
docs/​decisions/​0034-hosted-platform-context-agentserver-2.0.md Update current API notes to the Foundry-specific name.

Review effort: Balanced

@github-actions github-actions Bot 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.

MAF Automated Review — Iteration 1

Result: No findings
Scope: full PR (1 commit(s)): 6d1c4928847a
Model: gpt-5.6-sol

Overview

This PR deliberately renames a preview Foundry-hosting accessor and clarifies the separation between inference-service storage and hosted-response storage. The rename is complete across production callers, tests, samples, and documentation; the persisted state key remains unchanged and is pinned by a regression test. The request-option documentation is consistent with the existing conversion paths, and no publishable correctness, compatibility, architectural, or security defect was established.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.

@baywet
Vincent Biret (baywet) added this pull request to the merge queue Nov 10, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 10, 2026
@baywet

Copy link
Copy Markdown
Member

I think the merged is blocked because of a flaky test, see #10231

@rogerbarreto
Roger Barreto (rogerbarreto) added this pull request to the merge queue Nov 10, 2026
Merged via the queue into microsoft:main with commit fe87fdd Nov 10, 2026
34 checks passed
@rogerbarreto
Roger Barreto (rogerbarreto) deleted the foundry-review-follow-up branch November 10, 2026 17:05

This branch was successfully deployed

1 active deployment
github-app-auth — 4e35f98e Deployed Nov 10, 2026 by rogerbarreto via add_label #27510
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Usage: [PRs], Target: all PRs that introduce changes that are not backward compatible documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants