mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix(retry): prevent attempt counter reset after primary transport recovery
When _try_recover_primary_transport() succeeded, retry_count was reset to 0 — causing the attempt counter shown to the user to restart from (1/3) after already showing (1/3), (2/3). The sequence appeared as: (attempt 1/3) -> (attempt 2/3) -> (attempt 1/3) -> (attempt 2/3) instead of the expected monotonically increasing sequence. Fix: instead of resetting retry_count to 0, increment max_retries by 1. This grants the rebuilt client exactly one extra attempt while keeping the displayed counter monotonic and meaningful. Fixes #12956
This commit is contained in:
parent
bd7e272c1f
commit
b538cc195d
1 changed files with 6 additions and 1 deletions
|
|
@ -10199,7 +10199,12 @@ class AIAgent:
|
|||
api_error, retry_count=retry_count, max_retries=max_retries,
|
||||
):
|
||||
primary_recovery_attempted = True
|
||||
retry_count = 0
|
||||
# Do NOT reset retry_count to 0 — that causes the
|
||||
# attempt counter to show (1/3), (2/3), (1/3), (2/3)
|
||||
# instead of a monotonically increasing sequence.
|
||||
# Grant one extra attempt beyond max_retries so the
|
||||
# rebuilt client gets exactly one shot (issue #12956).
|
||||
max_retries += 1
|
||||
continue
|
||||
# Try fallback before giving up entirely
|
||||
self._emit_status(f"⚠️ Max retries ({max_retries}) exhausted — trying fallback...")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue