Skip to content

Revert: Fix GetCallerBaggagePairs userId fallback#253

Open
fpfp100 wants to merge 1 commit into
mainfrom
revert-userid-fallback
Open

Revert: Fix GetCallerBaggagePairs userId fallback#253
fpfp100 wants to merge 1 commit into
mainfrom
revert-userid-fallback

Conversation

@fpfp100
Copy link
Copy Markdown
Contributor

@fpfp100 fpfp100 commented May 13, 2026

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 the aad_object_id → agentic_user_id → frm.id fallback chain) breaks downstream scenarios that expect an AAD object ID.

Test plan

  • Verify existing tests pass
  • Confirm userId is only set from aad_object_id again

🤖 Generated with Claude Code

Note

The original PR will not take effect since UPN (non-GUID) values are always ignored by the ingestion service.

Copilot AI review requested due to automatic review settings May 13, 2026 21:27
@fpfp100 fpfp100 requested a review from a team as a code owner May 13, 2026 21:27
Copy link
Copy Markdown
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

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.id fallback chain for user.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."""
@github-actions
Copy link
Copy Markdown

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

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.

3 participants