agent/php/Services
Snider a1a0981b06 fix(agent/brain): retryableHttp narrows retryable set + 6-attempt budget
retryableHttp() now retries only 408 (Request Timeout), 429 (Too Many
Requests), and 503 (Service Unavailable). 500-and-other-5xx fail
immediately so the circuit-breaker registers them as a single
failure rather than smearing across retry attempts. Retry-After
honoured (numeric + HTTP-date), capped reasonably.

Attempt budget bumped to 6 so a burst of 5 transient 503s can recover
within ONE circuit-permitted call — the original concern from #311.

Note: CircuitBreaker is already applied OUTSIDE the logical Brain
operation by the MCP tool layer, not around each HTTP retry. The
nesting report was stale at this code shape; the real drift was the
retryableHttp() retry set + budget.

Pest coverage in CircuitBreakerTest:
- Recovered 503 burst → circuit stays closed, no failure registered
- Exhausted 503 burst → ONE breaker failure (not five)
- 429 + Retry-After 1 → sleeps 1s, no breaker failure
- 500 → immediate breaker failure, no retry

Co-authored-by: Codex <noreply@openai.com>
Closes tasks.lthn.sh/view.php?id=311
2026-04-25 18:14:40 +01:00
..
Concerns revert fcb9c189e5 2026-04-23 12:32:57 +01:00
AgentApiKeyService.php revert fcb9c189e5 2026-04-23 12:32:57 +01:00
AgentDetection.php revert fcb9c189e5 2026-04-23 12:32:57 +01:00
AgenticManager.php revert fcb9c189e5 2026-04-23 12:32:57 +01:00
AgenticProviderInterface.php revert fcb9c189e5 2026-04-23 12:32:57 +01:00
AgenticResponse.php revert fcb9c189e5 2026-04-23 12:32:57 +01:00
AgentSessionService.php revert fcb9c189e5 2026-04-23 12:32:57 +01:00
AgentToolRegistry.php revert fcb9c189e5 2026-04-23 12:32:57 +01:00
BrainService.php fix(agent/brain): retryableHttp narrows retryable set + 6-attempt budget 2026-04-25 18:14:40 +01:00
ClaudeService.php revert fcb9c189e5 2026-04-23 12:32:57 +01:00
ContentService.php revert fcb9c189e5 2026-04-23 12:32:57 +01:00
ForgejoService.php revert fcb9c189e5 2026-04-23 12:32:57 +01:00
GeminiService.php revert fcb9c189e5 2026-04-23 12:32:57 +01:00
IpRestrictionService.php revert fcb9c189e5 2026-04-23 12:32:57 +01:00
OpenAIService.php revert fcb9c189e5 2026-04-23 12:32:57 +01:00
PlanTemplateService.php revert fcb9c189e5 2026-04-23 12:32:57 +01:00