Skip to content

Adjust AI messages trimming logic to only keep the latest message #5335

@sentrivana

Description

@sentrivana

Adjust the logic in

def truncate_messages_by_size(
to always only include the last (newest) message rather than all that fit into the 20kB limit.

All our integrations should use the function linked above already, so changing the logic in it should be all that's necessary (and adjusting the tests).

Context (sorry, Sentry employees only): https://sentry.slack.com/archives/C06KVE7V0DA/p1768578892574999?thread_ts=1768311204.311329&cid=C06KVE7V0DA

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions