Skip to content

Delegating expect replies handling to adapter layer, fixing previous TypingIndicator issue - #556

Draft
Rodrigo Brandão (rodrigobr-msft) wants to merge 1 commit into
mainfrom
users/robrandao/expect-replies-sender
Draft

Delegating expect replies handling to adapter layer, fixing previous TypingIndicator issue#556
Rodrigo Brandão (rodrigobr-msft) wants to merge 1 commit into
mainfrom
users/robrandao/expect-replies-sender

Conversation

@rodrigobr-msft

Copy link
Copy Markdown
Contributor

This pull request refactors how activities are buffered and sent when using the expect_replies delivery mode in the Microsoft Agents Hosting Core library. The main change is to centralize the logic for buffering activities in the ChannelServiceAdapter, simplifying the TurnContext implementation and ensuring more consistent behavior. Additionally, a new test is added to verify the correct handling of buffered activities when no connector client is present.

Refactoring and logic centralization:

  • Moved the logic for buffering activities with DeliveryModes.expect_replies from TurnContext to ChannelServiceAdapter, ensuring that activities are properly buffered and appended to context.buffered_reply_activities only in the adapter. This removes duplicate logic and prevents circular dependencies. [1] [2] [3] [4]

  • Cleaned up imports and removed unused or redundant constants and comments in turn_context.py, further simplifying the codebase. [1] [2] [3]

Testing improvements:

  • Added a new test case to verify that activities are buffered correctly when using expect_replies delivery mode and no ConnectorClientBase is present, ensuring the new logic works as intended. [1] [2]

Type hint consistency:

  • Minor type hint update in the TypingIndicator context manager for consistency.

Copilot AI lite review requested due to automatic review settings August 21, 2026 19:21

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 pull request centralizes expect_replies buffering in ChannelServiceAdapter, simplifies TurnContext, and updates TypingIndicator typing.

Changes:

  • Centralized activity buffering and invoke-response handling.
  • Added coverage for buffering without a connector client.
  • Updated the TypingIndicator context-manager annotation.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Summary
tests/hosting_core/test_channel_service_adapter.py Tests expected-replies buffering without a connector.
libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/turn_context.py Removes duplicated buffering logic and constants.
libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/channel_service_adapter.py Implements centralized activity buffering.
libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/typing_indicator.py Updates the async context-manager return annotation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

2 participants