channel check changes needed for M365Copilot#208
Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request enhances the streaming response logic for channel detection and activity metadata. The changes make channel identification more flexible by using substring matching instead of exact equality, and enrich streaming entities with stream tracking information.
Key changes:
- Modified channel detection to use substring checks instead of strict equality for both MS Teams and Direct Line channels
- Added
stream_idfield to the Entity object for improved stream tracking metadata
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...-agents-hosting-aiohttp/microsoft_agents/hosting/aiohttp/app/streaming/streaming_response.py
Outdated
Show resolved
Hide resolved
...-agents-hosting-aiohttp/microsoft_agents/hosting/aiohttp/app/streaming/streaming_response.py
Outdated
Show resolved
Hide resolved
...-agents-hosting-aiohttp/microsoft_agents/hosting/aiohttp/app/streaming/streaming_response.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
libraries/microsoft-agents-hosting-aiohttp/microsoft_agents/hosting/aiohttp/app/streaming/streaming_response.py:337
- Inconsistent channel_id comparison pattern. This line should be updated to use
.channelproperty like the other comparisons in this file (lines 253 and 256). It should be:Channels.ms_teams == self._context.activity.channel_id.channel
and self._context.activity.channel_id == Channels.ms_teams
libraries/microsoft-agents-hosting-aiohttp/microsoft_agents/hosting/aiohttp/app/streaming/streaming_response.py:302
- The streaming Entity (lines 300-302) is missing the
stream_idparameter, while the final Entity (lines 286-289) now includes it. For consistency and to ensure proper stream tracking, consider addingstream_id=self._stream_idto the streaming Entity as well, similar to the final Entity.
type="streaminfo",
stream_type="streaming",
stream_sequence=self._sequence_number,
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
* channel check changes needed for M365Copilot * improving main channel check syntax
This pull request introduces improvements to the streaming response logic for channel detection and activity creation in
streaming_response.py. The main changes focus on making channel identification more flexible and enhancing the metadata included in streaming entities.Streaming channel detection:
_set_defaultsto use substring checks (in) instead of strict equality forchannel_id, making channel detection more robust for both MS Teams and Direct Line channels.Activity entity enrichment:
stream_idfield to theEntityobject when creating an activity, providing additional metadata for stream tracking.