Feature: Circuit breaker for model rate limiting in Ralph#451
Merged
bradygaster merged 1 commit intobradygaster:devfrom Mar 20, 2026
Merged
Conversation
Implements automatic model fallback when Copilot rate limits are hit: - Preferred model -> free-tier fallback chain - Cooldown-based recovery (half-open -> closed) - Persistent state in .squad/ralph-circuit-breaker.json - Tracks metrics: total fallbacks, recoveries Follows classic circuit breaker pattern (Hystrix/Polly/Resilience4j) applied to AI model selection. Closes bradygaster#450 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
f466cca to
336a0a0
Compare
chrislomonico
pushed a commit
to clomonico/squad
that referenced
this pull request
Mar 26, 2026
…aster#451, bradygaster#453) (bradygaster#462) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Adds a circuit breaker pattern for automatic model fallback when Copilot rate limits are hit during Ralph operations.
Closes #450
Problem
When running multiple Ralph instances, premium model rate limits cause cascading failures — all Ralphs go down at once.
Solution
Classic circuit breaker (Hystrix/Polly pattern) applied to model selection:
What's included
alph-watch.ps1\
Key design decisions
Testing
Validated with 8 concurrent Ralphs across 8 repos. Rate limit hit after ~2 hours of intensive polling. Circuit breaker engaged, Ralphs continued on \gpt-5.4-mini, recovered to preferred model after 10-minute cooldown.