From be93651db8b705d40b93a9c144d89817bf58be71 Mon Sep 17 00:00:00 2001 From: tomoya-kawaguchi Date: Tue, 7 Oct 2025 19:19:03 +0900 Subject: [PATCH 1/3] chore: add error log on model prediction failure --- pr_agent/algo/pr_processing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pr_agent/algo/pr_processing.py b/pr_agent/algo/pr_processing.py index dda0d9a2..20010694 100644 --- a/pr_agent/algo/pr_processing.py +++ b/pr_agent/algo/pr_processing.py @@ -329,9 +329,9 @@ async def retry_with_fallback_models(f: Callable, model_type: ModelType = ModelT ) get_settings().set("openai.deployment_id", deployment_id) return await f(model) - except: + except Exception as e: get_logger().warning( - f"Failed to generate prediction with {model}" + f"Failed to generate prediction with {model}: {e}", ) if i == len(all_models) - 1: # If it's the last iteration raise Exception(f"Failed to generate prediction with any model of {all_models}") From 632c39962cbe8c7ec9f2a1039a1ec7ffa05c6ffc Mon Sep 17 00:00:00 2001 From: tomoya-kawaguchi Date: Tue, 7 Oct 2025 21:16:52 +0900 Subject: [PATCH 2/3] chore: add original exception --- pr_agent/algo/pr_processing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pr_agent/algo/pr_processing.py b/pr_agent/algo/pr_processing.py index 20010694..6c4ad7a9 100644 --- a/pr_agent/algo/pr_processing.py +++ b/pr_agent/algo/pr_processing.py @@ -334,7 +334,7 @@ async def retry_with_fallback_models(f: Callable, model_type: ModelType = ModelT f"Failed to generate prediction with {model}: {e}", ) if i == len(all_models) - 1: # If it's the last iteration - raise Exception(f"Failed to generate prediction with any model of {all_models}") + raise Exception(f"Failed to generate prediction with any model of {all_models}") from e def _get_all_models(model_type: ModelType = ModelType.REGULAR) -> List[str]: From a194ca65d2d8144ac79843459cae6182f4d6f064 Mon Sep 17 00:00:00 2001 From: Tomoya Kawaguchi <68677002+yamoyamoto@users.noreply.github.com> Date: Fri, 10 Oct 2025 20:44:31 +0900 Subject: [PATCH 3/3] Update pr_agent/algo/pr_processing.py Co-authored-by: qodo-merge-for-open-source[bot] <189517486+qodo-merge-for-open-source[bot]@users.noreply.github.com> --- pr_agent/algo/pr_processing.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pr_agent/algo/pr_processing.py b/pr_agent/algo/pr_processing.py index 6c4ad7a9..0b76b90e 100644 --- a/pr_agent/algo/pr_processing.py +++ b/pr_agent/algo/pr_processing.py @@ -331,7 +331,8 @@ async def retry_with_fallback_models(f: Callable, model_type: ModelType = ModelT return await f(model) except Exception as e: get_logger().warning( - f"Failed to generate prediction with {model}: {e}", + f"Failed to generate prediction with {model}", + artifact={"error": e}, ) if i == len(all_models) - 1: # If it's the last iteration raise Exception(f"Failed to generate prediction with any model of {all_models}") from e