fix(agent): add missing _ra() prefix to pool recovery call#27750
Closed
ruangraung wants to merge 1 commit into
Closed
fix(agent): add missing _ra() prefix to pool recovery call#27750ruangraung wants to merge 1 commit into
ruangraung wants to merge 1 commit into
Conversation
The function _pool_may_recover_from_rate_limit is defined in run_agent.py as a method of the agent instance, but conversation_loop.py was calling it without the _ra() prefix, causing NameError during rate limit recovery. This fixes the bug reported in issues NousResearch#27719, NousResearch#27465, NousResearch#27402, NousResearch#27370. The error manifested as: NameError: name '_pool_may_recover_from_rate_limit' is not defined Adding _ra() prefix resolves the reference to the current agent instance.
Collaborator
This was referenced May 19, 2026
Collaborator
Closing as fixed-on-mainThanks for the patch — appreciated! Closing as redundant: the same one-line Several contributors converged on the same fix here (#27370, #27465, #27468, #27583, #27686, #27732, #27734, #27735, #27750, #27891, #27903, #28304) — your diagnosis was correct in every case. Sorry for the duplicate-work cleanup; the volume of independent reports made it hard to coordinate. |
This was referenced May 19, 2026
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.
What does this PR do?
The function
_pool_may_recover_from_rate_limitis defined inrun_agent.pyas a method on theAIAgentclass — accessed through the_ra()instance helper. Butconversation_loop.py:2254calls it without the_ra().prefix, which triggers aNameErrorany time a provider throws a rate-limit / insufficient-quota error:This crashes the fallback-ladder recovery path. The fix is a single-character change:
_ra(→_ra()._pool_may_recover_from_rate_limit(.Related Issue
Fixes #27719, fixes #27465, fixes #27402, fixes #27370
Type of Change
Changes Made
agent/conversation_loop.py:2254—_pool_may_recover_from_rate_limit(→_ra()._pool_may_recover_from_rate_limit(How to Test
NameError: name '_pool_may_recover_from_rate_limit' is not definedChecklist
Code
pytest tests/ -qand all tests pass (no local test suite — hermetic fix)Documentation & Housekeeping