[dotnet-code] Refactor Copilot session event dispatch#393
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Refactors Copilot session event handling in copilotagent by extracting the event-to-ResponseUpdate conversion logic into a dedicated helper, keeping the run loop focused on queueing/yielding updates and termination/error handling.
Changes:
- Extracted the session event
switchfromrunintoresponseUpdateForSessionEvent. - Standardized event dispatch to return
(update, done, err)for simpler control flow in the main loop.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Cross-Repo Consistency Review — No Parity IssuesThis PR is an internal refactor only. The change extracts the No exported Go APIs, option types, or observable runtime behavior were changed. This refactoring is equivalent to moving private implementation details in .NET or Python, which carries no cross-SDK parity concern. ✅ No cross-repo consistency issues to report.
|
This pull request refactors how session events are handled in the
copilotagentprovider by extracting the event-to-update logic into a new helper method. This makes the code easier to maintain and read by reducing the complexity of the mainrunloop.Refactoring and Code Organization:
copilot.SessionEventtypes from the mainrunmethod into a new helper methodresponseUpdateForSessionEvent, which returns the appropriateResponseUpdate, adoneflag, and an error if present. [1] [2]runmethod by replacing the inline switch-case with a single call toresponseUpdateForSessionEvent.This change improves code readability and makes it easier to add or modify session event handling in the future.