variants: redirect inner server sending methods to fix dropping notifications in stateless mode#7
Open
StevenRChen wants to merge 7 commits intomainfrom
Open
variants: redirect inner server sending methods to fix dropping notifications in stateless mode#7StevenRChen wants to merge 7 commits intomainfrom
StevenRChen wants to merge 7 commits intomainfrom
Conversation
611dcbf to
a1c6e49
Compare
Add support for elicit, sampling and list roots, add integration test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Registers a sending middleware on each inner server that intercepts all outgoing messages and routes them through the front session using a session-swapped request wrapper. Replaces the previous proxy client handler approach which dropped log messages in stateless mode.
Motivation and Context
Tool handlers in variant servers use req.Session (the inner session) to send notifications. Previously, log messages were silently dropped in stateless mode because the inner session is not aware of the front session.
This change injects the sendingMethodHandler from the frontSession into the context and adds a sending middleware to redirect all sending requests to the frontSession handler directly.
A few considerations in this implementation:
Requestnot one that tied to specific function. Based on the current SDK implementation this is unlikely to change.How Has This Been Tested?
TestNotificationDelivery — verifies progress and log messages arrive at the front clients with multiple clients making concurrent request.
New tests added for context preservation that was added in #6. Context preservation is required to make the notification forwarding work anyway. Since we use the context to carry frontSession handler to the backend session.
All existing tests pass
Breaking Changes
None. Tool handlers continue to use req.Session normally.
Types of changes
Bug fix (non-breaking change which fixes an issue)