fix: make session ordering follow activity lifecycle
Session lists now promote a conversation when it starts working and again when it settles, instead of reacting to every streaming timestamp update. This keeps ordering responsive without bringing back the sidebar churn removed by the recent performance work. Apply the same user-visible order across Recent, project and worktree groups, session switchers, mobile navigation, widgets, the command palette, and the desktop tray. Preserve pinned priority, freeze timestamp fallback ordering, and keep child-session activity scoped to siblings under the same parent so it never moves the root conversation. Seed reconnect snapshots without synthetic jumps, clear ephemeral ranks on deletion and runtime changes, and cover lifecycle transitions, mixed root/child trees, metadata-only updates, and project-group ordering with regression tests.
This commit is contained in:
@@ -22,13 +22,10 @@ const getSessionUpdatedAt = (session: Session): number => {
|
||||
return 0;
|
||||
};
|
||||
|
||||
const sortSessionsByUpdated = (sessions: Session[]): Session[] => {
|
||||
return [...sessions].sort((a, b) => getSessionUpdatedAt(b) - getSessionUpdatedAt(a));
|
||||
};
|
||||
|
||||
// Recent sessions are simply every non-archived, top-level session updated
|
||||
// within the last RECENT_SESSION_MAX_AGE_MS. No persisted history or live-busy
|
||||
// tracking — membership is derived directly from session timestamps.
|
||||
// tracking: membership is timestamp-derived, while the caller applies shared
|
||||
// lifecycle ordering.
|
||||
export const deriveRecentSessions = (
|
||||
sessions: Session[],
|
||||
now = Date.now(),
|
||||
@@ -40,5 +37,5 @@ export const deriveRecentSessions = (
|
||||
}
|
||||
return getSessionUpdatedAt(session) >= minUpdatedAt;
|
||||
});
|
||||
return sortSessionsByUpdated(recent);
|
||||
return recent;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user