Extend circuit breaker functionality to support per-model isolation#111
Merged
Conversation
7ad6549 to
45a2c45
Compare
pawbana
reviewed
Jan 14, 2026
pawbana
reviewed
Jan 15, 2026
30f30ec to
5cc2635
Compare
pawbana
reviewed
Jan 15, 2026
fec402b to
0b0a29e
Compare
pawbana
reviewed
Jan 15, 2026
pawbana
reviewed
Jan 15, 2026
pawbana
approved these changes
Jan 16, 2026
44bb888 to
dd13bd5
Compare
SasSwart
added a commit
to coder/coder
that referenced
this pull request
Jan 20, 2026
Update our dependency on coder/aibridge. This allows us to benefit from the following additions to bridge: feat: inner agentic loop for openai responses requests (blocking only) (coder/aibridge#127) feat: req/resp logging middleware (coder/aibridge#105) perf: eliminate unnecessary json marshalling for anthropic requests to bridge (coder/aibridge#102) feat: add token usage recording for responses streaming interceptor (coder/aibridge#125) feat: add token usage recording for responses blocking interceptor (coder/aibridge#124) feat: add tool usage recording to streaming responses interceptor (coder/aibridge#123) feat: add tool usage recording for blocking responses interceptor (coder/aibridge#122) Extend circuit breaker functionality to support per-model isolation (coder/aibridge#111) feat: add circuit breaker for upstream provider overload protection (coder/aibridge#75) chore: change blocking request timeouts to 10m (coder/aibridge#118) feat: add prompt recording for responses API (coder/aibridge#109) feat: add basic responses API interceptor (coder/aibridge#107)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends the circuit breaker implementation to isolate failures at the model level, not just per-endpoint. This prevents a failing model (e.g.,
claude-sonnet-4-20250514being rate-limited) from blocking requests to other models on the same endpoint.Problem
With endpoint-only circuit breakers, if one model starts failing (e.g., due to rate limiting), all requests to that endpoint get blocked - even for healthy models.
Solution
Circuit breakers are now keyed by
endpoint:modeltuple instead of justendpoint. Each model gets independent failure tracking and circuit state.Changes
endpointtoendpoint:modelmodellabel to all circuit breaker metricsExecute()method to access model after request parsingExample
Requests to haiku continue working even when sonnet is blocked.
Files Changed
circuitbreaker/circuitbreaker.goGet(endpoint, model),Execute()methodbridge.gometrics/metrics.gomodellabel to CB metricscircuitbreaker/circuitbreaker_test.gocircuit_breaker_integration_test.go