Repository: microsoft/botbuilder-python

Issue:
[PORT] Add EndOfConversationCodes to EndOfConversation activity from Skill
> Port this change from botbuilder-dotnet/master branch:
https://github.com/microsoft/botbuilder-dotnet/pull/4235

Fixes https://github.com/microsoft/botframework-sdk/issues/5852


# Changed projects
* Microsoft.Bot.Builder.Dialogs
* Microsoft.Bot.Builder.Dialogs.Tests






Discussion:

Resolving patch:
diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_extensions.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_extensions.py
--- a/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_extensions.py
+++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_extensions.py
@@ -1,22 +1,21 @@
 # Copyright (c) Microsoft Corporation. All rights reserved.
 # Licensed under the MIT License.
 
+from botframework.connector.auth import (
+    ClaimsIdentity,
+    SkillValidation,
+    AuthenticationConstants,
+    GovernmentConstants,
+)
 from botbuilder.core import BotAdapter, StatePropertyAccessor, TurnContext
 from botbuilder.core.skills import SkillHandler, SkillConversationReference
-
 from botbuilder.dialogs import (
     Dialog,
     DialogEvents,
     DialogSet,
     DialogTurnStatus,
 )
-from botbuilder.schema import Activity, ActivityTypes
-from botframework.connector.auth import (
-    ClaimsIdentity,
-    SkillValidation,
-    AuthenticationConstants,
-    GovernmentConstants,
-)
+from botbuilder.schema import Activity, ActivityTypes, EndOfConversationCodes
 
 
 class DialogExtensions:
@@ -87,6 +86,9 @@ async def run_dialog(
                     type=ActivityTypes.end_of_conversation,
                     value=result.result,
                     locale=turn_context.activity.locale,
+                    code=EndOfConversationCodes.completed_successfully
+                    if result.status == DialogTurnStatus.Complete
+                    else EndOfConversationCodes.user_cancelled,
                 )
                 await turn_context.send_activity(activity)
 


Test patch:
diff --git a/libraries/botbuilder-dialogs/tests/test_dialogextensions.py b/libraries/botbuilder-dialogs/tests/test_dialogextensions.py
--- a/libraries/botbuilder-dialogs/tests/test_dialogextensions.py
+++ b/libraries/botbuilder-dialogs/tests/test_dialogextensions.py
@@ -7,6 +7,7 @@
 
 import aiounittest
 
+from botframework.connector.auth import ClaimsIdentity, AuthenticationConstants
 from botbuilder.core import (
     TurnContext,
     MessageFactory,
@@ -28,8 +29,7 @@
     TranscriptLoggerMiddleware,
     ConsoleTranscriptLogger,
 )
-from botbuilder.schema import ActivityTypes, Activity
-from botframework.connector.auth import ClaimsIdentity, AuthenticationConstants
+from botbuilder.schema import ActivityTypes, Activity, EndOfConversationCodes
 from botbuilder.dialogs import (
     ComponentDialog,
     TextPrompt,
@@ -111,6 +111,7 @@ async def handles_bot_and_skills_test_cases(
                 self.eoc_sent, "Skills should send EndConversation to channel"
             )
             assert ActivityTypes.end_of_conversation == self.eoc_sent.type
+            assert EndOfConversationCodes.completed_successfully == self.eoc_sent.code
             assert self.eoc_sent.value == "SomeName"
         else:
             self.assertIsNone(