json.JSONDecodeError inherits from ValueError. When the OpenAI SDK fails
to parse a provider response (empty body, truncated JSON), it raises
json.JSONDecodeError. The is_local_validation_error check in run_agent.py
catches it as isinstance(api_error, ValueError) and triggers a
non-retryable abort -- but the error is transient (provider-side), not a
programming bug.
Similarly, UnicodeDecodeError (also ValueError subclass) from garbled
provider responses was incorrectly flagged. The existing code only
excluded UnicodeEncodeError.
The error classifier already correctly returns retryable=True for these
errors; the bug was the isinstance check overriding the classifier.
Fix: Exclude json.JSONDecodeError and UnicodeError (parent of
Encode/Decode/Translate) from the is_local_validation_error check,
so they fall through to the classifier's retryable path.
Closes#14271
Co-authored-by: AJ <aj@users.noreply.github.com>