fix: complete session persistence overhaul (Codex 5.2)
Some checks failed
Release Binaries / release (push) Has been cancelled
Some checks failed
Release Binaries / release (push) Has been cancelled
1. Implemented auto-selection of tasks in MultiXV2 to prevent empty initial state. 2. Added force-loading logic for task session messages with debouncing. 3. Updated session-actions to return full assistant text and immediately persist native messages. 4. Fixed caching logic in instance-shell2 to retain active task sessions in memory.
This commit is contained in:
@@ -683,7 +683,25 @@ Now analyze the project and report your findings.`
|
||||
})
|
||||
|
||||
const handleSessionSelect = (sessionId: string) => {
|
||||
setActiveSession(props.instance.id, sessionId)
|
||||
if (sessionId === "info") {
|
||||
setActiveSession(props.instance.id, sessionId)
|
||||
return
|
||||
}
|
||||
|
||||
const instanceSessions = sessions().get(props.instance.id)
|
||||
const session = instanceSessions?.get(sessionId)
|
||||
|
||||
if (session?.parentId) {
|
||||
setActiveParentSession(props.instance.id, session.parentId)
|
||||
const parentSession = instanceSessions?.get(session.parentId)
|
||||
const matchingTask = parentSession?.tasks?.find((task) => task.taskSessionId === sessionId)
|
||||
if (matchingTask) {
|
||||
setActiveTask(props.instance.id, session.parentId, matchingTask.id)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
setActiveParentSession(props.instance.id, sessionId)
|
||||
}
|
||||
|
||||
|
||||
@@ -731,6 +749,7 @@ Now analyze the project and report your findings.`
|
||||
const sessionsMap = activeSessions()
|
||||
const parentId = parentSessionIdForInstance()
|
||||
const activeId = activeSessionIdForInstance()
|
||||
const instanceSessions = sessions().get(props.instance.id)
|
||||
setCachedSessionIds((current) => {
|
||||
const next: string[] = []
|
||||
const append = (id: string | null) => {
|
||||
@@ -743,6 +762,16 @@ Now analyze the project and report your findings.`
|
||||
append(parentId)
|
||||
append(activeId)
|
||||
|
||||
const parentSessionId = parentId || activeId
|
||||
const parentSession = parentSessionId ? instanceSessions?.get(parentSessionId) : undefined
|
||||
const activeTaskId = parentSession?.activeTaskId
|
||||
if (activeTaskId && parentSession?.tasks?.length) {
|
||||
const activeTask = parentSession.tasks.find((task) => task.id === activeTaskId)
|
||||
if (activeTask?.taskSessionId) {
|
||||
append(activeTask.taskSessionId)
|
||||
}
|
||||
}
|
||||
|
||||
const limit = parentId ? SESSION_CACHE_LIMIT + 1 : SESSION_CACHE_LIMIT
|
||||
const trimmed = next.length > limit ? next.slice(0, limit) : next
|
||||
const trimmedSet = new Set(trimmed)
|
||||
|
||||
Reference in New Issue
Block a user