Skip to content

fix(ai-conversations): Order conversation messages by span start/end#114129

Merged
obostjancic merged 2 commits intomasterfrom
ognjenbostjancic/tet-2249-showing-multiple-user-messages-in-a-row-wrongly-in-a
Apr 28, 2026
Merged

fix(ai-conversations): Order conversation messages by span start/end#114129
obostjancic merged 2 commits intomasterfrom
ognjenbostjancic/tet-2249-showing-multiple-user-messages-in-a-row-wrongly-in-a

Conversation

@obostjancic
Copy link
Copy Markdown
Member

Anchor user messages to the generation span's start_timestamp and assistant messages to its end_timestamp. The previous code anchored both to end_timestamp with a + 1 offset — which is one full second since timestamps are in seconds — so back-to-back turns crossed over each other on the final sort, producing orderings like Q1, Q2, A1, Q3, A2, A3.

Fixes TET-2249

Anchor user messages to the generation span's start_timestamp and
assistant messages to its end_timestamp. The previous code anchored
both to the span's end_timestamp with a `+ 1` offset for the assistant
to break ties. Because timestamps are in seconds, that offset was a
full second — so when two turns completed within a second of each
other, the assistant's timestamp crossed over the next turn's user
timestamp on the final sort, producing an order like
Q1, Q2, A1, Q3, A2, A3.

Fixes TET-2249
@linear-code
Copy link
Copy Markdown

linear-code Bot commented Apr 28, 2026

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 28, 2026
@obostjancic obostjancic changed the title fix(ai-trace): Order conversation messages by span start/end fix(ai-conversations): Order conversation messages by span start/end Apr 28, 2026
@obostjancic obostjancic marked this pull request as ready for review April 28, 2026 10:10
@obostjancic obostjancic requested a review from a team as a code owner April 28, 2026 10:10
@obostjancic obostjancic merged commit 5673d2a into master Apr 28, 2026
65 checks passed
@obostjancic obostjancic deleted the ognjenbostjancic/tet-2249-showing-multiple-user-messages-in-a-row-wrongly-in-a branch April 28, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants