mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-31 06:51:29 +00:00
fix(agent): reset _fallback_index at turn start even when no fallback activated
Original commit 33528b428 by konsisumer targeted _restore_primary_runtime
in pre-refactor run_agent.py. The body now lives in
agent/agent_runtime_helpers.restore_primary_runtime — re-applied there.
Fixes #20465
Co-authored-by: konsisumer <der@konsi.org>
This commit is contained in:
parent
aa05ffba53
commit
4ab9a06a51
1 changed files with 8 additions and 0 deletions
|
|
@ -819,6 +819,14 @@ def restore_primary_runtime(agent) -> bool:
|
|||
``gateway/run.py``), so this restoration IS needed there too.
|
||||
"""
|
||||
if not agent._fallback_activated:
|
||||
# Reset the chain index even when no fallback was activated this
|
||||
# turn. Without this, a turn where _try_activate_fallback() was
|
||||
# called but returned False (chain exhausted or provider not
|
||||
# configured) leaves _fallback_index >= len(_fallback_chain) while
|
||||
# _fallback_activated stays False. The next turn skips this block
|
||||
# entirely, stranding the index and silently blocking all future
|
||||
# fallback attempts for the session. Fixes #20465.
|
||||
agent._fallback_index = 0
|
||||
return False
|
||||
|
||||
if getattr(agent, "_rate_limited_until", 0) > time.monotonic():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue