SIGN IN SIGN UP

fix(release): 0.1.5 — retry thrown network errors with fresh-connection hint

Previously fetchWithRetry() only retried HTTP status responses, so a
thrown ECONNRESET / EPIPE / ETIMEDOUT / Bun proxy upstream error from
Anthropic's Cloudflare frontend bypassed the plugin's retry layer
entirely and surfaced as the red "Connection reset by server [retrying
in Ns attempt #N]" bar in OpenCode.

Changes:
- backoff.ts: add isRetriableNetworkError() classifier with explicit
  AbortError/TimeoutError exclusion and cause-chain walking. Covers
  ECONNRESET, ECONNREFUSED, EPIPE, ETIMEDOUT, UND_ERR_SOCKET, Bun
  proxy upstream reset, socket hang up, and fetch failed messages.
- request/retry.ts: fetchWithRetry() now catches thrown errors from
  doFetch(), classifies them via isRetriableNetworkError, and retries
  with the existing exponential backoff. Exposes a RetryAttemptContext
  so callers receive a forceFreshConnection hint on the retry attempt.
- bun-proxy.ts: honor x-proxy-disable-keepalive header by setting
  keepalive: false and Connection: close on the upstream fetch,
  guaranteeing a fresh socket on retry and bypassing stale pooled
  connections.
- index.ts: wire the initial fetch call through fetchWithRetry with
  the network-error classifier, and pass the forceFreshConnection
  hint through for both the initial retry loop and the pre-existing
  service-wide 500/503/529 retry path.

Tests:
- backoff.test.ts: isRetriableNetworkError classification coverage.
- request/retry.test.ts: thrown ECONNRESET retries with
  fresh-connection hint; user abort errors do not retry.
- bun-proxy.test.ts: forwards retry requests with keepalive disabled.

Verified: bunx vitest run → 36 files / 939 tests pass. bun run build
succeeds. LSP diagnostics clean on all modified files.

Matches Anthropic TS/Python SDK retry semantics and Bun maintainer
guidance (#3632) for stale keepalive pool mitigation. Does not add a
full proxy reset state machine or SSE watchdog — those remain as
follow-up hardening.
V
Vacbo committed
d0026540952c70439c980bdde215df23ce13bacd
Parent: 0412f80