Repository navigation
fix(upstream): stop network errors parking no-auth servers in Pending Auth (#1537) - #1540
Merged
Merged
Conversation
… Auth (#1537) A DNS/dial error quotes addresses and ephemeral ports (e.g. udp :54012), which the substring classifiers read as a "401"/"403". The auth ladder then fell from no-auth into the OAuth strategy, where an empty token store produced ErrOAuthPending, and Pending Auth is never auto-redialed. - core: IsNetworkError (typed DNS/dial/timeout/EOF/*url.Error check; a typed HTTP 401 always wins); runAuthStrategies returns network errors instead of falling into OAuth - core: the ladder records whether an anonymous attempt got a real HTTP 401; a park without one (no oauth block, no stored token) is flagged ErrOAuthPending.Probe - types: PendingAuthProbe parks are re-probed every GaveUpProbeInterval; confirmed parks stay parked (#1013) - managed: network errors take the plain SetError ladder, not the 5m-24h OAuth backoff - notifications: the sign-in prompt fires once per probe-park episode; only Ready (synchronous) ends it Closes #1537
Deploying mcpproxy-docs with
|
| Latest commit: |
00410f0
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1a81288b.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://fix-1537-noauth-pending-auth.mcpproxy-docs.pages.dev |
Contributor
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 37890115527 --repo smart-mcp-proxy/mcpproxy-go
|
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
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.
Fixes #1537. A no-auth streamable-HTTP upstream could be stuck in Pending Auth / "Sign-in required" forever after a network outage. Only a daemon restart cleared it.
Root cause
read udp 192.168.1.20:54012->…:53: i/o timeoutordial tcp 127.0.0.1:14011.isOAuthErrorandisAuthErrorare bare substring matches that include"401"and"403". A DNS or dial failure in the no-auth strategy could therefore be read as an auth challenge, andrunAuthStrategiesfell through to the OAuth strategy.no valid token availablebefore it sends any request.tryOAuthAuththen returnsErrOAuthPending, and the managed client parks the server inStatePendingAuth.ShouldAutoReconnectnever re-dials Pending Auth ([Bug]: Upstream reconnect has no backoff — supervisor re-dials failed servers every 30s forever, hammering dead remotes (~9k req/day) #1013). With no persisted token, the token scan never wakes the server either, so it stays parked permanently.Fix
core.IsNetworkErrorchecks the error's type:net.OpError, any*url.Error(no HTTP response was received), timeouts, ECONNREFUSED/ECONNRESET and EOF.runAuthStrategiesreturns network errors directly instead of falling through to OAuth.managed.Client.Connectsends network errors to plainSetError. Previously a401/403in the error text could put them on the 5 min – 24 h OAuth backoff.oauthblock, no stored token and no 401 setsErrOAuthPending.Probe, which becomesConnectionInfo.PendingAuthProbe.GaveUpProbeInterval(30 min).oauthblock, or a stored token) stay parked exactly as before.Readyends an episode, becauseSetError's callback runs asynchronously.Tests
TestIsNetworkError401in the port and a refused dial on port40312must not reach OAuth.127.0.0.1:1401xmust not becomeErrOAuthPending. This test failed before the fix.Connecttests:StateError, not on the OAuth backoff.unauthorizedwithout a 401: probe park.ShouldAutoReconnectprobe table andSetPendingAuthProbe.Regression guards still pass: #464 (strategy-name substring), #1271 (an
oauthblock means OAuth only), and #1013 (no re-dial storm for confirmed parks).Verification
go test -racepasses oninternal/upstream/...andinternal/runtime/....-tags serverrace subset passes.scripts/test-api-e2e.sh: 70/70.--build-tags server): no new issues compared with main.pending auth— "Sign-in required"pending auth5+ min latererror— "Connection refused"ready, 2 tools, within 30 s