Skip to content

Conversation

@showpune
Copy link
Contributor

This pull request updates the way session events are handled and tested in the .NET client, focusing on improving type safety and expanding test coverage for session event subscriptions.

Session Event Handling Improvements:

  • Changed the SessionEventNotification.Event property from JToken? to JsonElement? for better type safety and consistency in event deserialization.
  • Updated the OnSessionEvent RPC handler to accept a string sessionId and JsonElement? @event instead of a SessionEventNotification object, and adjusted the event parsing logic accordingly.

Test Enhancements:

  • Added a new test Should_SessionEvt_Subscribed in SessionTests.cs to verify that session event subscriptions work as expected, ensuring that user, assistant, and idle events are received during a session.

Copilot AI review requested due to automatic review settings January 15, 2026 07:56
@showpune showpune requested a review from a team as a code owner January 15, 2026 07:56
Copy link

Copilot AI left a 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 pull request modernizes session event handling in the .NET client by migrating from Newtonsoft.Json's JToken to System.Text.Json's JsonElement, improving type safety and consistency across the codebase. It also adds comprehensive test coverage for session event subscriptions.

Changes:

  • Replaced JToken with JsonElement for event deserialization to align with the System.Text.Json serialization stack
  • Refactored the RPC handler to accept individual parameters instead of a notification object
  • Added test coverage for session event subscriptions to verify proper handling of user, assistant, and idle events

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
dotnet/src/Client.cs Updated OnSessionEvent RPC handler to use individual parameters and changed SessionEventNotification to use JsonElement instead of JToken
dotnet/test/SessionTests.cs Added Should_SessionEvt_Subscribed test to verify session event subscription functionality

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@showpune showpune changed the title Fix the event sub Fix the event subscription in dotnet Jan 15, 2026
Copy link
Contributor

@SteveSandersonMS SteveSandersonMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks @showpune! This is great.

I've triggered a separate run of the E2E tests for this, and it passed. The run associated with this PR failed due to a config issue with secrets, but that's unrelated to the content of this PR, so I'm merging anyway.

@SteveSandersonMS SteveSandersonMS added this pull request to the merge queue Jan 15, 2026
Merged via the queue into github:main with commit b16d752 Jan 15, 2026
15 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants