From ec14933aa1063341fd9da99f2ffc0938b132b9f4 Mon Sep 17 00:00:00 2001 From: aiguozhi123456 <126325311+aiguozhi123456@users.noreply.github.com> Date: Tue, 14 Apr 2026 23:03:34 +0800 Subject: [PATCH] fix: add retry termination notification to interaction channel --- nanobot/providers/base.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nanobot/providers/base.py b/nanobot/providers/base.py index 759d880a8..2383a5673 100644 --- a/nanobot/providers/base.py +++ b/nanobot/providers/base.py @@ -718,9 +718,22 @@ class LLMProvider(ABC): identical_error_count, (response.content or "")[:120].lower(), ) + if on_retry_wait: + await on_retry_wait( + f"Persistent retry stopped after {identical_error_count} identical errors." + ) return response if not persistent and attempt > len(delays): + logger.warning( + "LLM request failed after {} retries, giving up: {}", + attempt, + (response.content or "")[:120].lower(), + ) + if on_retry_wait: + await on_retry_wait( + f"Model request failed after {attempt} retries, giving up." + ) break base_delay = delays[min(attempt - 1, len(delays) - 1)]