fix(circuit-breaker): add reset_circuit_breakers bundle field for manual reset#21
Merged
levleontiev merged 2 commits intomainfrom Mar 13, 2026
Merged
Conversation
…ual reset When auto_reset_after_minutes=0, there was no way to reset a tripped circuit breaker without restarting nginx workers. This adds an optional reset_circuit_breakers field to the policy bundle: when present, apply() calls circuit_breaker.reset() for each listed limit_key before activating the new bundle. Deliberately requires a new bundle deploy (not a direct admin API) so the free/open-core path has a working but inconvenient reset mechanism. A SaaS control plane can make this one-click by issuing a bundle with the reset field pre-populated. Closes #17 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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
reset_circuit_breakersfield to the policy bundle JSONbundle_loader.apply()callscircuit_breaker.reset()for each listedlimit_keybefore activating the new bundleContext
Fixes #17. When
auto_reset_after_minutes=0, a tripped circuit breaker had no reset path short of restarting nginx workers.How to reset a tripped breaker:
{ "bundle_version": 43, "reset_circuit_breakers": ["cb:my-policy:org_123"], "policies": [...] }The
limit_keyformat iscb:<policy_id>:<descriptor_value>(visible in nginx logs).Test plan
busted spec/unit/— 426/426 passingbundle_loader.featurecovering reset path, invalid type, empty string🤖 Generated with Claude Code