From d792088bb6bf452de0a8b3bdbc71b47ff64a72a2 Mon Sep 17 00:00:00 2001 From: gerarecipe Date: Wed, 18 Nov 2026 21:28:27 +0100 Subject: [PATCH] fix(proxy): do not probe a proxy after a client-canceled request A request the client abandons ends with context.Canceled and no HTTP response. syncProxyResult still started a confirming health check for it, on a context without cancellation, and since #111 any failed check marks the proxy unavailable and moves its keys. A canceled request says nothing about the proxy; checkClaimedProxy already exempts context.Canceled for the same reason. Skip the confirming probe for it. Co-Authored-By: Claude Opus 5.5 --- internal/gateway/refresh.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/gateway/refresh.go b/internal/gateway/refresh.go index 3e284e53..4136bafa 100644 --- a/internal/gateway/refresh.go +++ b/internal/gateway/refresh.go @@ -49,6 +49,15 @@ func (g *Gateway) syncProxyResult(ctx context.Context, proxy *proxyTransport, st return true } if err != nil { + // A client that went away says nothing about the proxy: the request + // ended without a response because it was abandoned, not because the + // tunnel broke. checkClaimedProxy exempts context.Canceled for the same + // reason; do not start a confirming probe here either. That probe runs + // on a context without cancellation, and a probe failing for an + // unrelated reason would evict a proxy that never failed. + if errors.Is(err, context.Canceled) { + return false + } g.verifyProxyAfterError(ctx, proxy, "upstream request error", status) return false }