Revert: Fix GetCallerBaggagePairs userId fallback#253
Open
fpfp100 wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Reverts the previous get_caller_pairs behavior so user.id is populated only from aad_object_id, aligning with ingest requirements that user.id must be a GUID and avoiding downstream breakage when non-GUID fallbacks are used.
Changes:
- Remove the
aad_object_id → agentic_user_id → frm.idfallback chain foruser.id. - Delete tests that validated the removed fallback behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/observability/hosting/scope_helpers/test_scope_helper_utils.py | Removes test cases that asserted the fallback chain for user.id. |
| libraries/microsoft-agents-a365-observability-hosting/microsoft_agents_a365/observability/hosting/scope_helpers/utils.py | Changes get_caller_pairs to emit user.id only from from_property.aad_object_id. |
Comment on lines
83
to
87
| assert (CHANNEL_LINK_KEY, None) in result | ||
|
|
||
|
|
||
| def test_get_caller_pairs_non_teams_fallback_to_from_id(): | ||
| """Test userId falls back to from.id when aad_object_id is None (non-Teams channel).""" | ||
| from_account = ChannelAccount( | ||
| id="from-id-123", | ||
| name="Non-Teams User", | ||
| ) | ||
| activity = Activity(type="message", from_property=from_account) | ||
|
|
||
| result = list(get_caller_pairs(activity)) | ||
|
|
||
| assert (USER_ID_KEY, "from-id-123") in result | ||
| assert (USER_NAME_KEY, "Non-Teams User") in result | ||
| assert (USER_EMAIL_KEY, None) in result | ||
|
|
||
|
|
||
| def test_get_caller_pairs_a2a_fallback_to_agentic_user_id(): | ||
| """Test userId falls back to agentic_user_id for A2A calls (no aad_object_id).""" | ||
| from_account = ChannelAccount( | ||
| id="from-id-456", | ||
| name="Agent Caller", | ||
| agentic_user_id="a2a-agent-guid", | ||
| ) | ||
| activity = Activity(type="message", from_property=from_account) | ||
|
|
||
| result = list(get_caller_pairs(activity)) | ||
|
|
||
| assert (USER_ID_KEY, "a2a-agent-guid") in result | ||
| assert (USER_EMAIL_KEY, "a2a-agent-guid") in result | ||
|
|
||
|
|
||
| def test_get_caller_pairs_aad_object_id_wins_when_all_set(): | ||
| """Test aad_object_id takes precedence when all identifiers are present.""" | ||
| from_account = ChannelAccount( | ||
| id="from-id-789", | ||
| aad_object_id="aad-wins", | ||
| name="Full User", | ||
| agentic_user_id="agent-upn", | ||
| ) | ||
| activity = Activity(type="message", from_property=from_account) | ||
|
|
||
| result = list(get_caller_pairs(activity)) | ||
|
|
||
| assert (USER_ID_KEY, "aad-wins") in result | ||
| assert (USER_NAME_KEY, "Full User") in result | ||
| assert (USER_EMAIL_KEY, "agent-upn") in result | ||
|
|
||
|
|
||
| def test_get_caller_pairs_a2a_guid_agentic_user_id(): | ||
| """Test userId resolves to GUID AgenticUserId in A2A scenario.""" | ||
| from_account = ChannelAccount( | ||
| id="29:1sH5NArUwkWAX", | ||
| name="Agent Caller", | ||
| agentic_user_id="bef730f4-d6f5-4ffb-b759-26ffa449ed7e", | ||
| ) | ||
| activity = Activity(type="message", from_property=from_account) | ||
| result = list(get_caller_pairs(activity)) | ||
| assert (USER_ID_KEY, "bef730f4-d6f5-4ffb-b759-26ffa449ed7e") in result | ||
|
|
||
|
|
||
| def test_get_conversation_pairs(): | ||
| """Test get_conversation_pairs extracts conversation information.""" |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
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
Reverts #251.
The ingest service only accepts GUIDs for
user.id. Any non-GUID value gets replaced with an all-zeros GUID (00000000-0000-0000-0000-000000000000). Allowing non-GUID values as userId (via theaad_object_id → agentic_user_id → frm.idfallback chain) breaks downstream scenarios that expect an AAD object ID.Test plan
🤖 Generated with Claude Code
Note
The original PR will not take effect since UPN (non-GUID) values are always ignored by the ingestion service.