Skip to content

Comments

Changing usage of recipient.id to recipient.agentic_user_id for agentic auth flows#173

Merged
axelsrz merged 12 commits intomainfrom
users/robrandao/agentic-user-id
Oct 20, 2025
Merged

Changing usage of recipient.id to recipient.agentic_user_id for agentic auth flows#173
axelsrz merged 12 commits intomainfrom
users/robrandao/agentic-user-id

Conversation

@rodrigobr-msft
Copy link
Contributor

This pull request updates the codebase to consistently use the field agentic_user_id instead of id or upn for identifying agentic users. The changes impact authentication, authorization, and activity handling logic, as well as related tests. This standardization improves clarity and reduces confusion around user identity fields in agentic scenarios.

Core logic and API changes:

  • Updated all relevant methods and classes to use agentic_user_id instead of id or upn for agentic user identification, including parameter names, documentation, and log messages. (microsoft_agents/activity/activity.py [1] microsoft_agents/authentication/msal/msal_auth.py [2] [3] microsoft_agents/hosting/core/app/oauth/_handlers/agentic_user_authorization.py [4] microsoft_agents/hosting/core/authorization/access_token_provider_base.py [5] microsoft_agents/hosting/core/authorization/anonymous_token_provider.py [6]

Testing updates:

  • Refactored all test cases to use the agentic_user_id field in ChannelAccount and related objects, ensuring tests reflect the new field usage. (tests/activity/test_activity.py [1] [2] [3] [4]; tests/hosting_core/app/_oauth/_handlers/test_agentic_user_authorization.py [5] [6] [7] [8] [9] [10] [11] [12]

@rodrigobr-msft rodrigobr-msft marked this pull request as ready for review October 16, 2025 14:00
Copilot AI review requested due to automatic review settings October 16, 2025 14:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request standardizes the identification of agentic users by consistently using agentic_user_id instead of id or upn throughout the codebase. This change improves clarity and eliminates ambiguity in agentic authentication and authorization flows.

  • Updated parameter names, documentation, and log messages to use agentic_user_id
  • Modified MSAL authentication to use user_id field instead of username in token acquisition
  • Refactored all test cases to reflect the new field usage

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
microsoft_agents/activity/activity.py Updated get_agentic_user() to return recipient.agentic_user_id instead of recipient.id
microsoft_agents/authentication/msal/msal_auth.py Changed parameter from upn to agentic_user_id and updated token acquisition to use user_id field
microsoft_agents/hosting/core/app/oauth/_handlers/agentic_user_authorization.py Renamed variable from upn to agentic_user_id and updated error messages
microsoft_agents/hosting/core/authorization/access_token_provider_base.py Changed method signature parameter from upn to agentic_user_id
microsoft_agents/hosting/core/authorization/anonymous_token_provider.py Updated method signature to use agentic_user_id parameter
microsoft_agents/hosting/core/connector/client/connector_client.py Increased max conversation ID length and added debugging code with hardcoded test entities
tests/activity/test_activity.py Updated test cases to use agentic_user_id field in ChannelAccount
tests/hosting_core/app/_oauth/_handlers/test_agentic_user_authorization.py Updated test cases to use agentic_user_id field in ChannelAccount

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copilot AI review requested due to automatic review settings October 17, 2025 15:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copilot AI review requested due to automatic review settings October 17, 2025 15:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@axelsrz axelsrz merged commit ddd472c into main Oct 20, 2025
9 checks passed
@axelsrz axelsrz deleted the users/robrandao/agentic-user-id branch October 20, 2025 18:00
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.

4 participants