Skip to content

FIX: order the conversation stats last message like the page does - #4286

Open
Manohar Paturi (ManoharPaturi) wants to merge 1 commit into
microsoft:mainfrom
ManoharPaturi:fix/stats-last-message-order
Open

Manohar Paturi (ManoharPaturi) wants to merge 1 commit into
microsoft:mainfrom
ManoharPaturi:fix/stats-last-message-order

Conversation

@ManoharPaturi

Copy link
Copy Markdown
Contributor

Description

Fixes #4281

The last message lookup in the conversation stats query now orders pieces the way the conversation page does: sequence, then timestamp, then id. The timestamp tiebreak decides between pieces that share a turn's sequence number, which is what the page already shows last. On Azure SQL the id tiebreak additionally sorts through the lowered varchar collation the rest of the code base uses, instead of native uniqueidentifier ordering.

Tests and Documentation

A SQLite regression in test_sqlite_memory.py, failing on main: two pieces share a sequence number with the bigger id on the earlier piece, and the stats preview must name the piece the page orders last. An Azure test pins the compiled lookup to the timestamp ordering and the collated id ordering. Both suites pass (193 tests), and the pinned ORDER BY assertion in the existing indexed lookup test is updated to the new clause. Ruff check and format are clean.

No documentation change needed, so I did not run JupyText.

Copilot AI balanced review requested due to automatic review settings November 14, 2026 05:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conversation stats preview picks the wrong last message for multi piece turns

2 participants