Skip to content

Your lightweight open-source personal agent.

fix: add retry termination notification to interaction channel

aiguozhi123456ec14933aa106
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)]