-
Notifications
You must be signed in to change notification settings - Fork 342
mcp: improve http transports error handling and make transport work with any size message #734
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -1859,7 +1859,17 @@ func (c *streamableClientConn) processStream(ctx context.Context, requestSummary | |||||||
| if ctx.Err() != nil { | ||||||||
| return "", 0, true // don't reconnect: client cancelled | ||||||||
| } | ||||||||
| break | ||||||||
|
|
||||||||
| // Malformed events are hard errors that indicate corrupted data or protocol // violations. These should fail the connection permanently. | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| if errors.Is(err, errMalformedEvent) { | ||||||||
| c.fail(fmt.Errorf("%s: %v", requestSummary, err)) | ||||||||
| return "", 0, true | ||||||||
| } | ||||||||
|
|
||||||||
| // Network/I/O errors during reading should trigger reconnection, not permanent failure. | ||||||||
| // Return from processStream so handleSSE can attempt to reconnect. | ||||||||
| c.logger.Debug(fmt.Sprintf("%s: stream read error (will attempt reconnect): %v", requestSummary, err)) | ||||||||
| return lastEventID, reconnectDelay, false | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FWIW, I think we actually need to be more subtle than this: a malformed event is a hard error, and different from a reader error.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. did some adaptaptation. let me know WDYT |
||||||||
| } | ||||||||
|
|
||||||||
| if evt.ID != "" { | ||||||||
|
|
||||||||
Uh oh!
There was an error while loading. Please reload this page.