Skip to content

Fix GetCallerBaggagePairs: resolve userId across all channels#86

Merged
fpfp100 merged 3 commits into
mainfrom
fix/userid-fallback-chain
May 5, 2026
Merged

Fix GetCallerBaggagePairs: resolve userId across all channels#86
fpfp100 merged 3 commits into
mainfrom
fix/userid-fallback-chain

Conversation

@fpfp100

@fpfp100 fpfp100 commented May 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Channel behavior after fix

Field Teams Other channels (AadObjectId null) A2A (user) A2A (agent)
userId AadObjectId From.Id AadObjectId AgenticUserId

Test plan

  • Existing tests pass
  • New test: non-Teams channel — userId falls back to From.Id
  • New test: A2A — userId falls back to AgenticUserId
  • New test: precedence — AadObjectId wins when all set

🤖 Generated with Claude Code

userId was only set from AadObjectId, which is null on non-Teams
channels and A2A calls. Add fallback chain: AadObjectId → AgenticUserId → From.Id

Port of microsoft/Agent365-dotnet#246

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

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 the Agent365 hosting telemetry extraction logic so user.id baggage is resolved across more channel types (non-Teams and A2A), and adds unit tests to validate the intended precedence/fallback behavior.

Changes:

  • Updated TurnContextExtensions.GetCallerBaggagePairs() to fall back from AadObjectIdAgenticUserIdFrom.Id for user.id.
  • Added new MSTest coverage for the user.id precedence and fallback scenarios.

Reviewed changes

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

File Description
src/Microsoft.OpenTelemetry/Agent365/Hosting/Extensions/TurnContextExtensions.cs Adds the fallback chain for caller user.id baggage extraction.
test/Microsoft.OpenTelemetry.Agent365.Tests/Hosting/Extensions/TurnContextExtensionsTests.cs Introduces tests validating user.id precedence and fallback behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Microsoft.OpenTelemetry/Agent365/Hosting/Extensions/TurnContextExtensions.cs Outdated
jsl517 and others added 2 commits May 4, 2026 18:32
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… #246

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@fpfp100
fpfp100 merged commit 30b6658 into main May 5, 2026
10 checks passed
@fpfp100
fpfp100 deleted the fix/userid-fallback-chain branch May 5, 2026 19:26
fpfp100 added a commit that referenced this pull request May 13, 2026
…#86)" (#96)

This reverts commit 30b6658.

Co-authored-by: Peng Fan <pefan@microsoft.com>
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