Fix getCallerBaggagePairs: resolve userId across all channels - #250
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes caller userId OpenTelemetry baggage population in the observability hosting utilities so that user.id is resolved consistently when aadObjectId is missing (e.g., non-Teams channels and A2A scenarios). It aligns the Node implementation with the referenced .NET behavior and adds test coverage for the new precedence rules.
Changes:
- Update
getCallerBaggagePairsto resolveuserIdviaaadObjectId → agenticUserId → from.id. - Add/adjust unit tests to cover non-Teams fallback, A2A fallback, and precedence when all fields are present.
- Add Jest module mapping for
@microsoft/agents-a365-observability-hostingto ensure tests resolve local source.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/observability/extension/hosting/TurnContextUtils.test.ts | Adds coverage for new userId fallback/precedence behavior in caller baggage extraction. |
| tests/observability/extension/hosting/BaggageBuilderUtils.test.ts | Updates expectation to reflect new caller userId baggage population via fallback chain. |
| tests/jest.config.cjs | Adds moduleNameMapper entry so tests can import @microsoft/agents-a365-observability-hosting from workspace source. |
| packages/agents-a365-observability-hosting/src/utils/TurnContextUtils.ts | Implements userId fallback chain when building caller baggage pairs. |
userId was only set from aadObjectId, which is undefined 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>
PengF (fpfp100)
force-pushed
the
fix/userid-fallback-chain
branch
from
May 5, 2026 01:51
feb3b9f to
71ff10d
Compare
Julio Carlos Menendez (juliomenendez)
approved these changes
May 5, 2026
Jianbiao Lu (alexlu4250)
approved these changes
May 5, 2026
Jianbiao Lu (alexlu4250)
approved these changes
May 5, 2026
2 tasks
PengF (fpfp100)
added a commit
that referenced
this pull request
May 14, 2026
* Revert "Fix getCallerBaggagePairs: resolve userId across all channels (#250)" This reverts commit 1711b65. * fix: remove trailing whitespace in TurnContextUtils Agent-Logs-Url: https://github.com/microsoft/Agent365-nodejs/sessions/6d50d8d4-7449-4f9d-9fb0-5a42e75c19af Co-authored-by: fpfp100 <126631706+fpfp100@users.noreply.github.com> --------- Co-authored-by: Peng Fan <pefan@microsoft.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
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
aadObjectId, which isundefinedon non-Teams channels and A2A callsaadObjectId → agenticUserId → from.idChannel behavior after fix
Test plan
🤖 Generated with Claude Code