fix(agent): wrap _pool_may_recover_from_rate_limit with _ra() lazy import#27374
fix(agent): wrap _pool_may_recover_from_rate_limit with _ra() lazy import#27374sherman-yang wants to merge 1 commit into
Conversation
This comment was marked as spam.
This comment was marked as spam.
Confirmacao de fix local (AloisioMagalhaes)Apliquei exatamente este mesmo fix localmente e confirme: Arquivo: - pool_may_recover = _pool_may_recover_from_rate_limit(
+ pool_may_recover = _ra()._pool_may_recover_from_rate_limit(Testes: 28/28 passaram em Ambiente:
O fix restaura o comportamento documentado do fallback chain em caso de 429. Sem ele, o agente crasha com NameError antes de tentar qualquer fallback. Recomendo merge — eh uma linha, sem side effects, e os testes existentes validam. |
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. |
Summary
Fixes #27370.
The eager-fallback path on rate-limit errors crashes with
NameError: name '_pool_may_recover_from_rate_limit' is not definedbecause the refactor in
053025238("extract run_conversation toagent/conversation_loop.py") missed one call site. The function lives
in
run_agent.py:239, and every other reference torun_agenthelpers in
conversation_loop.pyis wrapped with the_ra()lazyimport. This one wasn't.
Change
One line,
agent/conversation_loop.py:2254:Impact
Without this fix, any user with a
fallback_providerschain thatcontains a rate-limited or quota-exhausted provider sees the whole
conversation turn crash on 429/402, instead of cleanly switching to
the next provider. The whole point of
_pool_may_recover_from_rate_limit(introduced in
1fc77f995, "fall back on rate limit when pool has norotation room") is currently inert because the call site is unbound.
Test plan
configured fallback chain that hits a 429 transitions to the next
provider without raising
NameError.refactor regression and the fix restores the documented behaviour.
Notes
Reported and reproduced on v0.14.0 (2026-05-16). No upstream commits
yet attempt this fix;
origin/mainis still affected at the time ofthis PR.