From f5b3ca4efbbaf33024a95e8d91c2ba8fe14061c5 Mon Sep 17 00:00:00 2001 From: bahtya Date: Wed, 8 Apr 2026 20:45:36 +0800 Subject: [PATCH] fix: prevent inner_exception from being lost in AgentFrameworkException The __init__ method unconditionally called super().__init__() after the conditional call with inner_exception, effectively overwriting the exception args and losing the inner_exception reference. Add else branch so super().__init__() is only called once with the correct arguments. Fixes #5155 Signed-off-by: bahtya --- python/packages/core/agent_framework/exceptions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/packages/core/agent_framework/exceptions.py b/python/packages/core/agent_framework/exceptions.py index 4f56c34b5c..d5a54c2102 100644 --- a/python/packages/core/agent_framework/exceptions.py +++ b/python/packages/core/agent_framework/exceptions.py @@ -34,7 +34,8 @@ def __init__( logger.log(log_level, message, exc_info=inner_exception) if inner_exception: super().__init__(message, inner_exception, *args) # type: ignore - super().__init__(message, *args) # type: ignore + else: + super().__init__(message, *args) # type: ignore # region Agent Exceptions