.NET: Preserve hosted session key boundaries - #8263
Open
Ricky-7-Yan wants to merge 1 commit into
Open
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
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
Related Issue
Fixes #8251
Contribution Checklist
breaking 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.