-
Notifications
You must be signed in to change notification settings - Fork 56
Add Support for CopilotStudio Agent-to-Agent Connector for AgentsSDK to populate UserAuthorization #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Support for CopilotStudio Agent-to-Agent Connector for AgentsSDK to populate UserAuthorization #232
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,72 @@ | ||||||||||||||||
| """ | ||||||||||||||||
| Copyright (c) Microsoft Corporation. All rights reserved. | ||||||||||||||||
| Licensed under the MIT License. | ||||||||||||||||
| """ | ||||||||||||||||
|
|
||||||||||||||||
| from abc import ABC | ||||||||||||||||
| from typing import Optional | ||||||||||||||||
| import logging | ||||||||||||||||
|
||||||||||||||||
| import logging |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing imports: ClaimsIdentity is referenced on line 71 but not imported. The file imports ABC but it's not used since _AuthorizationHandler is already an ABC.
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment appears to contain commented-out code.
| # def get_obo_settings(self) -> dict: | |
| # """Get On-Behalf-Of settings for the auth handler. | |
| # :return: The OBO settings dictionary. | |
| # :rtype: dict | |
| # """ | |
| # return self._ |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incomplete implementation: The get_refreshed_token method is missing a return statement. It should return the token_response created on line 55.
| return token_response |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Undefined variable: identity is used on line 65 but is not defined in the scope of the create_token_response method.
| if _ConnectorUserAuthorizationHandler._is_case_sensitive_claims_identity( | |
| context.turn_state.get("claims_identity") | |
| identity = context.turn_state.get("claims_identity") | |
| if _ConnectorUserAuthorizationHandler._is_case_sensitive_claims_identity( | |
| identity |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incomplete implementation: The create_token_response method is incomplete. Lines 67-68 appear to be unfinished code with an incomplete variable assignment (jwt_token = ). This code will not compile.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| from .connector_client import ConnectorClient | ||
| from .mcs_connector_client import MCSConnectorClient | ||
| from .user_token_client import UserTokenClient | ||
|
|
||
| __all__ = ["ConnectorClient", "UserTokenClient"] | ||
| __all__ = ["ConnectorClient", "MCSConnectorClient", "UserTokenClient"] |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,131 @@ | ||||||||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||||||||
| # Licensed under the MIT License. | ||||||||
|
|
||||||||
| """Connector Client for Microsoft Agents.""" | ||||||||
|
|
||||||||
| import logging | ||||||||
| from typing import Any, Optional | ||||||||
|
||||||||
| from typing import Any, Optional | |
| from typing import Optional |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused import: BytesIO is imported on line 9 but never used in the code.
| from io import BytesIO |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import of 'AttachmentsBase' is not used.
| from ..attachments_base import AttachmentsBase |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import of 'AttachmentsOperations' is not used.
| from .connector_client import AttachmentsOperations |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing imports: Transcript and AttachmentData are used in method signatures (lines 56 and 62) but are not imported.
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method requires 3 positional arguments, whereas overridden ConversationsBase.reply_to_activity requires 4.
| async def reply_to_activity(self, conversation_id: str, body: Activity) -> ResourceResponse: | |
| async def reply_to_activity(self, conversation_id: str, activity_id: str, body: Activity) -> ResourceResponse: | |
| # The activity_id argument is accepted for signature compatibility, but not used in this implementation. |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 126 references AttachmentOperations but the import on line 23 is AttachmentsOperations (plural). This will cause a NameError at runtime.
| self._attachments = AttachmentOperations( | |
| self._attachments = AttachmentsOperations( |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing required properties: The MCSConnectorClient class inherits from ConnectorClientBase which requires implementing base_uri, attachments, and conversations as properties. These should be exposed as @property methods instead of just instance variables.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -101,6 +101,8 @@ async def create_connector_client( | |||||
| "RestChannelServiceClientFactory.create_connector_client: audience can't be None or Empty" | ||||||
| ) | ||||||
|
|
||||||
| if context.activity.recipient and context.activity.recipient.role == RoleTypes.connector_user: | ||||||
| return MCSConnectorClient(turn_context.activity.service_url) | ||||||
|
||||||
| return MCSConnectorClient(turn_context.activity.service_url) | |
| return MCSConnectorClient(context.activity.service_url) |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing import: MCSConnectorClient is used on line 105 but is not imported. The import statement needs to be updated to include MCSConnectorClient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused import:
ABCis imported on line 6 but never used, since_AuthorizationHandleris already an abstract base class.