.NET: Preserve hosted session key boundaries - #8263
Merged
Roger Barreto (rogerbarreto) merged 6 commits intoSep 15, 2026
Merged
Roger Barreto (rogerbarreto) merged 6 commits into
Roger Barreto (rogerbarreto) merged 6 commits into
Conversation
Signed-off-by: Ricky-7-Yan <2314530442@qq.com>
Ricky-7-Yan
temporarily deployed
to
github-app-auth
September 10, 2026 16:50 — with
GitHub Actions
Inactive
Ricky-7-Yan
temporarily deployed
to
github-app-auth
September 10, 2026 16:50 — with
GitHub Actions
Inactive
Ricky-7-Yan
temporarily deployed
to
github-app-auth
September 10, 2026 16:50 — with
GitHub Actions
Inactive
Ricky-7-Yan
temporarily deployed
to
github-app-auth
September 10, 2026 16:50 — with
GitHub Actions
Inactive
Ricky-7-Yan
marked this pull request as ready for review
September 10, 2026 16:51
Ricky-7-Yan
requested review from
SergeyMenshykh,
Tao Chen (TaoChenOSU),
Vincent Biret (baywet),
chetantoshniwal,
Eduard van Valkenburg (eavanvalkenburg),
Giles Odigwe (giles17),
Jose Alvarez (jpalvarezl),
Evan Mattson (moonbox3),
Peter Ibekwe (peibekwe),
Roger Barreto (rogerbarreto) and
westey (westey-m)
as code owners
September 10, 2026 16:51
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The implementations preserve identifier boundaries and existing null, empty, and local-mode behavior with focused regression coverage.
Pull request overview
Preserves hosted session isolation by replacing ambiguous delimiter-based keys with boundary-safe representations.
Changes:
- Serializes Python hosted identifiers as compact JSON arrays.
- Uses a typed composite key for the .NET in-memory store.
- Adds regression tests for collision isolation and session continuity.
File summaries
| File | Description |
|---|---|
python/samples/04-hosting/foundry-hosted-agents/invocations/break_glass/main.py |
Updates the sample’s hosted session key format. |
python/packages/foundry_hosting/tests/test_invocations.py |
Tests collision isolation and repeated-session reuse. |
python/packages/foundry_hosting/agent_framework_foundry_hosting/_invocations.py |
Generates unambiguous hosted partition keys. |
dotnet/tests/Microsoft.Agents.AI.Foundry.Hosting.UnitTests/InMemoryAgentSessionStoreTests.cs |
Verifies composite identifier boundaries. |
dotnet/src/Microsoft.Agents.AI.Foundry.Hosting/InMemoryAgentSessionStore.cs |
Replaces concatenated keys with a typed record key. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Ricky-7-Yan
temporarily deployed
to
github-app-auth
September 10, 2026 16:52 — with
GitHub Actions
Inactive
Ricky-7-Yan
temporarily deployed
to
github-app-auth
September 10, 2026 16:52 — with
GitHub Actions
Inactive
Vincent Biret (baywet)
approved these changes
Sep 10, 2026
Vincent Biret (baywet)
left a comment
Member
There was a problem hiding this comment.
Thanks for the contribution!
(to other reviewers, I've only reviewed the dotnet side of things)
Ricky-7-Yan
had a problem deploying
to
integration
September 10, 2026 17:47 — with
GitHub Actions
Failure
Ricky-7-Yan
temporarily deployed
to
integration
September 10, 2026 17:47 — with
GitHub Actions
Inactive
Roger Barreto (rogerbarreto)
deployed
to
github-app-auth
September 11, 2026 14:41 — with
GitHub Actions
Active
Roger Barreto (rogerbarreto)
deployed
to
integration
September 11, 2026 15:08 — with
GitHub Actions
Active
Roger Barreto (rogerbarreto)
deployed
to
integration
September 11, 2026 15:08 — with
GitHub Actions
Active
Describe the identifier contract without exposing its internal representation as a compatibility guarantee. Refs microsoft#8251
Roger Barreto (rogerbarreto)
deployed
to
github-app-auth
September 14, 2026 13:20 — with
GitHub Actions
Active
Roger Barreto (rogerbarreto)
had a problem deploying
to
integration
September 14, 2026 13:21 — with
GitHub Actions
Failure
Roger Barreto (rogerbarreto)
deployed
to
integration
September 14, 2026 13:21 — with
GitHub Actions
Active
Eduard van Valkenburg (eavanvalkenburg)
approved these changes
Sep 14, 2026
Roger Barreto (rogerbarreto)
deployed
to
github-app-auth
September 14, 2026 16:44 — with
GitHub Actions
Active
Roger Barreto (rogerbarreto)
deployed
to
integration
September 14, 2026 16:45 — with
GitHub Actions
Active
Roger Barreto (rogerbarreto)
had a problem deploying
to
integration
September 14, 2026 16:45 — with
GitHub Actions
Failure
5 tasks
Member
|
Thanks for the update. Before this is ready, could you please:
Once those are addressed, please re-request review. Thanks! |
Keep the shared .NET session store from main, which already preserves composite identity boundaries. Remove superseded PR-only .NET tests and retain the Python session harness changes. Include upstream CI test fixes without rewriting contributor history. Refs microsoft#8251
Roger Barreto (rogerbarreto)
deployed
to
github-app-auth
September 15, 2026 14:25 — with
GitHub Actions
Active
Eduard van Valkenburg (eavanvalkenburg)
approved these changes
Sep 15, 2026
This was referenced Sep 18, 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.
Motivation & Context Hosted session stores must preserve the boundaries between agent, user, and conversation identifiers. Delimiter-based string keys allow distinct identifier tuples containing
:to collapse to the same cache entry, which can mix session state across requests. ### Description & Review Guide - What are the major changes? Python Invocations hosting now serializes hosted session/user identifiers as a compact JSON array, including the standalone break-glass example. The .NET Foundry in-memory store now uses a strongly typed composite key. Focused regression tests cover distinct colliding tuples and repeated-request continuity. - What is the impact of these changes? Distinct hosted identifier combinations remain isolated while existing local-mode keys and same-tuple session reuse stay unchanged. - What do you want reviewers to focus on? Please review the hosted key representation and the compatibility of null/empty agent and user components in the .NET store. ### Related Issue Fixes #8251 ### Contribution Checklist - [x] The code builds clean without any errors or warnings - [x] All unit tests pass, and I have added new tests where possible - [x] The PR follows the Contribution Guidelines - [x] This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above). - [x] This is not a breaking change. If it is a breaking change, add thebreaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.