fix(conversation_loop): resolve NameError for _pool_may_recover_from_rate_limit#28268
Closed
Mxin-9527 wants to merge 1 commit into
Closed
fix(conversation_loop): resolve NameError for _pool_may_recover_from_rate_limit#28268Mxin-9527 wants to merge 1 commit into
_pool_may_recover_from_rate_limit#28268Mxin-9527 wants to merge 1 commit into
Conversation
…rate_limit The function is defined in run_agent.py but was called as a bare name in agent/conversation_loop.py after the extraction refactor (commit 0530252). All other cross-module references in conversation_loop.py go through _ra() (the lazy run_agent import), but this call site was missed. Only triggers when a 429 rate-limit response hits the recovery logic, so it can go unnoticed for a long time in normal operation.
Collaborator
Contributor
|
Closing as duplicate of #28159 by @AceWattGit, which has been merged via salvage PR #28345 (commit 25e0f4d). All three of your PRs converged on the same fix (routing the call through `_ra()`), and AceWattGit's version also ships an inspect-based regression test guarding the call shape. Thanks for spotting the NameError — community signal helped triage it fast. |
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
run_conversationwas extracted fromrun_agent.pyintoagent/conversation_loop.py(commit 0530252). During that extraction, one call to_pool_may_recover_from_rate_limitwas not routed through_ra()— the lazy import helper that every other cross-module reference inconversation_loop.pyuses to reach symbols defined inrun_agent.py.The result is a
NameErrorat runtime, but only when the agent loop encounters a 429 rate-limit response and needs to decide whether to wait for credential pool rotation or fall back. That is a narrow code path, so this can sit dormant for a long time between hits.Fix
One-line change:
_pool_may_recover_from_rate_limit(...)becomes_ra()._pool_may_recover_from_rate_limit(...).How to reproduce
NameError: name '_pool_may_recover_from_rate_limit' is not defined.With a multi-credential pool or when no rate-limiting occurs, the branch is never reached.