Python: fix: prevent inner_exception from being lost in AgentFrameworkException#5167
Open
Bahtya wants to merge 1 commit intomicrosoft:mainfrom
Open
Python: fix: prevent inner_exception from being lost in AgentFrameworkException#5167Bahtya wants to merge 1 commit intomicrosoft:mainfrom
Bahtya wants to merge 1 commit intomicrosoft:mainfrom
Conversation
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 microsoft#5155 Signed-off-by: bahtya <bahtyar153@qq.com>
eavanvalkenburg
approved these changes
Apr 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
AgentFrameworkException.__init__()unconditionally callssuper().__init__(message, *args)after the conditionalsuper().__init__(message, inner_exception, *args). Wheninner_exceptionis provided, the second call overwrites the exception args, losing the inner exception reference.Root Cause
Missing
elsebranch — bothsuper().__init__()calls execute wheninner_exceptionis truthy.Fix
Add
else:branch sosuper().__init__()is called exactly once with the correct arguments.Before:
After:
Fixes #5155