-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(agents): Show truncated messages info #102947
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
feat(agents): Show truncated messages info #102947
Conversation
| {isTruncated ? ( | ||
| <Container paddingBottom="lg"> | ||
| <Alert type="muted"> | ||
| {t('Due to size limitations, the message history on this span is truncated.')} |
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.
Does it make sense for us to show how many messages were truncated? The meta contains the total original length, so we should be able to calculate - or is this one of these where we don't have the information available for some reason?
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.
Ah cool if it does, for me the numbers where not adding up as the numbering on the test. messages went up to 24 + an additional user message, whereas the meta had len: 26.
Guess the messages in the test data use a 0 index.
What is the value if just a single message content got truncated?
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.
Yeah the original size is 25 messages + the user request.
If a single message is above the limit, this currently results in that message being discarded & annotated. We re-build the message array "backwards", and check at which point we exceed the limit. Even if we were to put that message into the array with truncation, it would exceed the limit. The case where the last message is the largest one, I think we haven't dealt with well so far - in this case we truncate everything and don't send any messages. I think we have to improve on this, probably by having single-message limit in addition to the limit for the array?
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.
ah k, that is something we need to improve then. but not blocking this. thx!
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.
I'll add that to the Python SDK - the content truncation will be shown in-line, as we usually do, with an ellipsis (...)
static/app/views/performance/newTraceDetails/traceDrawer/details/span/eapSections/aiInput.tsx
Outdated
Show resolved
Hide resolved
static/app/views/performance/newTraceDetails/traceDrawer/details/span/eapSections/aiInput.tsx
Outdated
Show resolved
Hide resolved
| {isTruncated ? ( | ||
| <Container paddingBottom="lg"> | ||
| <Alert type="muted"> | ||
| {t('Due to size limitations, the message history on this span is truncated.')} |
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.
Shall we add a link to the docs that specify what the limits are? E.g. a link to here https://develop.sentry.dev/sdk/expected-features/data-handling/#variable-size
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.
Nice! Did not think we have docs for that as it is still in motion. Will add 🙂
static/app/views/performance/newTraceDetails/traceDrawer/details/span/eapSections/aiInput.tsx
Outdated
Show resolved
Hide resolved
static/app/views/performance/newTraceDetails/traceDrawer/details/span/eapSections/aiInput.tsx
Show resolved
Hide resolved
| const messagesMeta = attributesMeta?.['gen_ai.request.messages']?.meta as any; | ||
| const originalMessagesLength: number | undefined = messagesMeta?.['']?.len; |
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.
just wondering why as any is necessary? Can’t we make the types conform to what we’re trying to do at runtime?
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.
Yes, I am still investigate the current usage to see how to fix the types here. In e.g. logs the value key is used. This could be an SDK / BE or FE bug.
<img width="753" height="115" alt="Screenshot 2025-11-07 at 09 16 43" src="https://github.com/user-attachments/assets/8c40d020-f525-4feb-bad8-5be66183b913" />
<img width="753" height="115" alt="Screenshot 2025-11-07 at 09 16 43" src="https://github.com/user-attachments/assets/8c40d020-f525-4feb-bad8-5be66183b913" />
<img width="753" height="115" alt="Screenshot 2025-11-07 at 09 16 43" src="https://github.com/user-attachments/assets/8c40d020-f525-4feb-bad8-5be66183b913" />
<img width="753" height="115" alt="Screenshot 2025-11-07 at 09 16 43" src="https://github.com/user-attachments/assets/8c40d020-f525-4feb-bad8-5be66183b913" />
Uh oh!
There was an error while loading. Please reload this page.