diff --git a/run_agent.py b/run_agent.py index 4b1429bc7..a3a2b6d58 100644 --- a/run_agent.py +++ b/run_agent.py @@ -31,6 +31,7 @@ logger = logging.getLogger(__name__) import os import random import re +import ssl import sys import tempfile import time @@ -10923,6 +10924,14 @@ class AIAgent: and not isinstance( api_error, (UnicodeEncodeError, json.JSONDecodeError) ) + # ssl.SSLError (and its subclass SSLCertVerificationError) + # inherits from OSError *and* ValueError via Python MRO, + # so the isinstance(ValueError) check above would + # misclassify a TLS transport failure as a local + # programming bug and abort without retrying. Exclude + # ssl.SSLError explicitly so the error classifier's + # retryable=True mapping takes effect instead. + and not isinstance(api_error, ssl.SSLError) ) is_client_error = ( is_local_validation_error