What
There are three parallel retry implementations and three hand-rolled circuit breakers; the "canonical" ADR-0004 machinery is unused. Collapse each set to one canonical implementation behind a behavior-parity test matrix.
Why
Triplicated resilience logic means fixes and tuning must be applied in three places and silently diverge. Consolidating reduces maintenance/audit surface and makes the ADR-0004 strategy actually load-bearing.
Where (analysis-located, LOC re-measured)
- Retry (~2,210 LOC across 4 files):
src/error-handler/RetryHandler.ts (642), src/error-handler/RetryExecutor.ts (615), src/worker/RetryHandler.ts (555), src/error-handler/RetryMetrics.ts (398).
- Circuit breakers (~867 LOC across 2 files + 1 embedded):
src/error-handler/CircuitBreaker.ts (517), src/pr-reviewer/CICircuitBreaker.ts (350), plus the breaker embedded in analysis-orchestrator.
How
- Pick/define the canonical retry engine and the canonical circuit breaker.
- Write a behavior-parity test matrix BEFORE deleting any duplicate (retry: backoff sequence, jitter bounds, max-attempts, give-up signal; breaker: open/half-open/close thresholds, reset-on-success).
- Migrate every caller, then delete the duplicates.
Acceptance
- The behavior-parity matrix passes against the canonical implementation before duplicates are removed.
- Full suite green after migration; duplicate files deleted; all callers point at the canonical module.
Part of #866.
What
There are three parallel retry implementations and three hand-rolled circuit breakers; the "canonical" ADR-0004 machinery is unused. Collapse each set to one canonical implementation behind a behavior-parity test matrix.
Why
Triplicated resilience logic means fixes and tuning must be applied in three places and silently diverge. Consolidating reduces maintenance/audit surface and makes the ADR-0004 strategy actually load-bearing.
Where (analysis-located, LOC re-measured)
src/error-handler/RetryHandler.ts(642),src/error-handler/RetryExecutor.ts(615),src/worker/RetryHandler.ts(555),src/error-handler/RetryMetrics.ts(398).src/error-handler/CircuitBreaker.ts(517),src/pr-reviewer/CICircuitBreaker.ts(350), plus the breaker embedded inanalysis-orchestrator.How
Acceptance
Part of #866.