-
Notifications
You must be signed in to change notification settings - Fork 65
StreamingResponse.EndStream returns result #478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR changes the EndStreamAsync method to return a StreamingResponseResult enum instead of throwing exceptions, providing callers with explicit feedback about the streaming operation outcome.
Key Changes:
- Introduced
StreamingResponseResultenum with values: Success, NotStarted, AlreadyEnded, UserCancelled, Timeout, and Error - Modified
EndStreamAsyncto returnTask<StreamingResponseResult>instead ofTask - Added comprehensive test coverage for various streaming scenarios including success, cancellation, fallback, and duplicate end calls
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| IStreamingResponse.cs | Added StreamingResponseResult enum and updated EndStreamAsync signature to return result |
| StreamingResponse.cs | Implemented result-based error handling in EndStreamAsync, added _userCanceled field, and improved error categorization logic |
| StreamingResponseTests.cs | Added new test file with comprehensive coverage of streaming scenarios including success cases, user cancellation, fallback behavior, and duplicate calls |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/libraries/Builder/Microsoft.Agents.Builder/IStreamingResponse.cs
Outdated
Show resolved
Hide resolved
src/libraries/Builder/Microsoft.Agents.Builder/StreamingResponse.cs
Outdated
Show resolved
Hide resolved
src/libraries/Builder/Microsoft.Agents.Builder/StreamingResponse.cs
Outdated
Show resolved
Hide resolved
…nse.cs Co-authored-by: Copilot <[email protected]>
…se.cs Co-authored-by: Copilot <[email protected]>
Fixes #466
For discussion: