Skip to content

fix(proxies): classify refusal cause and hang, add bounded opt-in recovery pass - #14233

Merged
diegosouzapw merged 3 commits into
diegosouzapw:release/v3.8.51from
maxmad64bis:fix/proxy-health-refusal-cause-recovery
Sep 22, 2026
Merged

diegosouzapw merged 3 commits into
diegosouzapw:release/v3.8.51from
maxmad64bis:fix/proxy-health-refusal-cause-recovery

Conversation

@maxmad64bis

@maxmad64bis maxmad64bis commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ base-red inherited: #13866

Summary

A destination refusing the probe was misread as a dead proxy, and refused proxies were never re-tested. This PR carries the refusal cause next to the verdict without touching proxy status, plus an opt-in recovery pass. Defaults: stalled handshakes count like frank failures, unproven 403s stay neutral, recovery off unless PROXY_HEALTH_RECOVERY_ENABLED is set.

Related Issues

Validation

  • Change type: routing
  • Focused tests and category gates from the golden path (25 new/updated proxy-health tests + neighbours (12+7+7), tsc filtered 0, eslint perimeter clean)
  • npm run lint — touched files clean locally; the full run is red on the base (inherited, non-blocking, see Reviewer Notes)
  • Reconciled with the current active release base; focused checks rerun afterward (0 behind, no realignment needed)
  • Production-code changes include a new or updated automated test in this PR

Tests Added Or Updated

  • tests/unit/proxy-health-refusal-cause.test.ts (new, 5): 401/403/429/451 matrix over proven/unproven/absent; 403 without evidence neutral, never mutates.
  • tests/unit/proxy-health-probe-error.test.ts (new, 3): stalled handshake vs plain local abort vs frank connection failure.
  • tests/unit/proxy-health-recovery-plan.test.ts (new, 4): quota-refusal only, drops unreachable (even with 429 observation) and null keys; oldest-first with volume cut.
  • tests/unit/proxy-health-recovery-pass.test.ts (updated, 4): fake probe plus real refusal memory; success lifts, failure doubles recurrence, off means zero probes.
  • tests/unit/proxy-health-recovery-default.test.ts (new, 1): real default path, no injected probe (local 429 relay then 200, real registry/memory).
  • tests/unit/proxy-health-decide-action-6246.test.ts (extended, 8): stalled handshake equals frank failure at/below threshold, opt-ins on/off.
  • Neighbours green (12+7+7); filtered tsc 0, ESLint clean; RED-then-GREEN (new tests failed on missing imports first; default-path RED by stash, GREEN after).

Coverage Notes

  • src/lib/proxyHealth/decision.ts covered by cause/probe-error/decide-action suites; scheduler.ts recovery by plan/pass/default-path suites.
  • No coverage moved down; global tsc OOMs here, so evidence is the filtered run (0 errors).

Reviewer Notes

@maxmad64bis
maxmad64bis force-pushed the fix/proxy-health-refusal-cause-recovery branch from 766b5d8 to 450e2f2 Compare September 20, 2026 00:54
maxmad64bis and others added 2 commits September 22, 2026 06:41
The recovery-pass interval this PR adds is read from process.env, so the
env/docs contract gate (check-env-doc-sync) requires it in .env.example and
docs/reference/ENVIRONMENT.md.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
@diegosouzapw

Copy link
Copy Markdown
Owner

Thanks @maxmad64bis — merging via the release merge-train. Validated in local merge-train (mt-train10c) on the devbox @ train tip 4d841aa1c740bbaa03868dc0a403c62099a99a42 with the 72 sibling PRs of this batch: typecheck:core, file-size, complexity, cognitive-complexity, changelog-integrity green; changed-area node:test 831/831 (0 failing) and vitest 480/482 — the two reds are autoCombo/provider-family-combos.test.ts timing out at 20s, which reproduces on the PURE release tip under the full vitest suite (and is already tracked by the Release-Green issue #13866), so it is inherited, not this batch's. Merged --admin per merge-gates §3/§4/§7.

@diegosouzapw
diegosouzapw merged commit bebbad6 into diegosouzapw:release/v3.8.51 Sep 22, 2026
16 checks passed
@maxmad64bis
maxmad64bis deleted the fix/proxy-health-refusal-cause-recovery branch September 24, 2026 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants