Skip to content

fix(teams): pass channel_info/team_info to lifecycle handler dispatches#1

Closed
btoo wants to merge 1 commit intomainfrom
fix/teams-channel-lifecycle-dispatch-args
Closed

fix(teams): pass channel_info/team_info to lifecycle handler dispatches#1
btoo wants to merge 1 commit intomainfrom
fix/teams-channel-lifecycle-dispatch-args

Conversation

@btoo
Copy link
Copy Markdown
Owner

@btoo btoo commented Apr 21, 2026

draft inside my fork, not meant to merge — just so the diff is visible

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_added correctly, the file imports ChannelInfo solely to type those signatures, and the .NET sibling SDK does it right.

Anyone who installs an agents-for-python bot in a Teams team and then creates, renames, or deletes a channel gets a TypeError echoed into the channel by the default error handler. Shipped Aug 2025, untouched since.

Fix is passing channel_data.channel and channel_data.team (already in scope) to all 10 dispatches.

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.
@btoo
Copy link
Copy Markdown
Owner Author

btoo commented Apr 21, 2026

reopened upstream: microsoft#375

@btoo btoo closed this Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant