Environment
microsoft-agents-hosting-core 1.3.0 (also confirmed present on main/1.4.0-dev — the relevant streaming_response.py code is byte-identical between our installed 1.3.0 and the current main branch, so this is not fixed in the unreleased version either)
- Python 3.12, Teams personal chat channel
Summary
When a StreamingResponse finishes via end_stream(), it sends a final Activity(type="message", entities=[StreamInfo(stream_type="final", ...)]), whose activity.id is the stream's _stream_id (assigned from the first typing activity's response.id). If that same activity is later mutated — via either TurnContext.delete_activity(activity_id) or TurnContext.update_activity(activity) — the Teams client's streaming/typing indicator hangs indefinitely, even though a real message has already been delivered to the user. This happens even when the mutation occurs well after the stream has ended, from a separate proactive continuation.
Repro scenario
- Handle a Teams message with a streamed response:
queue_informative_update() → queue_text_chunk() × N → end_stream(). Capture the resulting activity id (streamer._stream_id, since the public stream_id property was removed).
- In a scenario where the full answer isn't ready within Teams' streaming window, deliver the rest of the answer later via a separate proactive turn (
adapter.continue_conversation(...)), and either:
- a)
await context.delete_activity(saved_stream_activity_id), or
- b)
await context.update_activity(new_activity_with_id=saved_stream_activity_id)
...to clean up or replace the "please wait" placeholder text.
- Observe the Teams client: the typing/streaming indicator remains stuck/hanging, even though the conversation already shows a completed message.
Expected
Mutating a previously finalized stream activity via the standard TurnContext.delete_activity/update_activity APIs shouldn't affect client-side streaming state after the stream has already ended (end_stream() already sent the stream_type="final" marker).
Actual
The Teams client appears to tie its streaming-in-progress UI state to that specific activity's content/existence persisting unchanged. Any later mutation — delete or edit — re-triggers/orphans that state, and the indicator never clears.
Workaround in use
Leave the finalized stream activity completely untouched after end_stream(). Confirmed via testing that both "delete" and "edit" trigger the hang, while "leave untouched" does not.
What I checked before filing
changelog.md (v1.4.0 Unreleased section), Context7 docs for /microsoft/agents-for-python, and GitHub issue/PR search for StreamingResponse, typing indicator, end_stream, delete_activity — found #397/#398 (a different, already-fixed issue about the generic per-turn TypingIndicator/TypingOptions mechanism, unrelated to StreamingResponse), but nothing addressing this specific scenario.
Environment
microsoft-agents-hosting-core1.3.0 (also confirmed present onmain/1.4.0-dev — the relevantstreaming_response.pycode is byte-identical between our installed 1.3.0 and the currentmainbranch, so this is not fixed in the unreleased version either)Summary
When a
StreamingResponsefinishes viaend_stream(), it sends a finalActivity(type="message", entities=[StreamInfo(stream_type="final", ...)]), whoseactivity.idis the stream's_stream_id(assigned from the first typing activity'sresponse.id). If that same activity is later mutated — via eitherTurnContext.delete_activity(activity_id)orTurnContext.update_activity(activity)— the Teams client's streaming/typing indicator hangs indefinitely, even though a real message has already been delivered to the user. This happens even when the mutation occurs well after the stream has ended, from a separate proactive continuation.Repro scenario
queue_informative_update()→queue_text_chunk()× N →end_stream(). Capture the resulting activity id (streamer._stream_id, since the publicstream_idproperty was removed).adapter.continue_conversation(...)), and either:await context.delete_activity(saved_stream_activity_id), orawait context.update_activity(new_activity_with_id=saved_stream_activity_id)...to clean up or replace the "please wait" placeholder text.
Expected
Mutating a previously finalized stream activity via the standard
TurnContext.delete_activity/update_activityAPIs shouldn't affect client-side streaming state after the stream has already ended (end_stream()already sent thestream_type="final"marker).Actual
The Teams client appears to tie its streaming-in-progress UI state to that specific activity's content/existence persisting unchanged. Any later mutation — delete or edit — re-triggers/orphans that state, and the indicator never clears.
Workaround in use
Leave the finalized stream activity completely untouched after
end_stream(). Confirmed via testing that both "delete" and "edit" trigger the hang, while "leave untouched" does not.What I checked before filing
changelog.md(v1.4.0 Unreleased section), Context7 docs for/microsoft/agents-for-python, and GitHub issue/PR search forStreamingResponse,typing indicator,end_stream,delete_activity— found #397/#398 (a different, already-fixed issue about the generic per-turnTypingIndicator/TypingOptionsmechanism, unrelated toStreamingResponse), but nothing addressing this specific scenario.