Repository navigation
fix: keep HTTP client handler exception details local - #664
Merged
koic merged 1 commit intoNov 7, 2026
Merged
Conversation
atesgoral
force-pushed
the
fix/http-client-handler-error-echo
branch
from
November 6, 2026 06:38
a0be545 to
d954129
Compare
atesgoral
marked this pull request as ready for review
November 6, 2026 06:46
atesgoral
marked this pull request as draft
November 6, 2026 07:54
atesgoral
force-pushed
the
fix/http-client-handler-error-echo
branch
from
November 6, 2026 13:58
d954129 to
d49394f
Compare
atesgoral
marked this pull request as ready for review
November 6, 2026 14:16
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.
Motivation and Context
When an HTTP server-request handler raised an unexpected exception, the client sent the exception message back to the server. Messages can hold local paths and other application details that the server should not receive. The client now sends
-32603,Internal error, and writes the exception class and quoted, escaped message to local stderr.String#dumpkeeps control characters from creating or recoloring log lines. ExplicitServerRequestErrorresponses are unchanged. This matches the server-side fix in #486. I used stderr instead of a new reporter callback to keep the transport API unchanged.Fixes #660.
How Has This Been Tested?
test/mcp/client/http_test.rb. The regression expects an exact generic error body instead of the handler's message. The handler raises server-request text containing a newline and a terminal escape sequence; stderr must keep that text quoted and escaped on one line. The changed regression fails on the previous PR head because it writes the control characters raw. It passes with this change, including under Rake's-W0 -W:deprecatedflags.The HTTP client test file passes (143 runs, 432 assertions), and so does the full suite (2,500 runs, 8,266 assertions). RuboCop is clean on the changed files.
Breaking Changes
None. Responses to unexpected handler exceptions carry a generic message instead of the exception text. Intended
ServerRequestErrorreplies are unchanged.Types of changes
Checklist