Skip to content

Remove ActivitySender send abstraction#479

Merged
heyitsaamir merged 4 commits into
feature_agent365_supportfrom
remove_activity_sender
Jun 24, 2026
Merged

Remove ActivitySender send abstraction#479
heyitsaamir merged 4 commits into
feature_agent365_supportfrom
remove_activity_sender

Conversation

@heyitsaamir

@heyitsaamir heyitsaamir commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Removes the separate ActivitySender class while preserving its send behavior.

Why:
ActivitySender had become a second send path. With AgenticIdentity support, the API client owns service URL resolution and request auth, so activity sends should route through the same API client path.

Interesting bits:

  • send_or_update_activity keeps the old ActivitySender contract without keeping the class.
  • Preserves create vs update behavior when activity.id is set.
  • Preserves targeted create/update routing through create_targeted / update_targeted.
  • Preserves activity.from_ = ref.bot and activity.conversation = ref.conversation stamping.
  • Preserves targeted-in-personal-chat validation.
  • ActivityContext still creates HttpStream directly from its scoped API client.

Reviewer tips:
Start with activity_send.py, then check ActivityContext.send, App.send, and FunctionContext.send.

Testing:

  • Focused app send/reply/function/quoted-reply tests covering the old ActivitySender behavior.
  • Ruff on touched app send files and tests.

@heyitsaamir

heyitsaamir commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator Author

@heyitsaamir heyitsaamir force-pushed the reimplement_agentic_api_surface branch from 7d08d1a to 3646bf5 Compare June 17, 2026 22:26
@heyitsaamir heyitsaamir force-pushed the remove_activity_sender branch 2 times, most recently from d1219ac to 123df7d Compare June 17, 2026 22:57
@heyitsaamir heyitsaamir force-pushed the reimplement_agentic_api_surface branch from c6becbe to 9e101e1 Compare June 17, 2026 23:01
@heyitsaamir heyitsaamir force-pushed the remove_activity_sender branch 2 times, most recently from fe6b8c5 to 1b0b92d Compare June 18, 2026 00:01
@heyitsaamir heyitsaamir force-pushed the reimplement_agentic_api_surface branch from 4a16fc5 to 414e668 Compare June 18, 2026 18:28
@heyitsaamir heyitsaamir force-pushed the remove_activity_sender branch 2 times, most recently from d9fb845 to 28b42b4 Compare June 18, 2026 20:41
@heyitsaamir heyitsaamir force-pushed the reimplement_agentic_api_surface branch from 38bbf08 to 8652367 Compare June 18, 2026 23:39
@heyitsaamir heyitsaamir force-pushed the remove_activity_sender branch from 28b42b4 to 9a47d7b Compare June 18, 2026 23:39
@heyitsaamir heyitsaamir force-pushed the reimplement_agentic_api_surface branch from 8652367 to 522ba00 Compare June 18, 2026 23:52
@heyitsaamir heyitsaamir force-pushed the remove_activity_sender branch from 9a47d7b to bd67034 Compare June 18, 2026 23:52
@heyitsaamir heyitsaamir force-pushed the reimplement_agentic_api_surface branch from 522ba00 to b335f67 Compare June 19, 2026 00:22
@heyitsaamir heyitsaamir force-pushed the remove_activity_sender branch from bd67034 to 703a53d Compare June 19, 2026 00:22
@heyitsaamir heyitsaamir force-pushed the reimplement_agentic_api_surface branch from b335f67 to 22c23a6 Compare June 19, 2026 00:52
@heyitsaamir heyitsaamir force-pushed the remove_activity_sender branch from 703a53d to dd092e4 Compare June 19, 2026 00:52
Comment thread packages/apps/src/microsoft_teams/apps/routing/activity_context.py Outdated

@corinagum corinagum left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing ActivitySender is the right call, but it's introducing behavior regression between what people calling through it would experience vs. api.conversation...create() directly

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the ActivitySender abstraction from the apps package and reroutes App.send, ActivityContext.send, and FunctionContext.send through the API client’s conversations.activities(...).create(...) pathway, updating unit tests accordingly. It also keeps streaming support by having ActivityContext construct HttpStream directly from its scoped ApiClient.

Changes:

  • Removed ActivitySender and updated app/context send flows to call the Conversations Activities API client directly.
  • Refactored ActivityContext streaming initialization to be lazy via HttpStream(self.api, self.conversation_ref).
  • Updated tests to mock conversations.activities(...).create(...) rather than activity_sender.send(...); deleted ActivitySender unit tests.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/apps/src/microsoft_teams/apps/routing/activity_context.py Removes ActivitySender dependency, adds lazy stream, and routes send() through API client create.
packages/apps/src/microsoft_teams/apps/contexts/function_context.py Routes send() through API client create and sets basic outbound activity fields.
packages/apps/src/microsoft_teams/apps/app.py Removes ActivitySender initialization and routes proactive send() through API client create.
packages/apps/src/microsoft_teams/apps/app_process.py Removes ActivitySender injection and builds ActivityContext without it.
packages/apps/src/microsoft_teams/apps/activity_sender.py Deleted ActivitySender implementation.
packages/apps/tests/test_activity_context.py Updates mocks/expectations to observe API client create calls instead of sender calls.
packages/apps/tests/test_quoted_reply.py Updates reply/quote tests to read arguments passed to API client create.
packages/apps/tests/test_function_context.py Updates tests to validate API client create call path and return type.
packages/apps/tests/test_app.py Updates send/reply tests to mock the API create path.
packages/apps/tests/test_app_process.py Updates processor tests to patch ApiClient/HttpStream instead of ActivitySender.
packages/apps/tests/test_app_oauth.py Removes activity_sender argument from context construction.
packages/apps/tests/test_optional_graph_dependencies.py Removes activity_sender argument from context construction.
packages/apps/tests/test_activity_sender.py Deleted tests for removed ActivitySender.

Comment thread packages/apps/src/microsoft_teams/apps/routing/activity_context.py Outdated
Comment thread packages/apps/src/microsoft_teams/apps/app.py Outdated
Comment thread packages/apps/src/microsoft_teams/apps/contexts/function_context.py Outdated
@heyitsaamir heyitsaamir force-pushed the remove_activity_sender branch from dd092e4 to f305e45 Compare June 19, 2026 20:21
@heyitsaamir heyitsaamir force-pushed the reimplement_agentic_api_surface branch from ea94db0 to 45dbacd Compare June 22, 2026 22:10
@heyitsaamir heyitsaamir force-pushed the remove_activity_sender branch from 5f7e6d7 to c9223fe Compare June 22, 2026 22:11
@heyitsaamir heyitsaamir force-pushed the reimplement_agentic_api_surface branch from 45dbacd to e37e732 Compare June 22, 2026 22:18
@heyitsaamir heyitsaamir force-pushed the remove_activity_sender branch from c9223fe to 6088587 Compare June 22, 2026 22:18
@heyitsaamir heyitsaamir force-pushed the reimplement_agentic_api_surface branch from e37e732 to 7b4376b Compare June 22, 2026 22:39
@heyitsaamir heyitsaamir force-pushed the remove_activity_sender branch from 6088587 to 54dc844 Compare June 22, 2026 22:39
@heyitsaamir heyitsaamir requested a review from corinagum June 22, 2026 23:07
@heyitsaamir

Copy link
Copy Markdown
Collaborator Author

@corinagum the logic's updated again to move us to a utility that handles the complexities around sending. It's hared between ctx.send and app.send

@heyitsaamir heyitsaamir force-pushed the remove_activity_sender branch from 54dc844 to a9ef9ab Compare June 22, 2026 23:14
@heyitsaamir heyitsaamir force-pushed the reimplement_agentic_api_surface branch from 7b4376b to 16b61b4 Compare June 23, 2026 04:07
@heyitsaamir heyitsaamir force-pushed the remove_activity_sender branch from a9ef9ab to cbadaff Compare June 23, 2026 04:07
@heyitsaamir heyitsaamir force-pushed the reimplement_agentic_api_surface branch from 16b61b4 to 14c6a68 Compare June 23, 2026 04:11
@heyitsaamir heyitsaamir force-pushed the remove_activity_sender branch from cbadaff to f7b9a58 Compare June 23, 2026 04:11
Comment thread packages/apps/src/microsoft_teams/apps/activity_send.py

@corinagum corinagum left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@heyitsaamir heyitsaamir force-pushed the reimplement_agentic_api_surface branch from 14c6a68 to 5a364f3 Compare June 24, 2026 00:35
@heyitsaamir heyitsaamir force-pushed the remove_activity_sender branch from f7b9a58 to e874de7 Compare June 24, 2026 00:35
@heyitsaamir heyitsaamir force-pushed the reimplement_agentic_api_surface branch from 5a364f3 to 9f395c9 Compare June 24, 2026 00:43
@heyitsaamir heyitsaamir force-pushed the remove_activity_sender branch from e874de7 to e4f974b Compare June 24, 2026 00:43
@heyitsaamir heyitsaamir force-pushed the reimplement_agentic_api_surface branch from 9f395c9 to 84bccbd Compare June 24, 2026 05:30
@heyitsaamir heyitsaamir force-pushed the remove_activity_sender branch from e4f974b to fd063c1 Compare June 24, 2026 05:31
Base automatically changed from reimplement_agentic_api_surface to feature_agent365_support June 24, 2026 05:52
@heyitsaamir heyitsaamir force-pushed the remove_activity_sender branch from fd063c1 to 408095b Compare June 24, 2026 05:55
@heyitsaamir heyitsaamir merged commit 5ce920a into feature_agent365_support Jun 24, 2026
9 checks passed
@heyitsaamir heyitsaamir deleted the remove_activity_sender branch June 24, 2026 17:02
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.

5 participants