[#535] StreamingResponse: mutating the finalized "final" stream activity (delete or update) after end_stream() re-hangs the Teams client's typing/streaming indicator - #570
Conversation
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The new delete-mutation test uses a raw activity-id string instead of the ConversationReference that TurnContext.delete_activity() actually emits to handlers, reducing the test’s fidelity and risking masked regressions.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This pull request updates the TypingIndicator in microsoft-agents-hosting-core to stop its background typing loop not only when outgoing activities are sent, but also when activities are updated or deleted—addressing a Teams-specific scenario where mutating a finalized streamed activity can leave the client’s typing/streaming indicator stuck.
Changes:
- Stop the typing indicator loop when
TurnContext.update_activity(...)is invoked. - Stop the typing indicator loop when
TurnContext.delete_activity(...)is invoked. - Extend typing-indicator tests with a new parameterized test covering update/delete mutation hooks.
File summaries
| File | Description |
|---|---|
| libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/typing_indicator.py | Registers update/delete hooks to stop the typing loop when those mutations occur. |
| tests/hosting_core/app/test_typing_indicator.py | Adds stub hook support and a new test ensuring mutation hooks stop typing before proceeding. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
The changes are small, consistent with existing TurnContext hook patterns, and include targeted tests covering the new stop conditions for update/delete mutations.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Lite
There was a problem hiding this comment.
🟢 Approval recommended
The change is small, aligns with existing TurnContext hook APIs, and is covered by focused unit tests validating the new behavior.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Lite
Fixes #535
Description
This pull request enhances the typing indicator's behavior by ensuring it stops when update or delete activity events occur, not just when send activities are triggered. It introduces new hooks for update and delete activities, updates the stub context in tests to support these hooks, and adds new tests to verify this behavior.
Typing indicator enhancements:
TypingIndicatorto stop the typing indicator loop on update and delete activity events, in addition to existing send activities. (microsoft_agents/hosting/core/app/typing_indicator.py)Testing improvements:
StubTurnContextin tests to supporton_update_activityandon_delete_activityhandlers, allowing tests to simulate these events. (test_typing_indicator.py)test_typing_indicator.py)Testing
Here we can see the issue being reproduced (typing indicator is showing even after the activity was updated)

And here we can see the fix applied.
