-
Notifications
You must be signed in to change notification settings - Fork 275
mcp/streamable: use event store to fix unbounded memory issues #335
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
mcp/streamable: use event store to fix unbounded memory issues #335
Conversation
jba
left a comment
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.
Sorry that this PR is confusing me so much.
I think I need to see the algorithm as a whole, without diffs.
So if you think it is correct after addressing my comments that it is correct, I'll approve and then read it separately.
Sorry I prematurely sent a new commit- not ready for review yet! (The flow is very confusing, I agree) |
This CL utilizes the event store to write outgoing messages and removes the unbounded outgoing data structure. For modelcontextprotocol#190
deda34e to
421f3f7
Compare
421f3f7 to
06a0ab0
Compare
|
Ready for review. The challenge is now with properly yielding the eventstore.After error. So we can either:
We can discuss IRL if that's better. |
|
@jba and I were discussing yesterday, and he also suggested adding something like EventStore.Start. What should it be called though? We could use this to allow customizing the stream id...
|
Sounds good. Latest commit adds the EventStore.Open |
| // Open prepares the event store for a given session. It ensures that the | ||
| // underlying data structure for the sessionID is initialized, making it | ||
| // ready to store event streams. | ||
| Open(_ context.Context, sessionID string, streamID StreamID) error |
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.
Does this need to be called once per session, or once per stream? If the latter, the doc is wrong.
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.
Looks like once per stream.
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.
Done
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.
Maybe we should call this OpenStream or StartStream to make that clearer? I'd be fine with either.
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.
Everything is XXXStream. Append to stream, get messages from stream. The only session method has "Session" in the name. So "Open" is right.
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.
I said that badly. I meant that EventStore.M is about streams unless M explicitly says otherwise.
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.
Also, Open takes a stream ID, so of course it is opening a stream.
9e0114f to
f2bc8b2
Compare
findleyr
left a comment
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.
LGTM, just want to revisit the name 'Open'.
| // Open prepares the event store for a given session. It ensures that the | ||
| // underlying data structure for the sessionID is initialized, making it | ||
| // ready to store event streams. | ||
| Open(_ context.Context, sessionID string, streamID StreamID) error |
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.
Maybe we should call this OpenStream or StartStream to make that clearer? I'd be fine with either.
Not sure I understand. An error from |
Yes Open fixes the unknown case now. |
This CL utilizes the event store to write outgoing messages and removes the unbounded outgoing data structure.
For #190