Delegating expect replies handling to adapter layer, fixing previous TypingIndicator issue - #556
Draft
Rodrigo Brandão (rodrigobr-msft) wants to merge 1 commit into
Draft
Conversation
…issue with TypingIndicators
Copilot started reviewing on behalf of
Rodrigo Brandão (rodrigobr-msft)
August 21, 2026 19:23
View session
Contributor
There was a problem hiding this comment.
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
TypingIndicatorcontext-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.
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.
This pull request refactors how activities are buffered and sent when using the
expect_repliesdelivery mode in the Microsoft Agents Hosting Core library. The main change is to centralize the logic for buffering activities in theChannelServiceAdapter, simplifying theTurnContextimplementation 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_repliesfromTurnContexttoChannelServiceAdapter, ensuring that activities are properly buffered and appended tocontext.buffered_reply_activitiesonly 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:
expect_repliesdelivery mode and noConnectorClientBaseis present, ensuring the new logic works as intended. [1] [2]Type hint consistency:
TypingIndicatorcontext manager for consistency.