fix(antigravity): harden per-credential transport pooling
Review and live-test follow-ups to the shared upstream transport. Bound the cache with an LRU that closes idle connections on eviction, so rotating a credential's proxy or supplying a per-request base transport can no longer leak pools. Stop deriving a pool scope from Auth.Label: it is documented as an optional human readable label for logging and carries no uniqueness guarantee, so two OAuth identities sharing a label would share one TCP/TLS pool. Prefer a refresh-token digest, which stays stable across access-token rotation and is available to refresh requests that run before any access token exists. Replace a typed-nil *http.Transport taken from the request context. It passes the interface nil check, so leaving it in place made http.Client fall back to http.DefaultTransport, which advertises h2 over ALPN and breaks the HTTP/1.1-only fingerprint. Only widen pool limits: treat MaxIdleConns == 0 and IdleConnTimeout == 0 as unlimited, and leave a negative MaxIdleConnsPerHost alone because that is how an operator disables pooling. Size the cache for large deployments. An unused entry costs under 1 KB and no goroutines, whereas evicting a live pool forces a fresh TCP + TLS handshake, so capacity is not the lever for bounding memory.
S
sususu committed
516ec3a0006b8255837db681e5128d42ad72903b
Parent: c33a33e
Committed by sususu98 <33882693+sususu98@users.noreply.github.com>
on 8/11/2026, 10:33:50 AM