fix(sync): keep session renames stable (#2043)
* fix(sync): keep session renames stable * fix(sync): clarify rename mirror flow * fix(sync): clarify archive comment --------- Co-authored-by: bashrusakh <bashrusakh@users.noreply.github.com> Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
committed by
GitHub
co-authored by
bashrusakh
Bohdan Triapitsyn
parent
9bfc5bf0be
commit
d5745aaac9
@@ -0,0 +1,15 @@
|
||||
import type { Session } from "@opencode-ai/sdk/v2"
|
||||
|
||||
const getSessionRecencyTimestamp = (session: Session): number => {
|
||||
const updatedAt = session.time?.updated
|
||||
if (typeof updatedAt === "number" && Number.isFinite(updatedAt)) {
|
||||
return updatedAt
|
||||
}
|
||||
const createdAt = session.time?.created
|
||||
return typeof createdAt === "number" && Number.isFinite(createdAt) ? createdAt : 0
|
||||
}
|
||||
|
||||
export const shouldSkipStaleSessionEvent = (currentSession: Session | null, incomingSession: Session): boolean => {
|
||||
if (!currentSession) return false
|
||||
return getSessionRecencyTimestamp(incomingSession) < getSessionRecencyTimestamp(currentSession)
|
||||
}
|
||||
Reference in New Issue
Block a user