Use recipient agentic identity defaults#587
Open
heyitsaamir wants to merge 2 commits into
Open
Conversation
Derive inbound bot app id from recipient botId and use recipient agentic identity for BotBuilder compat defaults. Preserve botId through channel account mapping and add focused tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Teams Core/BotBuilder schema mapping and request-context derivation to preserve a typed recipient.botId through cloning and Bot Framework compatibility layers, and to derive inbound bot app id + agentic identity from the inbound recipient (bot) identity.
Changes:
- Add
BotIdto CoreChannelAccountand preserve it when cloningCoreActivity. - Update inbound
BotRequestContextderivation to userecipient.botId(and update unit tests accordingly). - Update BotBuilder compatibility mapping/tests to round-trip
botId, and adjustTeamsApiClientto use recipient-derived agentic identity without creating empty defaults.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| core/test/Microsoft.Teams.Core.UnitTests/Http/BotRequestContextTests.cs | Updates inbound-context tests to use typed Recipient.BotId. |
| core/test/Microsoft.Teams.Apps.BotBuilder.UnitTests/CompatActivityTests.cs | Adds coverage for botId mapping to/from compat ChannelAccount properties. |
| core/src/Microsoft.Teams.Core/Schema/CoreActivity.cs | Preserves BotId (and TenantId) when cloning ChannelAccounts. |
| core/src/Microsoft.Teams.Core/Schema/ChannelAccount.cs | Introduces typed BotId property on Core ChannelAccount. |
| core/src/Microsoft.Teams.Core/Http/BotRequestContext.cs | Switches inbound bot app id derivation to Recipient.BotId. |
| core/src/Microsoft.Teams.Apps.BotBuilder/TeamsApiClient.cs | Uses recipient-derived agentic identity and makes identity nullable (no empty defaults). |
| core/src/Microsoft.Teams.Apps.BotBuilder/ActivitySchemaMapper.cs | Maps botId between compat ChannelAccount properties and Core typed BotId. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
55
to
+56
| public static BotRequestContext? FromInboundActivity(CoreActivity? activity) | ||
| => Build(Schema.AgenticIdentity.FromAccount(activity?.Recipient), NormalizeAppId(activity?.Recipient?.Id)); | ||
| => Build(Schema.AgenticIdentity.FromAccount(activity?.Recipient), NormalizeAppId(activity?.Recipient?.BotId)); |
68d9a72 to
362911f
Compare
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.
Summary
botIdsupport on core channel accounts and preserve it through cloning/BotBuilder mappingrecipient.botIdwhile deriving agentic identity from inbound recipientValidation
dotnet test core/test/Microsoft.Teams.Core.UnitTests/Microsoft.Teams.Core.UnitTests.csproj --filter BotRequestContextTests --verbosity minimaldotnet test core/test/Microsoft.Teams.Apps.BotBuilder.UnitTests/Microsoft.Teams.Apps.BotBuilder.UnitTests.csproj --verbosity minimal