Fix HTTP fallback error handling - #1791
Merged
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9dcceff1-25f3-43bb-bb01-8c26c0515c97
halter73
reviewed
Aug 5, 2026
luisangelrod
approved these changes
Aug 25, 2026
luisangelrod
left a comment
Contributor
There was a problem hiding this comment.
I reviewed the transport adoption and fallback split together with the new regression coverage. The behavior is consistent across direct Streamable HTTP and AutoDetect: structured 400 responses reach the protocol fallback policy, while structured non-400 HTTP failures preserve their status and body without attempting deprecated SSE fallback.
I also reproduced the focused test matrix locally on Windows with .NET SDK 10.0.203:
- July2026ProtocolFallbackTests: 20 passed on net472, net8.0, net9.0, and net10.0
- July2026ProtocolHttpFallbackTests: 8 passed on net8.0, net9.0, and net10.0
I found no additional blocking issues beyond the existing maintainer design discussion.
Disclosure: Drafted with AI assistance. I reviewed the diff and ran the tests reported above.
halter73
approved these changes
Sep 3, 2026
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.
Structured HTTP 400 responses containing non-modern JSON-RPC errors now fall back from
server/discovertoinitializefor both Streamable HTTP and AutoDetect.AutoDetect now preserves HTTP semantics for structured non-modern JSON-RPC errors returned with non-400 statuses such as 401, 403, and 500. These responses remain
HttpRequestExceptions with their status and body, without attemptinginitializeor deprecated SSE fallback. Streamable HTTP and AutoDetect share the same status/error-code classification so their behavior remains consistent.The first fix is intentionally simple despite the architectural alternatives discussed in #1790. #1692 initially added a local transport validation exception when a modern response carried
Mcp-Session-Id, together with a catch that prevented fallback for that exception. A later commit in the same PR updated the spec behavior to ignore unexpected session IDs and removed the local exception, but inadvertently left the catch behind. Removing that stale catch restores the intended fallback behavior; no provenance architecture or exception subclass is needed.Validation:
dotnet build --nologopassed.July2026ProtocolFallbackTests: 20/20 passed on net472, net8.0, net9.0, and net10.0.July2026ProtocolHttpFallbackTests: 8/8 passed on net8.0, net9.0, and net10.0.fs.globSync; this was not a code regression.Fixes #1790
Note
This pull request description was drafted with GitHub Copilot.