Add force_base_channel support to conversation references for Copilot Web OAuth flows#392
Open
Copilot wants to merge 6 commits into
Open
Add force_base_channel support to conversation references for Copilot Web OAuth flows#392Copilot wants to merge 6 commits into
force_base_channel support to conversation references for Copilot Web OAuth flows#392Copilot wants to merge 6 commits into
Conversation
Agent-Logs-Url: https://github.com/microsoft/Agents-for-python/sessions/533beebe-4148-4f5a-bf80-93305e50a881 Co-authored-by: MattB-msft <10568244+MattB-msft@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/Agents-for-python/sessions/533beebe-4148-4f5a-bf80-93305e50a881 Co-authored-by: MattB-msft <10568244+MattB-msft@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/Agents-for-python/sessions/533beebe-4148-4f5a-bf80-93305e50a881 Co-authored-by: MattB-msft <10568244+MattB-msft@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/Agents-for-python/sessions/533beebe-4148-4f5a-bf80-93305e50a881 Co-authored-by: MattB-msft <10568244+MattB-msft@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/Agents-for-python/sessions/533beebe-4148-4f5a-bf80-93305e50a881 Co-authored-by: MattB-msft <10568244+MattB-msft@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add force_base_channel option to get_conversation_reference
Add May 13, 2026
force_base_channel support to conversation references for Copilot Web OAuth flows
axelsrz
previously approved these changes
May 14, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds opt-in base-channel conversation references so OAuth state can handle composite Copilot Web channel IDs.
Changes:
- Added
force_base_channeltoActivity.get_conversation_reference(). - Updated OAuth flow state construction to request a base-channel conversation reference.
- Added focused tests for base-channel extraction and OAuth usage.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
libraries/microsoft-agents-activity/microsoft_agents/activity/activity.py |
Adds base-channel extraction support to conversation references. |
libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/_oauth/_oauth_flow.py |
Uses the new option when building OAuth token exchange state. |
tests/activity/test_activity.py |
Adds tests for forced and non-forced channel reference behavior. |
tests/hosting_core/_oauth/test_oauth_flow.py |
Updates OAuth test setup and verifies the forced-base call is made. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
axelsrz
previously approved these changes
May 14, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
tests/hosting_core/_oauth/test_oauth_flow.py:250
TokenExchangeStatedoes not expose a top-levelchannel_id; the channel lives under itsconversationfield. These assertions will raiseAttributeErrorwhen the spy captures the state instance instead of validating the encoded state's conversation channel.
encoded_state_instance = get_encoded_state_spy.call_args.args[0]
assert encoded_state_instance.channel_id == base_channel_id
assert encoded_state_instance.channel_id != composite_channel_id
| token_exchange_state = TokenExchangeState( | ||
| connection_name=self._abs_oauth_connection_name, | ||
| conversation=activity.get_conversation_reference(), | ||
| conversation=activity.get_conversation_reference(force_base_channel=True), |
bbac31c to
9f7cd18
Compare
axelsrz
approved these changes
May 14, 2026
MattB-msft
approved these changes
May 14, 2026
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.
M365 Copilot Web can send composite
channelIdvalues (for example,msteams:copilot-web), but OAuth token exchange must use the base channel. This change ports the .NET behavior by adding an opt-in base-channel mode and wiring OAuth flow state construction to use it.Activity conversation reference API
Activity.get_conversation_reference()with optionalforce_base_channel: bool | None = None.:(preserving existing behavior when unset/false).OAuth flow token-exchange path
_OAuthFlow.begin_flow()to buildTokenExchangeState.conversationwith:activity.get_conversation_reference(force_base_channel=True)Focused coverage for new behavior
force_base_channel=True