Skip to content

Use recipient agentic identity defaults#587

Open
heyitsaamir wants to merge 2 commits into
mainfrom
heyitsaamir-agentic-identity-defaults
Open

Use recipient agentic identity defaults#587
heyitsaamir wants to merge 2 commits into
mainfrom
heyitsaamir-agentic-identity-defaults

Conversation

@heyitsaamir

Copy link
Copy Markdown
Collaborator

Summary

  • Add typed botId support on core channel accounts and preserve it through cloning/BotBuilder mapping
  • Derive inbound bot app id from recipient.botId while deriving agentic identity from inbound recipient
  • Update BotBuilder compat to use recipient agentic identity and avoid empty identity defaults

Validation

  • dotnet test core/test/Microsoft.Teams.Core.UnitTests/Microsoft.Teams.Core.UnitTests.csproj --filter BotRequestContextTests --verbosity minimal
  • dotnet test core/test/Microsoft.Teams.Apps.BotBuilder.UnitTests/Microsoft.Teams.Apps.BotBuilder.UnitTests.csproj --verbosity minimal

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>
Copilot AI review requested due to automatic review settings July 2, 2026 23:13

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.

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 BotId to Core ChannelAccount and preserve it when cloning CoreActivity.
  • Update inbound BotRequestContext derivation to use recipient.botId (and update unit tests accordingly).
  • Update BotBuilder compatibility mapping/tests to round-trip botId, and adjust TeamsApiClient to 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));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants