From 2c756eae5487d2cbbac94e86e8bd2b5c502e1146 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Tue, 24 Nov 2026 14:34:13 -0800 Subject: [PATCH] fix(comfyui): each client classifies its own errors after a redirect A connect failure on the redirect target was raised as RequestNotSent and then rewritten to ConnectionError by the retry loop, which also turned a requests connect timeout after a redirect into ConnectionError instead of TimeoutError. Both clients now raise RequestNotSent only when no redirect was followed, so the loop needs no rewrite and keeps the error class. Live: POST answered 303 to an unroutable host, requests transport: before ConnectionError (1 POST), after TimeoutError (1 POST). --- optional-skills/creative/comfyui/scripts/_common.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/optional-skills/creative/comfyui/scripts/_common.py b/optional-skills/creative/comfyui/scripts/_common.py index ad93933dfc..d4ecc16bc7 100644 --- a/optional-skills/creative/comfyui/scripts/_common.py +++ b/optional-skills/creative/comfyui/scripts/_common.py @@ -527,8 +527,6 @@ def http_request( if attempt + 1 < retries and _may_resend(e, trace, replayable): _sleep_backoff(attempt) continue - if isinstance(e, RequestNotSent) and trace.redirected: - raise ConnectionError(str(e)) from e # the original request was delivered raise # Should not reach here unless retries was 0 @@ -617,7 +615,8 @@ def _http_once( except requests.exceptions.RequestException as e: # Convert to TimeoutError / ConnectionError so the retry loop # picks them up uniformly with the stdlib path. - if _requests_never_sent(e): + # After a redirect the original request was delivered, so nothing is "not sent". + if not trace.redirected and _requests_never_sent(e): raise RequestNotSent(str(e)) from e if isinstance(e, requests.exceptions.Timeout): raise TimeoutError(str(e)) from e @@ -689,7 +688,7 @@ def _http_once_stdlib( except urllib.error.URLError as e: # Refused or unresolvable: no byte was sent. A timeout here is ambiguous # (connect or read), so it stays a plain unknown-outcome error. - if isinstance(e.reason, (ConnectionRefusedError, socket.gaierror)): + if not trace.redirected and isinstance(e.reason, (ConnectionRefusedError, socket.gaierror)): raise RequestNotSent(str(e)) from e raise