fix(conversation_loop): use _ra() prefix for _pool_may_recover_from_r… - #27896
Closed
0xchainer wants to merge 1 commit into
Closed
fix(conversation_loop): use _ra() prefix for _pool_may_recover_from_r…#278960xchainer wants to merge 1 commit into
0xchainer wants to merge 1 commit into
Conversation
…ate_limit _pool_may_recover_from_rate_limit is defined in run_agent.py but was called as a bare name in conversation_loop.py, causing a NameError at runtime when a rate-limit/billing error occurs and a fallback provider is available. Fixes the refactoring gap introduced when the conversation loop was extracted from run_agent.py into its own module.
Collaborator
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?
_pool_may_recover_from_rate_limitis defined as a module-level function inrun_agent.pybut was called as a bare name inagent/conversation_loop.pyafter the conversation loop was extracted into its own module. When a rate-limit or billing error occurs and the agent has a fallback provider configured, Python raises aNameErrorat runtime because the name isn't defined or imported in that module.The fix prefixes the call with
_ra().— the same pattern already used throughout the file for_set_interrupt,handle_function_call, andAIAgent._get_tool_call_name_static._ra()is a lazy module reference torun_agent, so existing patches in tests keep working without changes.Related Issue
No issue filed. Discovered during static analysis after the conversation-loop extraction refactor.
Fixes # N/A
Type of Change
Changes Made
agent/conversation_loop.py:2320— changed_pool_may_recover_from_rate_limit(...)to_ra()._pool_may_recover_from_rate_limit(...)How to Test
fallback_modelin config.yaml)NameError: name '_pool_may_recover_from_rate_limit' is not definedChecklist
Code
fix(conversation_loop):)pytest tests/ -qand all tests passDocumentation & Housekeeping
cli-config.yaml.example— N/ACONTRIBUTING.mdorAGENTS.md— N/A