Skip to content

[#535] StreamingResponse: mutating the finalized "final" stream activity (delete or update) after end_stream() re-hangs the Teams client's typing/streaming indicator - #570

Merged
Rodrigo Brandão (rodrigobr-msft) merged 5 commits into
mainfrom
southworks/fix/typing-indicator-on-update
Sep 4, 2026
Merged

[#535] StreamingResponse: mutating the finalized "final" stream activity (delete or update) after end_stream() re-hangs the Teams client's typing/streaming indicator#570
Rodrigo Brandão (rodrigobr-msft) merged 5 commits into
mainfrom
southworks/fix/typing-indicator-on-update

Conversation

@ceciliaavila

Copy link
Copy Markdown
Collaborator

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:

  • Added handlers in TypingIndicator to 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:

  • Updated StubTurnContext in tests to support on_update_activity and on_delete_activity handlers, allowing tests to simulate these events. (test_typing_indicator.py)
  • Added new parameterized tests to verify that update and delete operations correctly stop the typing indicator before proceeding with the mutation. (test_typing_indicator.py)

Testing

Here we can see the issue being reproduced (typing indicator is showing even after the activity was updated)
Reproduced

And here we can see the fix applied.
Fixed

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 3, 2026 12:53

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.

🟡 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.

Comment thread tests/hosting_core/app/test_typing_indicator.py
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 3, 2026 13:01

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.

🟢 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

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.

🟢 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

@rodrigobr-msft
Rodrigo Brandão (rodrigobr-msft) merged commit e5acb89 into main Sep 4, 2026
10 of 11 checks passed
@rodrigobr-msft
Rodrigo Brandão (rodrigobr-msft) deleted the southworks/fix/typing-indicator-on-update branch September 4, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants