From 2f18f5968ba0700327f882535e2795aa01f239a9 Mon Sep 17 00:00:00 2001 From: Andrew Blakeslee Moore Date: Sun, 5 Jul 2026 04:13:23 -0700 Subject: [PATCH] Session Order Adjustment Nucleic-Session: 19C20841-87D4-45F9-A5AD-EBB92B735F82 Co-authored-by: Nucleic --- NucleicRemote/NucleicRemote/Models/RemoteStore.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NucleicRemote/NucleicRemote/Models/RemoteStore.swift b/NucleicRemote/NucleicRemote/Models/RemoteStore.swift index e05c020..cfe8834 100644 --- a/NucleicRemote/NucleicRemote/Models/RemoteStore.swift +++ b/NucleicRemote/NucleicRemote/Models/RemoteStore.swift @@ -1242,6 +1242,13 @@ extension DashboardSnapshot { } extension WireSessionSummary { + /// Recency key for ordering session lists: the last *user* message, falling back to `updatedAt` + /// for sessions with no user message yet (or summaries from a host that predates the field). + /// Ordering on this keeps a chat's position steady until the user speaks again, rather than + /// reshuffling the list on every bit of agent activity (which bumps `updatedAt` every few + /// seconds). Mirrors the Mac sidebar's last-turn ordering. + var lastTurnAt: Date { lastUserMessageAt ?? updatedAt } + /// A copy with selected fields overridden — the demo simulator's only way to "mutate" a /// summary, whose stored properties are all `let`. Nullable fields use a double optional so a /// caller can distinguish "keep" (omit) from "set to nil" (`.some(nil)`). `updatedAt` bumps