Skip to content

The agent that grows with you

docs(image_gen): state the fallback rule as no server accepted the request

Mariano Nicolini3637c512fc32
diff --git a/plugins/image_gen/_common.py b/plugins/image_gen/_common.py
index 81b8b3cf743..8af6741ae47 100644
--- a/plugins/image_gen/_common.py
+++ b/plugins/image_gen/_common.py
@@ -272,7 +272,8 @@ def record_token_usage(usage: Any, *, model: str, provider: str, base_url: Optio
def _never_connected(exc: Exception) -> bool:
- """True when no connection was ever established, so the request body never left this host."""
+ """True when the last connection attempt never connected, so no server accepted the request body
+ (a redirect hop may have answered earlier, but a redirect accepts nothing)."""
from urllib3.exceptions import MaxRetryError, NameResolutionError, NewConnectionError
cause = exc.args[0] if exc.args else None
diff --git a/plugins/image_gen/krea/__init__.py b/plugins/image_gen/krea/__init__.py
index 3ea81085945..653afa34064 100644
--- a/plugins/image_gen/krea/__init__.py
+++ b/plugins/image_gen/krea/__init__.py
@@ -111,7 +111,7 @@ def fallback_to_fal_enabled() -> bool:
def _fallback_eligible(failure: HttpFailure) -> bool:
- """Only failures that prove Krea created no job: the request never left this host, or the
+ """Only failures that prove Krea created no job: no server accepted the request, or the
gateway answered 429, which it documents as "no job was created". A dropped connection,
a timeout or a 5xx may have happened after Krea accepted the job."""
return failure.kind == "unreachable" or (failure.kind == "http" and failure.status == 429)