Conversation
Add .NET solution for extensible bot activity schemas with modern serialization, extension data, and reply support. Includes CI workflow, semantic versioning, and comprehensive unit tests for schema evolution and custom fields.
Added a permissions section to the Core-CI workflow, granting read access to repository contents and write access to pull-requests. This explicitly defines the workflow's required permissions.
This pull request introduces several new sample bots and supporting infrastructure to the `core` directory, demonstrating different usage scenarios for the Microsoft.Bot.Core SDK. It also adds compatibility support for legacy Bot Framework bots, improves development environment configuration, and updates documentation and gitignore settings. **New sample bots and scenarios:** - Added three new sample projects: - [`CompatBot`](diffhunk://#diff-22411d9bef78e3d139f1e4b1a4d5e047bb26428a97bf59df7f5b983e584babd8R1-R13): Demonstrates running a legacy Bot Framework bot using the new compatibility layer, including `EchoBot` implementation and required configuration files. [[1]](diffhunk://#diff-22411d9bef78e3d139f1e4b1a4d5e047bb26428a97bf59df7f5b983e584babd8R1-R13) [[2]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aR1-R35) [[3]](diffhunk://#diff-62be1f70aaabb519334fe39cd50c0e25a98717ebb9fab85b688832917c9c75bbR1-R29) [[4]](diffhunk://#diff-834a6cbae004839d32944b2f2a3cf8edc3a32f558597d464401178fa95781edcR1-R9) - [`CoreBot`](diffhunk://#diff-1087baf076a83b00d0c97ef01c02174668cb26c9fad5d2c33284e0889150ed65R1-R13): Shows a simple bot using the new SDK, with configuration and logging settings. [[1]](diffhunk://#diff-1087baf076a83b00d0c97ef01c02174668cb26c9fad5d2c33284e0889150ed65R1-R13) [[2]](diffhunk://#diff-b94b53965e9052345453f2ab6bec21420a36c4b67c9a6c568b9c80edcd0882d1R1-R22) [[3]](diffhunk://#diff-84b21a8c78e12fee4df3b2d67483407632a1fe5d25691ed7cfefde85adc92a25R1-R11) - [`Proactive`](diffhunk://#diff-ffe34fac742569e7a6cfb5589871a8b9571c7692f6af33e167f39cc2b8be3ed3R1-R17): Demonstrates sending proactive messages using a background worker. [[1]](diffhunk://#diff-ffe34fac742569e7a6cfb5589871a8b9571c7692f6af33e167f39cc2b8be3ed3R1-R17) [[2]](diffhunk://#diff-f32e1fd30a40c5aa42855895485dbb9c8b79d4029cd3db1a1446f48846f8604dR1-R10) [[3]](diffhunk://#diff-61d7e83f772e536a1729f5c12b1b028a2a396a28e2175541489e85d89d2758ecR1-R31) [[4]](diffhunk://#diff-1342c159b3ce809afd5880d58bd2f17e3eeade347f10d5b8d6d550cb3a0ab8f9R1-R8) - Added scenario scripts for middleware and proactive messaging, runnable via dotnet script. [[1]](diffhunk://#diff-aee4a2e56fbce4adfe46afec84a447a9aab7752f7c24982b51b8475af942124fR1-R34) [[2]](diffhunk://#diff-8287e53b5a4e259703b929262b11fdb5f783564de364cc184d27a5b7486de729R1-R43) - Provided an example `launchSettings.json` for local development of scenarios. **Compatibility support:** - Introduced `CompatAdapter` and related classes to bridge new bot application models with legacy Bot Framework interfaces, enabling easier migration and integration of existing bots. [[1]](diffhunk://#diff-ee802b583e856949e14f231284969979f8827efaa484f0b431badb7936809855R1-R116) [[2]](diffhunk://#diff-e70e201729b0f386ddb70a5d3f83751f2bd0a08e527b0a5265fbb8094a9abe19R1-R27) **Development environment and documentation improvements:** - Updated `.devcontainer/devcontainer.json` to add Docker-in-Docker, .NET 10, and ensure latest feature versions for improved local development experience. - Added a `README.md` with instructions for testing and running scenarios. - Added common development files to `.gitignore` and included it in the solution. [[1]](diffhunk://#diff-af85f59c6492668dca14d5f06b54cc2c3173708c83073e1d947b4c007dc851d6R1-R2) [[2]](diffhunk://#diff-19ad97af5c1b7109a9c62f830310091f393489def210b9ec1ffce152b8bf958cR4-R12) **Solution structure updates:** - Updated `core.slnx` to include new sample projects and `.gitignore` as solution items. --- **New sample bots and scenarios:** - Added `CompatBot`, `CoreBot`, and `Proactive` sample projects with implementations and configuration files to demonstrate different SDK usage scenarios. [[1]](diffhunk://#diff-22411d9bef78e3d139f1e4b1a4d5e047bb26428a97bf59df7f5b983e584babd8R1-R13) [[2]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aR1-R35) [[3]](diffhunk://#diff-62be1f70aaabb519334fe39cd50c0e25a98717ebb9fab85b688832917c9c75bbR1-R29) [[4]](diffhunk://#diff-834a6cbae004839d32944b2f2a3cf8edc3a32f558597d464401178fa95781edcR1-R9) [[5]](diffhunk://#diff-1087baf076a83b00d0c97ef01c02174668cb26c9fad5d2c33284e0889150ed65R1-R13) [[6]](diffhunk://#diff-b94b53965e9052345453f2ab6bec21420a36c4b67c9a6c568b9c80edcd0882d1R1-R22) [[7]](diffhunk://#diff-84b21a8c78e12fee4df3b2d67483407632a1fe5d25691ed7cfefde85adc92a25R1-R11) [[8]](diffhunk://#diff-ffe34fac742569e7a6cfb5589871a8b9571c7692f6af33e167f39cc2b8be3ed3R1-R17) [[9]](diffhunk://#diff-f32e1fd30a40c5aa42855895485dbb9c8b79d4029cd3db1a1446f48846f8604dR1-R10) [[10]](diffhunk://#diff-61d7e83f772e536a1729f5c12b1b028a2a396a28e2175541489e85d89d2758ecR1-R31) [[11]](diffhunk://#diff-1342c159b3ce809afd5880d58bd2f17e3eeade347f10d5b8d6d550cb3a0ab8f9R1-R8) - Added scenario scripts for middleware and proactive messaging, plus an example launch settings file for local testing. [[1]](diffhunk://#diff-aee4a2e56fbce4adfe46afec84a447a9aab7752f7c24982b51b8475af942124fR1-R34) [[2]](diffhunk://#diff-8287e53b5a4e259703b929262b11fdb5f783564de364cc184d27a5b7486de729R1-R43) [[3]](diffhunk://#diff-19cd1809f42bd0d871748a1e3bf7c705961f9abd0a4da67acc547f42c1ebfcd6R1-R20) **Compatibility support:** - Introduced `CompatAdapter` and `CompatActivity` to support running legacy Bot Framework bots with the new SDK. [[1]](diffhunk://#diff-ee802b583e856949e14f231284969979f8827efaa484f0b431badb7936809855R1-R116) [[2]](diffhunk://#diff-e70e201729b0f386ddb70a5d3f83751f2bd0a08e527b0a5265fbb8094a9abe19R1-R27) **Development environment and documentation:** - Enhanced `.devcontainer` with Docker-in-Docker, .NET 10, and latest feature versions for improved local development. - Added a `README.md` with setup and testing instructions. - Updated `.gitignore` and included it in the solution for better source control hygiene. [[1]](diffhunk://#diff-af85f59c6492668dca14d5f06b54cc2c3173708c83073e1d947b4c007dc851d6R1-R2) [[2]](diffhunk://#diff-19ad97af5c1b7109a9c62f830310091f393489def210b9ec1ffce152b8bf958cR4-R12) **Solution structure:** - Updated `core.slnx` to include new projects and configuration files. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: rido-min <14916339+rido-min@users.noreply.github.com>
Updated Azure DevOps pipeline to trigger only on next/* branches and use ubuntu-22.04. Added cd-core.yaml to solution items in core.slnx. Removed null-forgiving operator from CoreActivity.cs return statement for safer null handling.
Added a UseDotNet@2 task to install .NET 8 SDK (8.0.x) before the .NET 10 SDK in the BuildTestPack job. This ensures both SDK versions are available for build and test processes.
Changed package icon to bot_icon.png in project properties. Added ItemGroup to explicitly include bot_icon.png and README.md at the root of the NuGet package during packing.
Added a new bot_icon.png file to the project, providing a graphical asset that can be used as an icon or visual element within the application.
Changed the pipeline condition so that NuGet packages are pushed only when building from the refs/heads/next/core branch, instead of the main branch. This restricts package publishing to the next/core branch.
Ignored launchSettings.json, appsettings.Development.json, and .runsettings to prevent tracking of local configuration and test settings files.
Introduce Microsoft.Bot.Core.Tests targeting .NET 10.0 with xUnit and code coverage. Add core-test.yaml workflow to run these tests with Azure AD credentials. Update solution file to include new test project and workflow. Implement ConversationClientTest for Teams activity scenarios. Update core-ci.yaml to run only unit tests.
Updated the build pipeline to run tests only for the Microsoft.Bot.Core.UnitTests project. Changed environment variable to "TEST_CONVERSATIONID" in ConversationClientTest.cs and corrected the hardcoded conversation ID format by removing the message ID suffix.
- Prefix echo replies with "Echo from BF Compat" - Change default log level to Warning; add Debug for Microsoft.Bot - Remove using statement for TurnContext in CompatAdapter - Expand exception handling to rethrow non-HttpOperationException - Add debug/info logging to BotApplication activity processing
Introduce .editorconfig for code style and nullable strictness. Update solution to include .editorconfig. Rename CoreActivity.CreateReplyActivity to CreateReplyMessageActivity and update all usages. Extend CoreActivityJsonContext for Int64/Double support. Apply minor formatting fixes and missing braces. Strengthen and update unit tests for new property types and method changes.
Replaced all var declarations with explicit types across the codebase, including tests, bot implementations, and entry points. This improves code clarity and type safety, making variable types more visible and aiding maintainability. No functional changes were made.
Added copyright and MIT license headers to all source and test files. Updated .editorconfig to enforce file header template for new files. Made minor code style improvements and access modifier updates. Ensured consistent attribution and licensing across the codebase.
EchoBot now informs users how to trigger a proactive message via a new `/api/notify/{conversationId}` endpoint. Added a GET endpoint to send proactive messages to a conversation by ID. Updated message handling to support CancellationToken and included necessary usings for proactive messaging support.
Integrate Azure Monitor Application Insights telemetry into both CompatBot and CoreBot using OpenTelemetry. Update appsettings.json to include a placeholder Application Insights connection string and adjust logging levels for better diagnostics. Refactor EchoBot to accept an ILogger and log version info; comment out some unused message handlers. Improve CoreBot reply robustness by safely extracting conversation type. Reformat project files for consistency and explicitly add Azure Monitor package. Update Proactive Worker to use constants for ServiceUrl and FromId. Refactor ConversationClient to use StringContent for activity payloads, ensuring correct JSON serialization and content type.
Removed unnecessary using directives from EchoBot.cs and ConversationClient.cs. Updated TryGetValue in Program.cs to use object? for better type safety and clarity.
Refactored pipeline triggers to use path filters for PRs, targeting only core/** changes. Removed obsolete trigger config and comments. Introduced PushToADOFeed variable to control NuGet push step, replacing branch-based condition.
This pull request introduces significant improvements to the authentication and configuration system for bot applications, focusing on simplifying and unifying the way MSAL (Microsoft Authentication Library) configuration is handled. It introduces a new configuration API, refactors service registration methods, and adds a new test project to validate these changes. Additionally, it updates code style and suppresses certain warnings for better developer experience. **Authentication & Configuration Refactoring:** * Refactored the authentication service registration by replacing `AddBotApplicationClients` with a new `AddConversationClient` method, which provides a more flexible and unified way to configure MSAL using different sources (config section, environment variables, or Bot Framework config). This includes new helper methods for configuring MSAL with secrets, managed identity, or config sections. (`core/src/Microsoft.Bot.Core/Hosting/AddBotApplicationExtensions.cs`, `core/src/Microsoft.Bot.Core/Hosting/BotAuthenticationHandler.cs`, `core/src/Microsoft.Bot.Core/Hosting/BotConfig.cs`) [[1]](diffhunk://#diff-728b405fea621393bf54709dd9edcf171d5c2a2113e8a3fbf4732f403ba4e235R63-R199) [[2]](diffhunk://#diff-728b405fea621393bf54709dd9edcf171d5c2a2113e8a3fbf4732f403ba4e235L45-R49) [[3]](diffhunk://#diff-728ccc3d98609bc95b459589eb6973c2d6fa67d456334edf7b2a9c3cc1bb52c1R1-R38) [[4]](diffhunk://#diff-3e082ff899db0608432b5278502dfa1b5765cf4cf34c5a7c63fdf507d1746e3aL52-R61) [[5]](diffhunk://#diff-3e082ff899db0608432b5278502dfa1b5765cf4cf34c5a7c63fdf507d1746e3aL110-R109) * Updated the sample project (`Proactive`) and the main extension method to use `AddConversationClient` instead of the old `AddBotApplicationClients`, ensuring all samples and new code use the unified registration approach. (`core/samples/Proactive/Program.cs`, `core/samples/CoreBot/CoreBot.csproj`) [[1]](diffhunk://#diff-f32e1fd30a40c5aa42855895485dbb9c8b79d4029cd3db1a1446f48846f8604dL9-R9) [[2]](diffhunk://#diff-1087baf076a83b00d0c97ef01c02174668cb26c9fad5d2c33284e0889150ed65R7) **Testing & Validation:** * Added a new test project `msal-config-api` with a sample program to validate the new MSAL configuration API and ensure that the new registration and authentication flow works as expected. (`core/test/msal-config-api/Program.cs`, `core/test/msal-config-api/msal-config-api.csproj`, `core/core.slnx`) [[1]](diffhunk://#diff-11109e323e3906c20862f811ae5cd1fed439a5993872152d08b0fc80ea7be8f1R1-R47) [[2]](diffhunk://#diff-8764e4985371ddc60cf5f1c97c350ee3440584be4013586deb0b21116898f2d3R1-R15) [[3]](diffhunk://#diff-19ad97af5c1b7109a9c62f830310091f393489def210b9ec1ffce152b8bf958cR18) **Developer Experience Improvements:** * Updated `.editorconfig` to suppress certain warnings (e.g., missing XML comments, logger performance) for both the main codebase and samples, making development smoother. (`core/.editorconfig`) [[1]](diffhunk://#diff-f8a1aa667bae260675fe0c49b3ad037b4ce945cbb1ad3fb36a57a608695c3f11R14-R15) [[2]](diffhunk://#diff-f8a1aa667bae260675fe0c49b3ad037b4ce945cbb1ad3fb36a57a608695c3f11R36-R38) **Other Minor Changes:** * Added a missing `using` directive and made minor code cleanup in hosting and authentication handler files. (`core/src/Microsoft.Bot.Core/Hosting/AddBotApplicationExtensions.cs`, `core/src/Microsoft.Bot.Core/Hosting/BotAuthenticationHandler.cs`) [[1]](diffhunk://#diff-728b405fea621393bf54709dd9edcf171d5c2a2113e8a3fbf4732f403ba4e235R4) [[2]](diffhunk://#diff-3e082ff899db0608432b5278502dfa1b5765cf4cf34c5a7c63fdf507d1746e3aL13) These changes collectively modernize and streamline bot authentication, making it more robust and easier to configure for different deployment scenarios.
- Use HTML line breaks in bot replies and proactive messages for better formatting. - Send proactive messages with MessageFactory.Text. - Extract AgenticIdentity per activity instead of storing on ConversationClient. - Register ConversationClient HttpClient with authentication handler. - Throw exception if no valid MSAL config is found. - Remove unused using directive in BotApplication.cs.
Documentation improvements: * For conversation update, event, meeting, and install/update handlers, all matching handlers are now invoked sequentially rather than only the first one. This is a breaking change and is documented in the XML comments for each registration method. Invoke handler registration restrictions: * Catch-all invoke handlers (registered via `InvokeExtensions.OnInvoke`) can no longer be combined with specific invoke handlers (such as adaptive card or file consent handlers). This restriction is now enforced and documented as a breaking change. General cleanup: * Removed outdated TODO comments and clarified remarks in the `Context.cs` file.
…ion client (#369) ### Compatibility layer improvements * Introduced `FromCompatChannelAccount` and `FromCompatConversationParameters` extension methods in `CompatActivity.cs` to convert Bot Framework objects to Teams Core schema, mapping relevant fields and properties. * Updated `CompatConversations.cs` to use the new `FromCompatConversationParameters` method for conversation creation, ensuring full compatibility and proper field mapping. ### Testing * Added unit tests in `CompatActivityTests.cs` for the new conversion methods, covering field mapping, null handling, and property population.
Fixed two instances where AddBotAuthentication overloads were called with parameters in the wrong order: - Line 39: The sectionName-based overload was passing parameters as (schemeName, clientId, tenantId, logger) instead of the correct (clientId, tenantId, schemeName, logger) - Line 59: The IServiceCollection overload had the same parameter ordering issue This ensures that clientId, tenantId, and schemeName are passed to the correct parameter positions, preventing authentication configuration errors. --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This PR updates the next/core branch with the latest changes from main. This pull request introduces significant improvements to the build and release pipelines for the Teams SDK, including new YAML pipeline files, refactoring of existing pipelines, and enhancements to the `Activity` class in the codebase. The changes streamline CI/CD processes, add support for targeted activities, and improve test result publishing. Pipeline and CI/CD improvements: * Added new pipeline files: `.azdo/publish-preview.yaml` for preview package publishing (manual trigger, supports both internal and public feeds), `.azdo/publish.yml` for public releases, and `.azdo/templates/sign-and-pack.yaml` as a shared signing and packing template. These changes centralize and simplify the release workflow for internal and public NuGet packages. [[1]](diffhunk://#diff-385304594914fc0af74bf0fbf7b2bb77eaadd30a583d8b2b4e928db730f5892bR1-R158) [[2]](diffhunk://#diff-186607033cddd78a2207f2b7acc82e3724148a6703c76d5f45f308a837c7e920R1-R5) [[3]](diffhunk://#diff-df3149e4326765add7763e50ab1569eaa4b619ebc212e2e9b7498854e8c7dd76R1-R94) * Refactored `.azdo/ci.yaml` and `.azdo/cd-core.yaml` to improve triggers, test result publishing, artifact naming, and build configuration handling. This includes switching artifact names to `Packages`, publishing test results, and using variables for build configuration. [[1]](diffhunk://#diff-d9306c7aa179daae2a93bd588f2df485e65c72de402e1afa7c65efa3f105b825R1-R7) [[2]](diffhunk://#diff-d9306c7aa179daae2a93bd588f2df485e65c72de402e1afa7c65efa3f105b825L36-R67) [[3]](diffhunk://#diff-54d52e0bc1c296e6fbaf6daa1236b02f1645a2a1609a7129e4185d0de161e1ebR1-R6) [[4]](diffhunk://#diff-54d52e0bc1c296e6fbaf6daa1236b02f1645a2a1609a7129e4185d0de161e1ebL68-R74) * Updated `.github/workflows/codeql.yml` to include the `next/core` branch in CodeQL analysis for improved security coverage. Enhancements to the `Activity` class and related activities: * Added an experimental `IsTargeted` property to `Activity`, with related methods and merge logic, allowing activities to indicate if they are targeted. This includes new overloads for `WithRecipient` and proper merging behavior. [[1]](diffhunk://#diff-875c3804dbdc89735553c417d023929c307dcfbead113a1b7a1e47871cab636aR149-R152) [[2]](diffhunk://#diff-875c3804dbdc89735553c417d023929c307dcfbead113a1b7a1e47871cab636aR230-R242) [[3]](diffhunk://#diff-875c3804dbdc89735553c417d023929c307dcfbead113a1b7a1e47871cab636aR433-R439) * Refactored `Value` property overrides in several activity classes (`ActionActivity`, `HandoffActivity`, `AnonQueryLinkActivity`, `FetchTaskActivity`) to use explicit getter/setter logic, improving type safety and clarity. [[1]](diffhunk://#diff-8039eb42926eb743d838475a9692396f17a72ef33f1fdbc1883b59524835ef72L28-R32) [[2]](diffhunk://#diff-cf9ec41b68de548f026e472cc44faea40af2f9415d91e56baba5eab6849c7243L23-R27) [[3]](diffhunk://#diff-2e64b26a5c79daa8c735a79d1d0ef7b177757824825771d0e555d0175e0e105fL28-R32) [[4]](diffhunk://#diff-f0921d5ad7f9df3408669c99b9d12809568feddde82f1521621301ad84cd21f0L28-R32) These changes collectively modernize and standardize the build, test, and release process, while also expanding SDK functionality for targeted activities. --------- Co-authored-by: Shanmathi Mayuram Krithivasan <37715033+ShanmathiMayuramKrithivasan@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: rido-min <14916339+rido-min@users.noreply.github.com> Co-authored-by: Corina <14900841+corinagum@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Mehak Bindra <mhk0397@gmail.com> Co-authored-by: Alex Acebo <aacebowork@gmail.com> Co-authored-by: Kavin <115390646+singhk97@users.noreply.github.com>
## Summary - Sanitize MS-CV header value to prevent log forging attacks - Remove newline characters before logging - Add comprehensive unit tests ## Context Addresses CodeQL security warning: user-provided MS-CV header values were logged without sanitization, allowing malicious users to inject fake log entries via newline characters. 🤖 Generated with Claude Code --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com> Co-authored-by: Rido <rido-min@users.noreply.github.com>
…oing activity. (#374) 1. Refactor PA bot - remove multi-host setup, support two identities simulatneously (bot & agent) 2. **[PA bug fix]** In `Microsoft.Teams.Bot.Compat`, If `serviceUrl` is not set in outgoing activity then use the one from the incomming activity as fallback 3. Make `ConversationAccount.GetAgentIdentity()` public. It's being used in the compat adapter. --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com> Co-authored-by: Rido <rido-min@users.noreply.github.com>
This pull request introduces several enhancements and new features to the Teams bot sample applications, focusing primarily on expanding the message handling capabilities, adding support for task modules, and improving targeted messaging and reactions. Additionally, it includes some cleanup and configuration changes. **Major new features and improvements:** _Message handling and bot capabilities:_ * Added new message handlers in `TeamsBot/Program.cs` for commands such as `help`, `targeted`, `react`, `card`, `feedback`, and `task`, each demonstrating specific Teams bot features like targeted messages, reactions, adaptive cards, and task modules. [[1]](diffhunk://#diff-691809f7a90c5bda6ee5e4335c2c393864a32101545fb0b35c24bc659623361bR19-R49) [[2]](diffhunk://#diff-691809f7a90c5bda6ee5e4335c2c393864a32101545fb0b35c24bc659623361bR122-R238) * Introduced a detailed help handler that lists available message patterns and commands, improving discoverability for users. * Enhanced the catch-all handler to echo messages with a mention and provide guidance to users. * Improved lifecycle event handling by reordering and clarifying message update and delete handlers. [[1]](diffhunk://#diff-691809f7a90c5bda6ee5e4335c2c393864a32101545fb0b35c24bc659623361bL118-R284) [[2]](diffhunk://#diff-691809f7a90c5bda6ee5e4335c2c393864a32101545fb0b35c24bc659623361bL158-R310) _Task module support:_ * Added two new Adaptive Card definitions, `TaskModuleLauncherCard` and `TaskModuleFormCard`, in `Cards.cs` to support task module dialogs. * Implemented handlers for task module fetch and submit events, enabling the bot to display a form in a dialog and process the submitted data. _Targeted messaging and reactions:_ * Added handlers and logic to demonstrate sending, updating, and deleting targeted messages, as well as adding and removing reactions to messages, both in the main Teams bot sample and in the `CompatBot` sample. [[1]](diffhunk://#diff-691809f7a90c5bda6ee5e4335c2c393864a32101545fb0b35c24bc659623361bR122-R238) [[2]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL39-R93) _Other improvements and cleanup:_ * Fixed the documentation URL for the Teams SDK in the citation handler. * Updated `.gitignore` to exclude the `.claude/` directory. * Removed the now-unnecessary `.claude/settings.local.json` configuration file. * Minor code cleanup and dependency ordering in `RoutedTokenAcquisitionService.cs` and `EchoBot.cs`. [[1]](diffhunk://#diff-49a16dd3d7f594e27c7dd21596874e089adf4f5f2fc7ef24a41f028035834163R4-L6) [[2]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL11) [[3]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL23-R22) **References:** [[1]](diffhunk://#diff-691809f7a90c5bda6ee5e4335c2c393864a32101545fb0b35c24bc659623361bR19-R49) [[2]](diffhunk://#diff-691809f7a90c5bda6ee5e4335c2c393864a32101545fb0b35c24bc659623361bR122-R238) [[3]](diffhunk://#diff-691809f7a90c5bda6ee5e4335c2c393864a32101545fb0b35c24bc659623361bL118-R284) [[4]](diffhunk://#diff-691809f7a90c5bda6ee5e4335c2c393864a32101545fb0b35c24bc659623361bL158-R310) [[5]](diffhunk://#diff-691809f7a90c5bda6ee5e4335c2c393864a32101545fb0b35c24bc659623361bL178-R360) [[6]](diffhunk://#diff-cc765b586b9be67733b494a4fdd0dffee5c3641f29ec07a1d4ddc0ebc0f709c8R61-R143) [[7]](diffhunk://#diff-af85f59c6492668dca14d5f06b54cc2c3173708c83073e1d947b4c007dc851d6R4-R5) [[8]](diffhunk://#diff-7c41c1a079a34ad9d167680c2029c93f0e4568a85e4ea589d96c0704bdce6e70L1-L8) [[9]](diffhunk://#diff-49a16dd3d7f594e27c7dd21596874e089adf4f5f2fc7ef24a41f028035834163R4-L6) [[10]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL11) [[11]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL23-R22) [[12]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL39-R93) [[13]](diffhunk://#diff-691809f7a90c5bda6ee5e4335c2c393864a32101545fb0b35c24bc659623361bL78-R106) --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
**New StreamingBot sample:** * Added the `StreamingBot` sample project to the solution and implemented its main logic in `Program.cs`. The bot streams responses from OpenAI, progressively updating the message in Teams and including citations and adaptive cards. **Streaming message support in Teams SDK:** * Introduced the `TeamsStreamingWriter` class for managing streaming message updates, supporting informative, intermediate, and final chunks, and handling entities and attachments. * Added the `GetStreamingWriter()` method to the `Context` class, enabling easy creation of streaming writers in bot logic. **Schema and serialization improvements:** * Added the `TypingActivity` class to represent intermediate streaming updates, including serialization support and integration into the activity type system.
Key changes: * Channel shared, unshared, member added, member removed now working. **Sample Bot Event Handlers (TeamsChannelBot/Program.cs):** -> member added, member removed, shared, unshared is registered once and in the correct place. The `OnChannelRestored` handler remains commented out due to lack of testability. **Event Type Constants (Schema/Activities/ConversationUpdateActivity.cs):** -> Fixed the casing of the `ChannelUnShared` event constant to `channelUnshared` .
Introduce LoggerExtensions with LogInformationGuarded and LogTraceGuarded to prevent expensive log message construction when not enabled. Replace direct LogInformation and LogTrace calls with guarded versions in core classes. Remove CA1873 suppression and update CA2227 justification. Improves logging performance and consistency.
- Added a new Adaptive Card for time off requests and updated the "card" handler to use it. - Introduced WelcomeMessageMiddleware to send a help message on first interaction; refactored "help" handler to reuse this message. - Improved "hello" handler to mention the user and show typing. - Commented out the catch-all echo handler to reduce noise. - Added OnMessageSubmitAction handler to process Adaptive Card submissions. - Minor cleanups: removed verbose logging and improved code structure.
This pull request introduces a new `SuggestedActions` feature for message activities, enabling quick reply buttons and card actions in Microsoft Teams bots. The changes include new schema classes, extension methods for easier usage, and comprehensive unit tests to ensure correct serialization, deserialization, and fluent API behavior. **Schema and Serialization Enhancements:** * Added new `CardAction` and `SuggestedActions` classes to represent quick reply actions and their recipients, including common action types as constants. (`core/src/Microsoft.Teams.Bot.Apps/Schema/CardAction.cs`, `core/src/Microsoft.Teams.Bot.Apps/Schema/SuggestedActions.cs`) [[1]](diffhunk://#diff-4c159b3af4206d04ce4994d2775b93613c4c5827d7183a55042b04bacad8af07R1-R131) [[2]](diffhunk://#diff-ee8ce6b3eb82cc49311f75430d57fd1dd69a0feb1d781cbf2cbe7b3cdca5ba95R1-R68) * Registered `CardAction` and `SuggestedActions` for JSON serialization in `TeamsActivityJsonContext`. (`core/src/Microsoft.Teams.Bot.Apps/Schema/TeamsActivityJsonContext.cs`) **Integration with MessageActivity:** * Integrated `SuggestedActions` property into `MessageActivity`, including support for deserialization from JSON and removal of legacy code. (`core/src/Microsoft.Teams.Bot.Apps/Schema/Activities/MessageActivity.cs`) [[1]](diffhunk://#diff-6f59d077bae6751d429a1458ffb982780671be62e09027244661405f0baad1a2R75-R86) [[2]](diffhunk://#diff-6f59d077bae6751d429a1458ffb982780671be62e09027244661405f0baad1a2R138-R143) [[3]](diffhunk://#diff-6f59d077bae6751d429a1458ffb982780671be62e09027244661405f0baad1a2L162-L164) [[4]](diffhunk://#diff-6f59d077bae6751d429a1458ffb982780671be62e09027244661405f0baad1a2L266-L280) [[5]](diffhunk://#diff-6f59d077bae6751d429a1458ffb982780671be62e09027244661405f0baad1a2R4) **Developer Experience Improvements:** * Added extension methods to simplify adding and chaining suggested actions to message activities. (`core/src/Microsoft.Teams.Bot.Apps/Schema/SuggestedActionsExtensions.cs`) **Testing and Validation:** * Introduced a comprehensive unit test suite to verify all aspects of the new suggested actions feature, including serialization, deserialization, fluent API, and extension methods. (`core/test/Microsoft.Teams.Bot.Apps.UnitTests/SuggestedActionsTests.cs`) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Reorganize Teams activity classes (e.g., MessageActivity, InvokeActivity, EventActivity, etc.) from the Schema namespace into the new Handlers namespace and file structure. Update all relevant usings and references throughout the codebase. No functional changes—this improves code organization and maintainability by clarifying the separation between schema definitions and activity handlers. Also includes minor clarity improvements in StreamingWriter. One benefit of this organization for activities, is that make it clear which activities are _incoming_ from the handlers, and which ones are _outgoing_ in Schema.
1. Fix missing `RequireAuthorization` in CompatBot sample. 2. Refactor service collection setup. 3. Use `BotConfig` as single source for reading & propagating configuration instead of doing that all over. 4. Move Msal setup logic to separate class 5. Support scenario where auth is not provided. Warning logs will be emitted. Clients will be created without auth. Incomming token validation will use a bypass scheme. # Logs when setting up auth using the different config formats ## No credentials setup <img width="1096" height="137" alt="image" src="https://github.com/user-attachments/assets/8ed049bb-13a2-4858-9328-560696b34f6e" /> ### Testing with Agents Plaground <img width="1202" height="216" alt="image" src="https://github.com/user-attachments/assets/3ca23613-e725-4fda-8d8a-7867185bce74" /> edit: it had multiple redundant logs before ## Msal Config setup <img width="1098" height="179" alt="image" src="https://github.com/user-attachments/assets/52ff919c-37bf-4077-8cbf-ce9db00cf1c8" /> ## Core config setup <img width="717" height="292" alt="image" src="https://github.com/user-attachments/assets/2ce6adf6-0d3e-4abf-a986-185ea0bb1b99" /> ## BF config setup <img width="1049" height="291" alt="image" src="https://github.com/user-attachments/assets/cdc80a0c-23af-43cc-afc6-408281d216db" /> --------- Co-authored-by: Rido <rido-min@users.noreply.github.com>
Update next/core with the latest changes from main
Fix Conflicts in Activity Client
…o body when sending an activity (#419) **Null-safe Handling of Send Activity Responses:** * Changed the return type of `SendAsync` in `ActivitiesApi.cs` to `Task<SendActivityResponse?>`, allowing for null responses when the service returns no body. * Updated `TeamsStreamingWriter.cs` to handle potentially null `SendActivityResponse` objects in both `SendInformativeUpdateAsync` and `AppendResponseAsync`, ensuring `_streamId` is only set if a response is present. [[1]](diffhunk://#diff-19137d244f3805ddd4f0cb3a2f42577ca66bc85f7c8eabb4ab4b38a8e95f363eL75-R76) [[2]](diffhunk://#diff-19137d244f3805ddd4f0cb3a2f42577ca66bc85f7c8eabb4ab4b38a8e95f363eL100-R101) * Modified `CompatConversations.cs` to handle null `SendActivityResponse` objects when replying to activities, defaulting the resource response ID to an empty string if necessary. --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Upgraded Microsoft.AspNetCore.Authentication.* packages to 10.0.6 for .NET 10.0. Updated Microsoft.Identity.Web.UI and AgentIdentities to 4.7.0. This ensures compatibility and includes the latest fixes and improvements.
This pull request adds a new package dependency to the project to support XML cryptography functionality across both .NET 8 and .NET 10 target frameworks. Dependency updates: * Added `System.Security.Cryptography.Xml` as a package reference for both .NET 8 (`Version="8.0.3"`) and .NET 10 (`Version="10.0.6"`) in `Microsoft.Teams.Bot.Core.csproj` to enable XML cryptography features.
This pull request introduces significant improvements to cloud environment support and authentication flexibility in the Teams API SDK, while also cleaning up legacy and experimental features. The main focus is on enabling multi-cloud support (including USGov, DoD, and China) through a new `CloudEnvironment` abstraction, updating authentication flows to use cloud-specific endpoints, and ensuring that token and service URLs are configurable and propagated across client instances. Additionally, the pipeline configuration is modernized and consolidated. **Cloud Environment & Authentication Enhancements** * Introduced the `CloudEnvironment` class in `Microsoft.Teams.Api.Auth`, encapsulating all cloud-specific endpoints, scopes, and service URLs, with predefined instances for Public, USGov, USGovDoD, and China clouds, and support for custom environments. (`Libraries/Microsoft.Teams.Api/Auth/CloudEnvironment.cs`) * Updated `ClientCredentials` to accept and use a `CloudEnvironment` property, ensuring that all authentication requests (token endpoints, tenants, etc.) are cloud-aware and configurable. (`Libraries/Microsoft.Teams.Api/Auth/ClientCredentials.cs`) [[1]](diffhunk://#diff-f4f1e221601dfbc876cf9ad54cede6b78a6e47d391a2c1c2da880d62d38e0b75R13) [[2]](diffhunk://#diff-f4f1e221601dfbc876cf9ad54cede6b78a6e47d391a2c1c2da880d62d38e0b75L29-R32) **Client Propagation of Cloud Settings** * Modified `ApiClient` and related sub-clients to propagate cloud-specific token service URLs and scopes, ensuring consistent behavior when cloning or instantiating new clients with different cancellation tokens. (`Libraries/Microsoft.Teams.Api/Clients/ApiClient.cs`) * Updated `BotSignInClient` to use a configurable `TokenServiceUrl` property instead of a hardcoded URL, and applied this property in all relevant API calls. (`Libraries/Microsoft.Teams.Api/Clients/BotSignInClient.cs`) [[1]](diffhunk://#diff-ead232105604b792e01c19dfe643c10410b2f05c1cfb6e9ba7010df63fa42750R10-R11) [[2]](diffhunk://#diff-ead232105604b792e01c19dfe643c10410b2f05c1cfb6e9ba7010df63fa42750L35-R37) [[3]](diffhunk://#diff-ead232105604b792e01c19dfe643c10410b2f05c1cfb6e9ba7010df63fa42750L47-R49) **Pipeline Modernization** * Migrated and consolidated the NuGet publishing pipeline to use the 1ES Official Pipeline Template, supporting both internal and public publishing, with improved security compliance and parameterization. (`.azdo/publish.yaml`, `.azdo/publish.yml`) [[1]](diffhunk://#diff-a07de71ec9283c8c83026a8a37c4f360f30d4e0d6890911cda3abb8ab01b5bc2R1-R227) [[2]](diffhunk://#diff-186607033cddd78a2207f2b7acc82e3724148a6703c76d5f45f308a837c7e920L1-L87) **Legacy/Experimental Cleanup** * Removed the experimental `IsTargeted` property and related logic from the `Activity` class, simplifying the activity model and removing obsolete code paths. (`Libraries/Microsoft.Teams.Api/Activities/Activity.cs`) [[1]](diffhunk://#diff-875c3804dbdc89735553c417d023929c307dcfbead113a1b7a1e47871cab636aL149-L152) [[2]](diffhunk://#diff-875c3804dbdc89735553c417d023929c307dcfbead113a1b7a1e47871cab636aL230-L237) [[3]](diffhunk://#diff-875c3804dbdc89735553c417d023929c307dcfbead113a1b7a1e47871cab636aL443-L449)
This PR removes the dependency from Compat to TeamsApps, so we can decouple the release date of Core/Compat from PA, from the FE release. - Updates Compat Hosting to Add BotApplication instead of TeamsBotApplication - Updates CompatTeamsInfo to call each rest endpoint though the ConversationClient.BotHttpClient Instance - Remove some conversion from Core->Compat by using the proper generic in the REST call This pull request primarily migrates code from using the legacy `TeamsBotApplication` and related types in the `Microsoft.Teams.Bot.Apps` namespace to the newer `BotApplication` and types from `Microsoft.Teams.Bot.Core`. It also removes or updates compatibility methods that referenced the old schema, and modernizes dependency registration and usage throughout the codebase. Additionally, there are improvements to the handling of Teams channel account conversions and group conversation logic in the sample bots. **Migration to Bot Core and Cleanup:** * Replaced all references to `TeamsBotApplication` with `BotApplication` and updated constructor parameters and dependency injection registrations accordingly in `CompatAdapter`, `CompatBotAdapter`, `AdapterWithErrorHandler`, and related files. (`[[1]](diffhunk://#diff-e6d701ce121dda6651c0dea00498d45e2cc0b0cec446a578f3058be691c7c0f5L26-R25)`, `[[2]](diffhunk://#diff-e6d701ce121dda6651c0dea00498d45e2cc0b0cec446a578f3058be691c7c0f5L35-R34)`, `[[3]](diffhunk://#diff-c443812ac75b10f0cb9e0929a1165dee72b7c96adbd232d830a65348ccd1b42bL28-R32)`, `[[4]](diffhunk://#diff-e5922e6d5c7613f25aefa88e9c33d5a6c34be42d4353354e5f0e36f1715a0290L8-R16)`, `[[5]](diffhunk://#diff-cb614beeb934fbb598ccac80c19a12a440f301b38b67b0e2796e861754fe59caL274-R280)`, `[[6]](diffhunk://#diff-4a8e01c7cbf79ebf85f84bb4bef8cf1d3b02dc8a5875df6e9b34ac819fb7f80fL20-R20)`) * Updated all using statements and type references from `Microsoft.Teams.Bot.Apps` and `Microsoft.Teams.Bot.Apps.Schema` to `Microsoft.Teams.Bot.Core` and `Microsoft.Teams.Bot.Core.Schema` as appropriate. (`[[1]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL8-R11)`, `[[2]](diffhunk://#diff-92ebcca71bdaad244e949c815cbf1152d5a3d814cc007052ae7ad2dd8ab225a9L8)`, `[[3]](diffhunk://#diff-e6d701ce121dda6651c0dea00498d45e2cc0b0cec446a578f3058be691c7c0f5L9)`, `[[4]](diffhunk://#diff-c443812ac75b10f0cb9e0929a1165dee72b7c96adbd232d830a65348ccd1b42bL9)`, `[[5]](diffhunk://#diff-0317e1008e12e306d92289bc421d83933ace0400793ed8ad8abf13b03b68511eL7-R7)`) **Dependency Injection and Service Registration:** * Changed service registration in `InitCompatAdapter.cs` and `CompatHostingExtensions.cs` to use `AddBotApplication` instead of `AddTeamsBotApplication`, and updated singleton registrations to use `BotApplication`. (`[[1]](diffhunk://#diff-cb614beeb934fbb598ccac80c19a12a440f301b38b67b0e2796e861754fe59caL274-R280)`, `[[2]](diffhunk://#diff-0317e1008e12e306d92289bc421d83933ace0400793ed8ad8abf13b03b68511eL45-R45)`) **Schema and Compatibility Layer Updates:** * Updated compatibility methods to use `ConversationAccount` from the new core schema instead of legacy types, including the conversion logic for Teams channel accounts. (`[[1]](diffhunk://#diff-2b447b715e5c577302421ca232985ced9354b64def7b26219525758928d097daL427-L435)`, `[[2]](diffhunk://#diff-92ebcca71bdaad244e949c815cbf1152d5a3d814cc007052ae7ad2dd8ab225a9L118-L204)`) * Removed legacy compatibility methods for meeting info, meeting participants, and channel info that referenced deprecated types. (`[core/src/Microsoft.Teams.Bot.Compat/CompatActivity.csL118-L204](diffhunk://#diff-92ebcca71bdaad244e949c815cbf1152d5a3d814cc007052ae7ad2dd8ab225a9L118-L204)`) **Bot Sample Improvements:** * Enhanced the `EchoBot` sample to fetch and echo the user's display name, and in group conversations, to retrieve and display team details and paged member names using the new compatibility APIs. (`[core/samples/CompatBot/EchoBot.csL37-R79](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL37-R79)`) **Miscellaneous:** * Added missing `System.Text.Json.Serialization` using directive in `CompatTeamsInfo.Models.cs`. (`[core/src/Microsoft.Teams.Bot.Compat/CompatTeamsInfo.Models.csR4](diffhunk://#diff-b1e303edd8e27c1011150ab48fe66a5de7f2e8ff54a6850a87efc57bcbd46583R4)`) These changes modernize the codebase, improve maintainability, and ensure compatibility with the latest Teams Bot SDK core components.
This is a RI to make sure next/core has no conflicts with main --------- Co-authored-by: Shanmathi Mayuram Krithivasan <37715033+ShanmathiMayuramKrithivasan@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: rido-min <14916339+rido-min@users.noreply.github.com> Co-authored-by: Corina <14900841+corinagum@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Mehak Bindra <mhk0397@gmail.com> Co-authored-by: Alex Acebo <aacebowork@gmail.com> Co-authored-by: Kavin <115390646+singhk97@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com> Co-authored-by: Rajan <rajan.chari@yahoo.com> Co-authored-by: Lily Du <lilyyduu@gmail.com> Co-authored-by: lilydu <lilydu+odspmdb@microsoft.com>
This pull request makes significant improvements to the documentation and API mapping for the Teams Bot compatibility layer, focusing on clarifying the design and usage of the new `ApiClient` abstraction and updating the mapping for Teams and batch APIs. The changes include a comprehensive design document for `ApiClient`, a major rewrite of the CompatTeamsInfo API mapping, and updates to deprecated warnings and method routing. These updates provide clearer guidance for migrating to the new architecture and highlight areas needing further work. **ApiClient Design and Usage Documentation:** - Added a detailed `ApiClient-Design.md` document describing the architecture, sub-client structure, DI patterns, scoping via `ForServiceUrl`, and delegation to core SDK clients. Includes diagrams, method mapping tables, and integration details for handler and compat layers. **CompatTeamsInfo API Mapping Updates:** - Rewrote `CompatTeamsInfo-API-Mapping.md` to: - Clarify which methods are implemented, deprecated, or pending. - Update method routing to reflect usage of `ApiClient` sub-clients for meetings and teams, and identify methods still requiring a new `BatchClient`. - Add a migration checklist, summarize type conversion strategies, and clarify authentication/service URL handling. **Deprecation and Method Routing:** - Updated documentation to remove deprecated warning icons and instead use explanatory notes for deprecated member/team methods, and clarified the preferred paged alternatives. **Testing and References:** - Expanded testing documentation to specify test locations and required environment variables, and improved references to supporting documents and API sources. **Project File Maintenance:** - Minor update to the `core.slnx` solution file to remove the `Id` attribute from the `Microsoft.Teams.Bot.Compat.csproj` entry, likely for consistency or tooling compatibility. --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Shanmathi Mayuram Krithivasan <37715033+ShanmathiMayuramKrithivasan@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: rido-min <14916339+rido-min@users.noreply.github.com> Co-authored-by: Corina <14900841+corinagum@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Mehak Bindra <mhk0397@gmail.com> Co-authored-by: Alex Acebo <aacebowork@gmail.com> Co-authored-by: Kavin <115390646+singhk97@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com> Co-authored-by: Rajan <rajan.chari@yahoo.com> Co-authored-by: Lily Du <lilyyduu@gmail.com> Co-authored-by: lilydu <lilydu+odspmdb@microsoft.com>
## Summary This PR enhances the PABot sample with dual OAuth authentication and CompatTeamsInfo integration, demonstrating advanced Teams bot capabilities. ## Changes ### Dual OAuth Authentication - ✅ Sequential authentication with two OAuth connections (`graph` and `graph-2`) - ✅ Connection names configurable via `launchSettings.json` (`ConnectionName` and `SecondConnectionName`) - ✅ Six-step waterfall dialog flow: 1. Prompt for first connection (graph) 2. Authenticate first connection 3. Prompt for second connection (graph-2) 4. Authenticate second connection and display user profile 5. Ask user if they want to view tokens 6. Display both tokens if requested - ✅ Enhanced logout to clear both OAuth connections ### CompatTeamsInfo Integration - ✅ **`/member-info` command**: Uses `CompatTeamsInfo.GetMemberAsync` to retrieve and display: - Name, ID, AAD Object ID, User Principal Name, Email - ✅ **`/team-info` command**: Uses `CompatTeamsInfo.GetTeamDetailsAsync` to display: - Team Name, ID, AAD Group ID (only works in team context) - ✅ **Enhanced `OnMembersAddedAsync`**: Logs detailed member information when users join using `GetMemberAsync` ### User Experience Improvements - ✅ **`/help` command**: Comprehensive help showing: - All available commands and their usage - Authentication flow explanation - Technical features overview - ✅ **Updated welcome message**: Includes all available commands including `/help` ## Testing The bot can be tested by: 1. Starting a conversation with the bot 2. Authenticating with both connections sequentially 3. Testing commands: `/help`, `/member-info`, `/team-info`, `/create-conversation` 4. Verifying logout clears both connections ## Technical Details **Files Modified:** - `core/samples/PABot/Bots/TeamsBot.cs` - Added commands and CompatTeamsInfo usage - `core/samples/PABot/Dialogs/MainDialog.cs` - Dual OAuth dialog flow and custom logout - `core/samples/PABot/Program.cs` - Switched to TeamsBot (from EchoBot) - `core/samples/PABot/Properties/launchSettings.json` - Added `SecondConnectionName` environment variable 🤖 Generated with Claude Code --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
| { | ||
| TeamsChannelAccount memberDetails = await CompatTeamsInfo.GetMemberAsync(turnContext, member.Id, cancellationToken); | ||
| _logger.LogInformation("Member added: {Name} ({Email}), AAD Object ID: {AadObjectId}", | ||
| memberDetails.Name, memberDetails.Email, memberDetails.AadObjectId); |
) ## Summary - **Decouples** the `CancellationToken` passed to bot handlers from the incoming HTTP request's `HttpContext.RequestAborted` token, which fires when Teams closes the connection (~15s) — before streaming handlers finish their work. - **Adds** `BotApplicationOptions.ProcessActivityTimeout` (default: 5 minutes) as a configurable timeout that replaces the HTTP-bound token. - **Handles** `OperationCanceledException` gracefully when the timeout fires, logging a warning instead of throwing `BotHandlerException`. ## Problem Streaming bots send responses via the Bot Connector API (`ConversationClient.SendActivityAsync`), not through the original HTTP response. The handler legitimately outlives the HTTP request. Previously, the HTTP disconnection would cancel in-flight LLM streaming calls, causing `TaskCanceledException` → `BotHandlerException` → 500 errors. ## Design document See [`docs/design-decouple-cancellation-token.md`](docs/design-decouple-cancellation-token.md) for the full design proposal, alternatives considered, and impact analysis. ## Test plan - [ ] Verify StreamingBot sample streams full LLM responses without `TaskCanceledException` - [ ] Verify non-streaming bots (e.g. CoreBot, EchoBot) are unaffected by the 5-minute default - [ ] Verify `ProcessActivityTimeout` can be configured to a custom value - [ ] Verify timeout fires and logs warning (not exception) when a handler exceeds the configured duration - [ ] Verify `Debugger.IsAttached` still bypasses the timeout with `CancellationToken.None` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
## Summary - **Info**: High-level flow only — bot started, activity received/finished, route dispatched - **Debug**: HTTP responses with status codes, middleware execution, token acquisition, handler registration - **Trace**: Full JSON payloads, token claims, route selector evaluation, OIDC authority resolution - Centralize HTTP logging in `BotHttpClient` — remove duplicate URL logs from `ConversationClient`, `TeamsApiClient`, and `UserTokenClient` - Add `LogDebugGuarded` extensions matching existing `LogTraceGuarded` pattern - Add logging to previously silent areas: middleware pipeline, handler registration, streaming lifecycle, compat error handling, JWT issuer resolution ## Test plan - [x] `dotnet build` — 0 errors, 0 warnings across all source projects - [x] `dotnet test` — 541 tests pass (Core 121×2, Apps 129×2, Compat 41) - [ ] Manual verification with sample app at each log level: - `"Microsoft.Teams": "Information"` — flow: started → activity received → route dispatched → finished - `"Microsoft.Teams": "Debug"` — adds HTTP status codes, middleware steps, token acquisition - `"Microsoft.Teams": "Trace"` — adds full JSON payloads, token claims, selector results 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This update improves the handling of `signin/failure` invoke activities by ensuring that the failure details are logged accurately. The code now directly accesses the `Code` and `Message` properties of the failure object, providing clearer and more informative log messages. This change enhances the ability to diagnose issues related to SSO token exchanges. Additionally, it introduces a system default handler that logs actionable warnings and emits error events for better visibility into sign-in failures. --------- Co-authored-by: Shanmathi Mayuram Krithivasan <37715033+ShanmathiMayuramKrithivasan@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: rido-min <14916339+rido-min@users.noreply.github.com> Co-authored-by: Corina <14900841+corinagum@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Mehak Bindra <mhk0397@gmail.com> Co-authored-by: Alex Acebo <aacebowork@gmail.com> Co-authored-by: Kavin <115390646+singhk97@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com> Co-authored-by: Rajan <rajan.chari@yahoo.com> Co-authored-by: Lily Du <lilyyduu@gmail.com> Co-authored-by: lilydu <lilydu+odspmdb@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR to merge next/core into main