mirror of
https://github.com/jasonxu114514/opencode2api.git
synced 2026-12-05 08:02:53 +00:00
checkClaimedProxy() only marked a proxy unhealthy when the probe error was a timeout or ECONNREFUSED (isProxyFailure). A proxy that answers the CONNECT with its own error -- e.g. a provider refusing because the plan's bandwidth is exhausted -- produced an error matching none of those cases, so the probe was reported as inconclusive and the proxy stayed healthy forever: never taken out of rotation and never re-bound for key traffic. A probe is a plain HTTP GET issued through the proxy; if it returns no response, that proxy cannot serve traffic, whatever the reason. Count every non-cancellation error as a failure. context.Canceled stays exempt because it says the caller gave up, not that the proxy is down. Scope: the probe path only. syncProxyResult() (real traffic) and the anonymous attempt loop keep using isProxyFailure deliberately -- there an error may come from the upstream rather than the proxy, so staying conservative is correct. Co-authored-by: WengeLiu101 <233876084+WengeLiu101@users.noreply.github.com>