English
php
circuit-breaker
ai
resilience
failover
llm
shinobi-apps-framework
Circuit breaker for AI providers in PHP: OPEN/HALF_OPEN/CLOSED state machine
CircuitBreaker: CLOSED/OPEN/HALF_OPEN state machine, failureThreshold=3, transientRecoverySeconds=300 (5min), permanentRecoverySeconds=1800 (30min), DB-backed ai_provider_health (one indexed PK read/request). ProviderError: 6 categories — PERMANENT_BILLING vs RATE_LIMITED distinction (413 is TPM cap not billing, URL-stripped match, billing before 4xx/401 check). Retry-After honored. upsert avoids deprecated ON DUPLICATE KEY UPDATE.