mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat(codersdk): add circuit breaker configuration support for aibridge (#21546)
## Summary Add circuit breaker support for AI Bridge to protect against cascading failures from upstream AI provider rate limits (HTTP 429, 503, and Anthropic's 529 overloaded responses). ## Changes - Add 5 new CLI options for circuit breaker configuration: - `--aibridge-circuit-breaker-enabled` (default: false) - `--aibridge-circuit-breaker-failure-threshold` (default: 5) - `--aibridge-circuit-breaker-interval` (default: 10s) - `--aibridge-circuit-breaker-timeout` (default: 30s) - `--aibridge-circuit-breaker-max-requests` (default: 3) - Update aibridge dependency to include circuit breaker support - Add tests for pool creation with circuit breaker providers ## Notes - Circuit breaker is **disabled by default** for backward compatibility - When enabled, applies to both OpenAI and Anthropic providers - Uses sony/gobreaker internally via the aibridge library ## Testing ``` make test RUN=TestPoolWithCircuitBreakerProviders ```
This commit is contained in:
Generated
+16
@@ -12038,6 +12038,22 @@ const docTemplate = `{
|
||||
"bedrock": {
|
||||
"$ref": "#/definitions/codersdk.AIBridgeBedrockConfig"
|
||||
},
|
||||
"circuit_breaker_enabled": {
|
||||
"description": "Circuit breaker protects against cascading failures from upstream AI\nprovider rate limits (429, 503, 529 overloaded).",
|
||||
"type": "boolean"
|
||||
},
|
||||
"circuit_breaker_failure_threshold": {
|
||||
"type": "integer"
|
||||
},
|
||||
"circuit_breaker_interval": {
|
||||
"type": "integer"
|
||||
},
|
||||
"circuit_breaker_max_requests": {
|
||||
"type": "integer"
|
||||
},
|
||||
"circuit_breaker_timeout": {
|
||||
"type": "integer"
|
||||
},
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
|
||||
Generated
+16
@@ -10690,6 +10690,22 @@
|
||||
"bedrock": {
|
||||
"$ref": "#/definitions/codersdk.AIBridgeBedrockConfig"
|
||||
},
|
||||
"circuit_breaker_enabled": {
|
||||
"description": "Circuit breaker protects against cascading failures from upstream AI\nprovider rate limits (429, 503, 529 overloaded).",
|
||||
"type": "boolean"
|
||||
},
|
||||
"circuit_breaker_failure_threshold": {
|
||||
"type": "integer"
|
||||
},
|
||||
"circuit_breaker_interval": {
|
||||
"type": "integer"
|
||||
},
|
||||
"circuit_breaker_max_requests": {
|
||||
"type": "integer"
|
||||
},
|
||||
"circuit_breaker_timeout": {
|
||||
"type": "integer"
|
||||
},
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user