fix(teams): pass channel_info/team_info to lifecycle handler dispatches#375
Open
btoo wants to merge 1 commit intomicrosoft:mainfrom
Open
fix(teams): pass channel_info/team_info to lifecycle handler dispatches#375btoo wants to merge 1 commit intomicrosoft:mainfrom
btoo wants to merge 1 commit intomicrosoft:mainfrom
Conversation
The TeamsActivityHandler.on_conversation_update_activity dispatcher was calling on_teams_channel_created/deleted/renamed/restored and on_teams_team_archived/deleted/hardDeleted/renamed/restored/unarchived with only turn_context, but every one of those methods is defined with a 3-arg signature (channel_info, team_info, turn_context) or 2-arg (team_info, turn_context). Result: any Teams team where the bot is installed raises a TypeError the moment a channel is created/renamed/etc., which the default on_turn_error then echoes into the channel as a stack trace — visible to all members. The .NET sibling SDK (microsoft/Agents-for-net, src/libraries/Extensions/Microsoft.Agents.Extensions.Teams/Compat/TeamsActivityHandler.cs:504) is the canonical reference and dispatches with all 3 args (channelData.Channel, channelData.Team, turnContext). The same dispatcher already extracts channel_data.team correctly for on_teams_members_added_dispatch (line 513), so channel_data.channel and channel_data.team are in scope at the call sites — this is purely a transcription bug. No public API changes.
Author
|
@microsoft-github-policy-service agree |
rodrigobr-msft
approved these changes
Apr 23, 2026
Contributor
|
Make sure to run install the black ./libraries ./tests |
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.
The Teams handler's lifecycle dispatcher calls 10 channel/team event handlers with 1 arg, but every one of those methods needs 3. Sixteen lines above the same file dispatches
members_addedcorrectly, the file importsChannelInfoonly to type those signatures, and the .NET sibling does it the right way.Anyone who installs an agents-for-python bot in a Teams team and then creates, renames, or deletes a channel gets a
TypeErrorechoed into the channel by the default error handler. Shipped Aug 2025, untouched since.Fix passes
channel_data.channelandchannel_data.team(already in scope) to all 10 dispatches.