Skip to content

feat(ui): sort session history by last activity instead of creation time#1602

Open
Raghavendiran-2002 wants to merge 1 commit intokagent-dev:mainfrom
Raghavendiran-2002:feat/sort-sessions-by-last-activity
Open

feat(ui): sort session history by last activity instead of creation time#1602
Raghavendiran-2002 wants to merge 1 commit intokagent-dev:mainfrom
Raghavendiran-2002:feat/sort-sessions-by-last-activity

Conversation

@Raghavendiran-2002
Copy link
Copy Markdown
Contributor

Summary

Closes #1556

Sessions in the history sidebar were sorted by creation time, making it hard to find active long-running sessions.
This change sorts by last activity (updated_at) instead.

  • Grouping (Today / Yesterday / Older) now uses updated_at so a session active today appears under "Today" even
    if it was created days ago
  • Sort order within each group is descending by updated_at — most recently active session appears first
  • Timestamp displayed on each session item now shows last activity time instead of creation time
  • Falls back to created_at if updated_at is not set

Files changed

  • ui/src/components/sidebars/GroupedChats.tsx — grouping and sort logic
  • ui/src/components/sidebars/SessionGroup.tsx — pass updatedAt to ChatItem
  • ui/src/components/sidebars/ChatItem.tsx — display updatedAt timestamp

Copilot AI review requested due to automatic review settings March 31, 2026 06:37
@Raghavendiran-2002 Raghavendiran-2002 force-pushed the feat/sort-sessions-by-last-activity branch from 6e78982 to 1fbf00d Compare March 31, 2026 06:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the session history sidebar by sorting sessions by their last activity time (updated_at) instead of creation time. This makes it easier to find active long-running sessions. The implementation includes proper grouping (Today/Yesterday/Older) and sorting (most recently active first) using the updated timestamp, with a fallback to created_at for backward compatibility.

Changes:

  • Updated session grouping logic to use updated_at instead of created_at
  • Updated session sorting within each group to use updated_at in descending order
  • Modified ChatItem component to accept and display updatedAt timestamp instead of createdAt

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
ui/src/components/sidebars/GroupedChats.tsx Updated grouping and sorting logic to use updated_at with fallback to created_at
ui/src/components/sidebars/SessionGroup.tsx Updated prop passed to ChatItem from createdAt to updatedAt
ui/src/components/sidebars/ChatItem.tsx Updated interface and display to use updatedAt instead of createdAt

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

const ChatItem = ({ sessionId, agentName, agentNamespace, onDelete, sessionName, onDownload, createdAt }: ChatItemProps) => {
const ChatItem = ({ sessionId, agentName, agentNamespace, onDelete, sessionName, onDownload, updatedAt }: ChatItemProps) => {
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

Note: The ChatItem component's prop has been changed from createdAt to updatedAt, but the Storybook stories file (ChatItem.stories.tsx) still references the old createdAt prop in 4 places (lines 65, 76, 87, and 110). This file will need to be updated separately to reflect the prop name change.

Copilot uses AI. Check for mistakes.
Signed-off-by: Raghavendiran-Github <raghavendiran46461@gmail.com>
@Raghavendiran-2002 Raghavendiran-2002 force-pushed the feat/sort-sessions-by-last-activity branch from 1fbf00d to b111e67 Compare March 31, 2026 06:42
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.

[FEATURE] Sort session history by most recent activity (instead of creation)

2 participants