From 9e12bd0a2b9f34b095d0522db5a7eb432f8cdc86 Mon Sep 17 00:00:00 2001 From: Varun Nuthalapati Date: Sat, 25 Apr 2026 11:59:27 -0700 Subject: [PATCH] fix: replace bare except clauses in LlavaService and CogAgentService Both services use the same retry pattern where a fallback try/except logs the raw response object on API error. The inner except was bare, catching SystemExit and KeyboardInterrupt unintentionally. Replace with except Exception to match the outer handler pattern. --- ufo/llm/cogagent.py | 2 +- ufo/llm/llava.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ufo/llm/cogagent.py b/ufo/llm/cogagent.py index 12f5a8804..0d15bda8a 100644 --- a/ufo/llm/cogagent.py +++ b/ufo/llm/cogagent.py @@ -81,7 +81,7 @@ def chat_completion( logger.error(f"Error making API request: {e}") try: logger.error(response) - except: + except Exception: pass time.sleep(3) continue diff --git a/ufo/llm/llava.py b/ufo/llm/llava.py index 9b1ed789c..ea44d281a 100644 --- a/ufo/llm/llava.py +++ b/ufo/llm/llava.py @@ -94,7 +94,7 @@ def chat_completion( logger.error(f"Error making API request: {e}") try: logger.error(response) - except: + except Exception: pass time.sleep(3) continue