Skip to content

Detach SSO token exchange invoke activity from the route handler - #469

Merged
Rodrigo Brandão (rodrigobr-msft) merged 16 commits into
mainfrom
users/robrandao/oauth-continuation
Jul 16, 2026
Merged

Detach SSO token exchange invoke activity from the route handler#469
Rodrigo Brandão (rodrigobr-msft) merged 16 commits into
mainfrom
users/robrandao/oauth-continuation

Conversation

@rodrigobr-msft

Copy link
Copy Markdown
Contributor

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 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_intercept tuple return with an _AuthInterceptResult dataclass (skip/replay/continuation).
  • Add an explicit invoke_response (200) send for completed invoke-based auth flows in the user authorization handler.
  • Update AgentApplication to route intercepted turns through a new _handle_turn_skip replay 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 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

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

Comment thread tests/hosting_core/app/_oauth/test_authorization.py
Comment thread tests/hosting_core/app/_oauth/test_authorization.py
Comment thread tests/hosting_core/app/_oauth/test_authorization.py
Copilot AI review requested due to automatic review settings July 16, 2026 20:17
@rodrigobr-msft
Rodrigo Brandão (rodrigobr-msft) merged commit e5fd79c into main Jul 16, 2026
10 of 11 checks passed
@rodrigobr-msft
Rodrigo Brandão (rodrigobr-msft) deleted the users/robrandao/oauth-continuation branch July 16, 2026 20:20

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

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

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,
)
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.

[BUG] OAuth continuation replay keeps signin/tokenExchange invoke open

3 participants