Repository navigation
Description
Context
#1013 asked for three things on the upstream reconnect path. #1014 landed exponential backoff in the supervisor's reconcile, and #1039 closes the OAuth-error hole in that gate plus real PendingAuth parking. The third ask is still open:
Honor
Retry-Afterwhen the upstream answers 429 (the OAuth resource-detect path already parses hints; connect retries should too).
Why it can't be done in the backoff layer
The 429 response never reaches us as a response. mcp-go flattens every non-2xx into a string:
// client/transport/streamable_http.go
return nil, fmt.Errorf("request failed with status %d: %s", resp.StatusCode, body)so managed.Client.Connect sees text, and the Retry-After header is gone before any state-manager code runs. internal/oauth/config.go can parse it only because the OAuth resource-detect path issues its own http.Do and holds the *http.Response.
Sketch
- A
RetryAfterRecorderhttp.RoundTripperininternal/transport(next toLoggingTransport) that recordsRetry-After(RFC 7231 seconds and HTTP-date, likeinternal/oauth/config.go:379-440already does) on a 429, keyed per upstream. - Thread it into every client-construction branch in
CreateHTTPClient/CreateSSEClient. Two branches already build anhttp.Client; the plain streamable-HTTP branches needWithHTTPBasicClient(preserving today's 180s timeout and SSE's deliberately absentTimeout); the twoclient.NewOAuth*Clientbranches build their own client insidemcp-goand needOAuthConfig.HTTPClientverified to cover transport requests, not just the OAuth ones. - Surface the hint (e.g.
ConnectionInfo.RetryAfter time.Time, set alongside the connect error) and treat it as a floor inConnectionInfo.ShouldAutoReconnect— the one gate the supervisor consults.
Blast radius
Step 2 changes the transport for all upstream HTTP traffic, tool calls included — not just connect. That is why it was kept out of #1039: it needs its own testing pass (SSE long-lived streams and connection pooling in particular), and the storm risk is bounded meanwhile. After #1039 a 429-ing upstream is paced 1s → … → 5min, then one probe per 30min, so the worst case is ~48 requests/day rather than the ~2880 that started #1013. Honoring the header matters for the case where the vendor asks for a wait longer than that.
Acceptance
- A 429 with
Retry-After: 3600during connect parks the server for an hour; the supervisor's reconcile plans noActionConnectin that window. - Both
Retry-Afterforms parse (delta-seconds and HTTP-date); a malformed value falls back to the existing ladder. - Coverage/limitations of the mcp-go-built OAuth client paths documented in the PR.
Activity
fix(upstream): scope the Retry-After window to its attempt and gate t…
fix(upstream): make the 429 sync reachable from the request paths and…
feat(upstream): honor Retry-After on 429 via transport RoundTripper (#…
chore(roadmap): sync statuses — QA-gate T2 done, mcp-2026 unblocked, …
fix(upstream): stop retrying deterministic connection failures forever (
fix(upstream): reconnect remote servers as soon as the network returns (