Skip to content

fix(conversation_loop): resolve NameError for _pool_may_recover_from_rate_limit#28268

Closed
Mxin-9527 wants to merge 1 commit into
NousResearch:mainfrom
Mxin-9527:fix/conversation-loop-pool-recover-nameerror
Closed

fix(conversation_loop): resolve NameError for _pool_may_recover_from_rate_limit#28268
Mxin-9527 wants to merge 1 commit into
NousResearch:mainfrom
Mxin-9527:fix/conversation-loop-pool-recover-nameerror

Conversation

@Mxin-9527

Copy link
Copy Markdown

Summary

run_conversation was extracted from run_agent.py into agent/conversation_loop.py (commit 0530252). During that extraction, one call to _pool_may_recover_from_rate_limit was not routed through _ra() — the lazy import helper that every other cross-module reference in conversation_loop.py uses to reach symbols defined in run_agent.py.

The result is a NameError at 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

  1. Configure a single-credential provider (no fallback chain).
  2. Trigger a 429 rate-limit from the upstream API.
  3. The agent loop crashes with 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.

…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.
@alt-glitch alt-glitch added type/bug Something isn't working duplicate This issue or pull request already exists comp/agent Core agent loop, run_agent.py, prompt builder P1 High — major feature broken, no workaround labels May 19, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #27359 (fix PR) / #27370 (bug report). This is the same one-line _ra() prefix fix for the NameError on _pool_may_recover_from_rate_limit() in conversation_loop.py after the run_agent.py extraction refactor. 16+ duplicate fix PRs already exist for this issue.

@teknium1

Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder duplicate This issue or pull request already exists P1 High — major feature broken, no workaround type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants