fix: use _ra() accessor for _pool_may_recover_from_rate_limit#27534
fix: use _ra() accessor for _pool_may_recover_from_rate_limit#27534bynguts wants to merge 1 commit into
Conversation
The function is defined in run_agent.py but was being called directly in conversation_loop.py, causing NameError: name '_pool_may_recover_from_rate_limit' is not defined. Changed to _ra()._pool_may_recover_from_rate_limit to match the pattern used for other run_agent functions.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates the rate-limit recovery logic to reference run_agent via the lazy _ra() accessor, likely to ensure runtime patching/mocking of run_agent affects this code path.
Changes:
- Switches
_pool_may_recover_from_rate_limit(...)invocation to_ra()._pool_may_recover_from_rate_limit(...).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| pool_may_recover = _ra()._pool_may_recover_from_rate_limit( | ||
| agent._credential_pool, | ||
| provider=agent.provider, | ||
| base_url=getattr(agent, "base_url", None), |
|
Thanks for the review! Just to clarify: This pattern is already used consistently throughout conversation_loop.py (e.g., line 487-492 for All 28 tests pass, including those that import this function directly:
|
What does this PR do?
Fixes NameError crash when rate limit recovery triggers. The function
_pool_may_recover_from_rate_limitwas defined inrun_agent.pybut called directly inconversation_loop.pywithout the_ra()accessor.Type of Change
Changes Made
agent/conversation_loop.pyline 2254: Changed_pool_may_recover_from_rate_limit(...)to_ra()._pool_may_recover_from_rate_limit(...)How to Test
Checklist
Code
fix(scope):)pytest tests/ -qand all tests passDocumentation & Housekeeping