From 16222be00364405d34042f51905233415b3c8d35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Brand=C3=A3o?= Date: Mon, 8 Sep 2025 09:44:53 -0700 Subject: [PATCH 1/2] Fixed reference to Activity.add_ai_metadata --- .../hosting/aiohttp/app/streaming/streaming_response.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libraries/microsoft-agents-hosting-aiohttp/microsoft_agents/hosting/aiohttp/app/streaming/streaming_response.py b/libraries/microsoft-agents-hosting-aiohttp/microsoft_agents/hosting/aiohttp/app/streaming/streaming_response.py index 1d155672..4c1cff5b 100644 --- a/libraries/microsoft-agents-hosting-aiohttp/microsoft_agents/hosting/aiohttp/app/streaming/streaming_response.py +++ b/libraries/microsoft-agents-hosting-aiohttp/microsoft_agents/hosting/aiohttp/app/streaming/streaming_response.py @@ -14,7 +14,6 @@ ClientCitation, DeliveryModes, SensitivityUsageInfo, - add_ai_metadata, ) if TYPE_CHECKING: @@ -401,7 +400,7 @@ async def _send_activity(self, activity: Activity) -> None: streaminfo_entity.feedback_loop_enabled = self._enable_feedback_loop # Add in Generated by AI if self._enable_generated_by_ai_label: - add_ai_metadata(activity, self._citations, self._sensitivity_label) + activity.add_ai_metadata(self._citations, self._sensitivity_label) # Send activity response = await self._context.send_activity(activity) From 490cfff700a958f13964cc58a1bfc19ea71bcd05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Brand=C3=A3o?= Date: Tue, 9 Sep 2025 11:13:07 -0700 Subject: [PATCH 2/2] Setting flow state to complete on get_token --- .../microsoft_agents/hosting/core/oauth/oauth_flow.py | 1 + .../microsoft-agents-hosting-core/tests/test_oauth_flow.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/oauth/oauth_flow.py b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/oauth/oauth_flow.py index bab9d143..3a12b890 100644 --- a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/oauth/oauth_flow.py +++ b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/oauth/oauth_flow.py @@ -140,6 +140,7 @@ async def get_user_token(self, magic_code: str = None) -> TokenResponse: self._flow_state.expiration = ( datetime.now().timestamp() + self._default_flow_duration ) + self._flow_state.tag = FlowStateTag.COMPLETE return token_response diff --git a/libraries/microsoft-agents-hosting-core/tests/test_oauth_flow.py b/libraries/microsoft-agents-hosting-core/tests/test_oauth_flow.py index 9a358b00..9a3b3dd1 100644 --- a/libraries/microsoft-agents-hosting-core/tests/test_oauth_flow.py +++ b/libraries/microsoft-agents-hosting-core/tests/test_oauth_flow.py @@ -137,6 +137,7 @@ async def test_get_user_token_success(self, sample_flow_state, user_token_client flow = OAuthFlow(sample_flow_state, user_token_client) expected_final_flow_state = sample_flow_state expected_final_flow_state.user_token = RES_TOKEN + expected_final_flow_state.tag = FlowStateTag.COMPLETE # test token_response = await flow.get_user_token() @@ -201,6 +202,7 @@ async def test_begin_flow_easy_case( activity = mocker.Mock(spec=Activity) expected_flow_state = sample_flow_state expected_flow_state.user_token = RES_TOKEN + expected_flow_state.tag = FlowStateTag.COMPLETE # test response = await flow.begin_flow(activity)