-
Notifications
You must be signed in to change notification settings - Fork 565
fix(ai): introduce message truncation for openai #4946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ai): introduce message truncation for openai #4946
Conversation
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
sentry_sdk/client.py
Outdated
| spans = [] # type: List[Dict[str, Any]] | ||
| for span in spans: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential bug: The spans variable is initialized as an empty list, so the subsequent loop that should annotate spans with truncation information never runs.
-
Description: In the
_prepare_eventmethod, thespansvariable is initialized as an empty list. The code then immediately attempts to iterate over this list. Becausespansis always empty at this point, the loop body that is intended to annotate spans with AI message truncation information never executes. This causes the new message truncation annotation feature to fail silently, as the expectedAnnotatedValuemetadata will not be added to the event's spans. -
Suggested fix: Initialize the
spansvariable by retrieving the spans from the event object. Change the linespans = []tospans = event.get("spans", [])to ensure the annotation logic can execute on the event's spans.
severity: 0.65, confidence: 0.99
Did we get this right? 👍 / 👎 to inform future reviews.
Contributes to TET-1208