diff --git a/libraries/botbuilder-ai/botbuilder/ai/qna/models/query_result.py b/libraries/botbuilder-ai/botbuilder/ai/qna/models/query_result.py index 321ea64cf..0e4c7a31f 100644 --- a/libraries/botbuilder-ai/botbuilder/ai/qna/models/query_result.py +++ b/libraries/botbuilder-ai/botbuilder/ai/qna/models/query_result.py @@ -56,5 +56,7 @@ def __init__( self.score = score self.metadata = list(map(lambda meta: Metadata(**meta), metadata)) self.source = source - self.context = QnAResponseContext(**context) if context is not None else None + self.context = ( + QnAResponseContext().from_dict(context) if context is not None else None + ) self.id = id # pylint: disable=invalid-name diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_extensions.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_extensions.py index a6682dd13..808bf2b1a 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_extensions.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_extensions.py @@ -30,7 +30,13 @@ async def run_dialog( if ( turn_context.activity.type == ActivityTypes.end_of_conversation and dialog_context.stack + and DialogExtensions.__is_eoc_coming_from_parent(turn_context) ): + remote_cancel_text = "Skill was canceled through an EndOfConversation activity from the parent." + await turn_context.send_trace_activity( + f"Extension {Dialog.__name__}.run_dialog", label=remote_cancel_text, + ) + await dialog_context.cancel_all_dialogs() else: # Process a reprompt event sent from the parent. @@ -75,3 +81,9 @@ async def run_dialog( results = await dialog_context.continue_dialog() if results.status == DialogTurnStatus.Empty: await dialog_context.begin_dialog(dialog.id) + + @staticmethod + def __is_eoc_coming_from_parent(turn_context: TurnContext) -> bool: + # To determine the direction we check callerId property which is set to the parent bot + # by the BotFrameworkHttpClient on outgoing requests. + return bool(turn_context.activity.caller_id) diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/oauth_prompt.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/oauth_prompt.py index f04799c9d..b18d76497 100644 --- a/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/oauth_prompt.py +++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/oauth_prompt.py @@ -311,9 +311,18 @@ async def _send_oauth_card( link = sign_in_resource.sign_in_link bot_identity: ClaimsIdentity = context.turn_state.get("BotIdentity") + # use the SignInLink when + # in speech channel or + # bot is a skill or + # an extra OAuthAppCredentials is being passed in if ( - bot_identity and SkillValidation.is_skill_claim(bot_identity.claims) - ) or not context.activity.service_url.startswith("http"): + ( + bot_identity + and SkillValidation.is_skill_claim(bot_identity.claims) + ) + or not context.activity.service_url.startswith("http") + or self._settings.oath_app_credentials + ): if context.activity.channel_id == Channels.emulator: card_action_type = ActionTypes.open_url else: diff --git a/libraries/botbuilder-integration-aiohttp/botbuilder/integration/aiohttp/bot_framework_http_client.py b/libraries/botbuilder-integration-aiohttp/botbuilder/integration/aiohttp/bot_framework_http_client.py index 9af19718b..3fa2f448d 100644 --- a/libraries/botbuilder-integration-aiohttp/botbuilder/integration/aiohttp/bot_framework_http_client.py +++ b/libraries/botbuilder-integration-aiohttp/botbuilder/integration/aiohttp/bot_framework_http_client.py @@ -97,7 +97,7 @@ async def post_activity( ) activity.conversation.id = conversation_id activity.service_url = service_url - activity.caller_id = from_bot_id + activity.caller_id = f"urn:botframework:aadappid:{from_bot_id}" headers_dict = { "Content-type": "application/json; charset=utf-8", diff --git a/ci-pr-pipeline.yml b/pipelines/botbuilder-python-ci.yml similarity index 97% rename from ci-pr-pipeline.yml rename to pipelines/botbuilder-python-ci.yml index 9554439ba..22f4edbb8 100644 --- a/ci-pr-pipeline.yml +++ b/pipelines/botbuilder-python-ci.yml @@ -9,7 +9,7 @@ variables: python.36: 3.6.10 python.37: 3.7.6 python.38: 3.8.2 - + # PythonCoverallsToken: get this from Azure jobs: # Build and publish container @@ -80,7 +80,7 @@ jobs: - script: 'pylint --rcfile=.pylintrc libraries' displayName: Pylint - - script: 'COVERALLS_REPO_TOKEN=$(COVERALLS_TOKEN) coveralls' + - script: 'COVERALLS_REPO_TOKEN=$(PythonCoverallsToken) coveralls' displayName: 'Push test results to coveralls https://coveralls.io/github/microsoft/botbuilder-python' continueOnError: true diff --git a/azure-pipelines.yml b/pipelines/botbuilder-python-functional-test-linux.yml similarity index 75% rename from azure-pipelines.yml rename to pipelines/botbuilder-python-functional-test-linux.yml index c424c7f01..e9b13f27a 100644 --- a/azure-pipelines.yml +++ b/pipelines/botbuilder-python-functional-test-linux.yml @@ -1,9 +1,15 @@ -trigger: +# +# Run functional test on bot deployed to a Docker Linux environment in Azure. +# +pool: + vmImage: 'Ubuntu-16.04' + +trigger: # ci trigger branches: include: - - daveta-python-functional - exclude: - - master + - master + +pr: none # no pr trigger variables: # Container registry service connection established during pipeline creation @@ -14,15 +20,11 @@ variables: webAppName: 'e2epython' containerRegistry: 'nightlye2etest.azurecr.io' imageRepository: 'functionaltestpy' - - - + # LinuxTestBotAppId: get this from azure + # LinuxTestBotAppSecret: get this from Azure jobs: -# Build and publish container - job: Build - pool: - vmImage: 'Ubuntu-16.04' displayName: Build and push bot image continueOnError: false steps: @@ -35,12 +37,8 @@ jobs: containerRegistry: $(dockerRegistryServiceConnection) tags: $(buildIdTag) - - - job: Deploy displayName: Provision bot container - pool: - vmImage: 'Ubuntu-16.04' dependsOn: - Build steps: @@ -54,8 +52,6 @@ jobs: DockerNamespace: $(containerRegistry) DockerRepository: $(imageRepository) DockerImageTag: $(buildIdTag) - AppSettings: '-MicrosoftAppId $(botAppId) -MicrosoftAppPassword $(botAppPassword) -FLASK_APP /functionaltestbot/app.py -FLASK_DEBUG 1' + AppSettings: '-MicrosoftAppId $(LinuxTestBotAppId) -MicrosoftAppPassword $(LinuxTestBotAppSecret) -FLASK_APP /functionaltestbot/app.py -FLASK_DEBUG 1' #StartupCommand: 'flask run --host=0.0.0.0 --port=3978' - -