feat(client): carry the originating HTTP status in ErrorData.data#3094
Draft
himanshu-commits wants to merge 2 commits into
Draft
feat(client): carry the originating HTTP status in ErrorData.data#3094himanshu-commits wants to merge 2 commits into
himanshu-commits wants to merge 2 commits into
Conversation
A non-2xx POST is synthesized into a JSON-RPC error whose code cannot express
the retry decision: a terminal 401 and a transient 503 both arrive as
INTERNAL_ERROR with the same "Server returned an error response" message. A
caller cannot tell "my token is bad, stop" from "the server hiccuped, retry".
The status now rides along on `error.data` as `{"httpStatus": 503}`. `data` is
free-form per the JSON-RPC spec, so this is additive: nothing that reads `code`
or `message` changes.
An error the server supplied in its body keeps its own `data` untouched — its
account of the failure outranks ours. A non-2xx to a notification has no waiter
to resolve, so it is logged rather than dropped silently.
Requested on modelcontextprotocol#3091 by the reporter, who needs the distinction for retry
classification in a downstream client.
`tests/test_examples.py` pipes every code block in `docs/troubleshooting.md` through ruff, and on Windows that pipe is cp1252, not UTF-8: a `…` in the snippet reached ruff as invalid UTF-8 and failed every Windows job. The character carried no meaning the prose didn't already.
6ef3955 to
eea58dd
Compare
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.
A non-2xx POST is synthesized into a JSON-RPC error whose code cannot express the retry decision: a terminal 401 and a transient 503 both arrive as INTERNAL_ERROR with the same "Server returned an error response" message. A caller cannot tell "my token is bad, stop" from "the server hiccuped, retry".
The status now rides along on
error.dataas{"httpStatus": 503}.datais free-form per the JSON-RPC spec, so this is additive: nothing that readscodeormessagechanges.An error the server supplied in its body keeps its own
datauntouched — its account of the failure outranks ours. A non-2xx to a notification has no waiter to resolve, so it is logged rather than dropped silently.Requested on #3091 by the reporter, who needs the distinction for retry classification in a downstream client.
Motivation and Context
How Has This Been Tested?
Breaking Changes
Types of changes
Checklist
Additional context