Conversation
…revent startup failures Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/b3a7a4cf-4e3a-41da-90f0-b7c5624d2a27 Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
…name variable Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/b3a7a4cf-4e3a-41da-90f0-b7c5624d2a27 Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix HTTP MCP server error state on startup
fix: disable standalone SSE stream in streamable HTTP transport to prevent HTTP MCP server startup failures
Apr 23, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Disables the SDK’s standalone SSE GET stream (and implicit retries) for streamable HTTP transports to prevent MCP HTTP backends from causing gateway startup/connect failures, and adds a regression test for the failure mode.
Changes:
- Configure
sdk.StreamableClientTransportwithDisableStandaloneSSE: trueandMaxRetries: -1on initial connect. - Apply the same streamable transport configuration during SDK transport reconnects.
- Add a regression test ensuring no SSE GET is issued when the server would error on GET.
Show a summary per file
| File | Description |
|---|---|
| internal/mcp/http_transport.go | Disables standalone SSE and SDK retries for streamable HTTP transport creation. |
| internal/mcp/connection.go | Ensures reconnect path uses the same streamable transport settings (no SSE GET, no retries). |
| internal/mcp/http_connection_test.go | Adds regression test asserting streamable connect succeeds without issuing any GET requests. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 1
Comment on lines
+599
to
+607
| getMethodCount := 0 | ||
|
|
||
| testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | ||
| if r.Method == http.MethodGet { | ||
| // Simulate a server that returns 500 for the SSE GET stream. | ||
| // Before the fix this would call c.fail() and break the connection; | ||
| // after the fix the GET is never issued. | ||
| getMethodCount++ | ||
| w.WriteHeader(http.StatusInternalServerError) |
Collaborator
|
@copilot address this review feedback #4428 (review) |
Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/cc87c7cf-5340-4ef1-bedc-58d9feaffc20 Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Contributor
Author
Fixed in fc18b1e — replaced the plain |
This was referenced Apr 23, 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.
HTTP MCP servers (e.g. Unwrap) show
status: errorat gateway startup and advertise no tools to Copilot CLI, despite the endpoint being reachable.Root cause
The SDK's
StreamableClientTransportautomatically issues a GET request for a persistent SSE stream synchronously insideclient.Connect(), immediately after theinitializePOST succeeds:initialize→ server responds ✓sessionUpdated()→connectStandaloneSSE()→ GET requestc.fail()marks connection as brokenclient.Connect()tries to sendinitializednotification →c.Write()sees failure → returns errorrecordError()→/healthreportsstatus: errorAdditionally,
MaxRetries: 0in the SDK defaults to 5 retries, not 0, contrary to the existing comment.Changes
internal/mcp/http_transport.go/connection.go: SetDisableStandaloneSSE: trueandMaxRetries: -1onStreamableClientTransportin bothtryStreamableHTTPTransportandreconnectSDKTransport. The gateway is a request-response proxy and has no use for server-initiated SSE notifications from backends.internal/mcp/http_connection_test.go: Adds regression testTestNewHTTPConnection_StreamableTransport_BadSSEEndpoint— server returns valid initialize result for POST but 500 for GET; connection must succeed via streamable transport with zero GET requests issued.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.com/tmp/go-build900524329/b513/launcher.test /tmp/go-build900524329/b513/launcher.test -test.testlogfile=/tmp/go-build900524329/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build900524329/b410/vet.cfg g_.a o_.o x_amd64/vet 01.o roundrobin 03.o x_amd64/vet -W wkO_kTNLT .cfg x_amd64/vet . --gdwarf2 --64 x_amd64/vet(dns block)invalid-host-that-does-not-exist-12345.com/tmp/go-build900524329/b495/config.test /tmp/go-build900524329/b495/config.test -test.testlogfile=/tmp/go-build900524329/b495/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build900524329/b399/vet.cfg g_.a 9742532/b151/ x_amd64/vet --gdwarf-5 grpcsync p=/opt/hostedtoolcache/go/1.25.9/tmp/go-build511290287/b107/vet.cfg x_amd64/vet -W ABSZSCNGR .cfg x_amd64/vet . --gdwarf2 --64 x_amd64/vet(dns block)nonexistent.local/tmp/go-build900524329/b513/launcher.test /tmp/go-build900524329/b513/launcher.test -test.testlogfile=/tmp/go-build900524329/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build900524329/b410/vet.cfg g_.a o_.o x_amd64/vet 01.o roundrobin 03.o x_amd64/vet -W wkO_kTNLT .cfg x_amd64/vet . --gdwarf2 --64 x_amd64/vet(dns block)slow.example.com/tmp/go-build900524329/b513/launcher.test /tmp/go-build900524329/b513/launcher.test -test.testlogfile=/tmp/go-build900524329/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build900524329/b410/vet.cfg g_.a o_.o x_amd64/vet 01.o roundrobin 03.o x_amd64/vet -W wkO_kTNLT .cfg x_amd64/vet . --gdwarf2 --64 x_amd64/vet(dns block)this-host-does-not-exist-12345.com/tmp/go-build3852249779/b001/mcp.test /tmp/go-build3852249779/b001/mcp.test -test.testlogfile=/tmp/go-build3852249779/b001/testlog.txt -test.paniconexit0 -test.run=TestNewHTTPConnection|TestHTTPConnection -test.v=true -test.timeout=1m0s 0/internal/tracetransform/instrumentation.go x_amd64/compile OUTPUT 9742532/b015/ 168.63.129.16 x_amd64/compile -w p/go-build security 64=/_/GOROOT OUTPUT 64/src/runtime/c-unsafeptr=false 168.63.129.16 git(dns block)/tmp/go-build900524329/b522/mcp.test /tmp/go-build900524329/b522/mcp.test -test.testlogfile=/tmp/go-build900524329/b522/testlog.txt -test.paniconexit0 -test.timeout=10m0s 9742�� olang.org/protob-errorsas .cfg x_amd64/vet --gdwarf-5 --64 -o x_amd64/vet -o 9742532/b408/_pk-s -trimpath x_amd64/vet -p g/grpc/binarylog/usr/bin/runc -lang=go1.25 x_amd64/vet(dns block)/tmp/go-build3289280713/b001/mcp.test /tmp/go-build3289280713/b001/mcp.test -test.testlogfile=/tmp/go-build3289280713/b001/testlog.txt -test.paniconexit0 -test.run=TestNewHTTPConnection -test.v=true -test.timeout=1m0s y bin/bash ntime.v2.task/mogit .cfg x_amd64/vet /usr/bin/runc.original --ve�� 30977974af8f49f3088e082efdf88695 runtime-runc/moby /usr/local/bin/iptables io.containerd.ru/bin/sh .cfg x_amd64/vet b83/log.json(dns block)If you need me to access, download, or install something from one of these locations, you can either: