Skip to content

Fix getCallerBaggagePairs: resolve userId across all channels#116

Merged
hectorhdzg merged 3 commits into
mainfrom
fix/userid-fallback-chain
May 6, 2026
Merged

Fix getCallerBaggagePairs: resolve userId across all channels#116
hectorhdzg 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 (19/19)
  • 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 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>
Copilot AI review requested due to automatic review settings May 5, 2026 00:54

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 A365 hosting baggage extraction so user.id can be resolved across non-Teams channels and agent-to-agent (A2A) calls by adding a fallback chain for caller identity, and adds unit tests to validate the new behavior.

Changes:

  • Update getCallerBaggagePairs() to resolve user.id via aadObjectId → agenticUserId → from.id.
  • Extend the minimal hosting ActivityLike.from type to include an optional id.
  • Add unit tests covering non-Teams fallback, A2A fallback, and precedence when multiple identifiers are present.

Reviewed changes

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

File Description
test/internal/unit/a365/hosting/turnContextUtils.test.ts Adds test coverage for new user.id fallback and precedence behavior.
src/a365/hosting/types.ts Extends ActivityLike.from with an optional id field for structural compatibility with non-Teams activities.
src/a365/hosting/turnContextUtils.ts Implements the userId fallback chain used to populate OpenTelemetry baggage.

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

Comment thread src/a365/hosting/turnContextUtils.ts Outdated
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@hectorhdzg

Copy link
Copy Markdown
Member

@fpfp100 can you fix format/lint issues? we should be able to merge after that

@hectorhdzg
hectorhdzg merged commit d0409a3 into main May 6, 2026
4 of 5 checks passed
hectorhdzg pushed a commit that referenced this pull request May 13, 2026
* Revert "Fix getCallerBaggagePairs: resolve userId across all channels (#116)"

This reverts commit d0409a3.

* Remove unintended .claude/settings.local.json

---------

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.

6 participants