Detach SSO token exchange invoke activity from the route handler - #469
Merged
Rodrigo Brandão (rodrigobr-msft) merged 16 commits intoJul 16, 2026
Merged
Conversation
…into users/robrandao/oauth-continuation
Copilot started reviewing on behalf of
Rodrigo Brandão (rodrigobr-msft)
July 15, 2026 18:42
View session
Rodrigo Brandão (rodrigobr-msft)
marked this pull request as ready for review
July 15, 2026 18:42
Copilot started reviewing on behalf of
Rodrigo Brandão (rodrigobr-msft)
July 15, 2026 18:43
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the OAuth “turn intercept” flow to return a structured result (skip/replay/continuation activity) and moves Teams SSO token-exchange invoke-response handling out of the route handler path, aligning with the referenced Agents-for-js change.
Changes:
- Replace
_on_turn_auth_intercepttuple return with an_AuthInterceptResultdataclass (skip/replay/continuation). - Add an explicit
invoke_response(200) send for completed invoke-based auth flows in the user authorization handler. - Update
AgentApplicationto route intercepted turns through a new_handle_turn_skipreplay mechanism and update tests accordingly.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/hosting_dialogs/test_dialog_manager.py | Formatting change to skill identity claim assignments in test setup. |
| tests/hosting_core/app/_oauth/test_authorization.py | Update tests to assert against _AuthInterceptResult fields instead of tuple values. |
| libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/oauth/authorization.py | Introduce _AuthInterceptResult and update _on_turn_auth_intercept to return structured intercept outcomes. |
| libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/oauth/_handlers/_user_authorization.py | Send invoke_response 200 when an invoke-based auth flow completes. |
| libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/agent_application.py | Consume _AuthInterceptResult, add _handle_turn_skip, and replay continuation via adapter APIs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Copilot started reviewing on behalf of
Rodrigo Brandão (rodrigobr-msft)
July 15, 2026 18:51
View session
Axel Suárez (axelsrz)
approved these changes
Jul 16, 2026
Rodrigo Brandão (rodrigobr-msft)
enabled auto-merge (squash)
July 16, 2026 20:17
Copilot started reviewing on behalf of
Rodrigo Brandão (rodrigobr-msft)
July 16, 2026 20:18
View session
Rodrigo Brandão (rodrigobr-msft)
merged commit Jul 16, 2026
e5fd79c
into
main
10 of 11 checks passed
Rodrigo Brandão (rodrigobr-msft)
deleted the
users/robrandao/oauth-continuation
branch
July 16, 2026 20:20
Comment on lines
+1043
to
+1050
| def __log_task_result(task: asyncio.Task): | ||
| try: | ||
| task.result() | ||
| except Exception as e: | ||
| logger.error( | ||
| f"Error occurred while replaying the turn.", | ||
| exc_info=True, | ||
| ) |
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.
Similar to: microsoft/Agents-for-js#1013