Repository navigation
fix(providers): report the circuit breaker as half-open once recovery is due - #1500
Conversation
… is due The breaker moves from open to half-open only inside isAllowed, on the next provider call. getState returned the stored field, so an idle worker kept reporting "open" after the recovery timeout, and status kept raising the error-level provider-circuit-open problem for an outage that was over. getState now reports half-open once the timeout has passed, without changing the breaker's state or counters. Signed-off-by: Rex57 <203883624+Rex57@users.noreply.github.com>
|
@Rex57 is attempting to deploy a commit to the rohitg00's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthrough
ChangesCircuit breaker state reporting
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to This change reports half-open after recovery without changing the breaker’s stored state. The separate re-arming concern predates this PR; no actionable merge-blocking regression remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Fixes #1489.
CircuitBreakermoves fromopentohalf-openonly inside theisAllowedgetter, which runs on the next provider call.getState()returned the stored field, so while the worker was idle after a provider blip,GET /agentmemory/statuskept reportingcircuitBreaker.state: "open"and the error-level problemprovider-circuit-open("LLM provider calls are paused") even though the next call is allowed.getState()now reportshalf-openonce the recovery timeout has passed. It only computes the reported value: the stored state, counters and theisAllowedtransition are unchanged, so a failure in that window reopens the breaker exactly as before.PR #1350 edits
recordSuccessin the same file; this change touches onlygetState, so the two do not overlap.Checks
test/circuit-breaker.test.ts: stillopen1 ms before the timeout,half-openat the timeout before any call; reading the state does not change the breaker (a failure then reopens it andisAllowedisfalse)npm run build,npm run skills:gen,npm run docs:sync(no changes),npm run skills:checknpm test: 2596 passed, 4 skippedSummary by CodeRabbit