fix(pi): keep archived sessions visible (#1297)

This commit is contained in:
KorenKrita
2026-08-02 10:00:15 +08:00
committed by GitHub
parent f213bc348c
commit 1ca7af44d2
5 changed files with 131 additions and 11 deletions
+34
View File
@@ -1,4 +1,5 @@
import { describe, expect, it } from 'vitest'
import { toSessionSummary, type Session } from '@hapi/protocol'
import type { SessionSummary } from '@/types/api'
import {
deduplicateSessionsByAgentId,
@@ -233,6 +234,39 @@ describe('prepareSidebarSessions', () => {
expect(result.map(session => session.id)).toEqual(['real'])
})
it('keeps an archived Pi session with a native session id and no title', () => {
const piSession: Session = {
id: 'archived-pi',
namespace: 'default',
seq: 1,
createdAt: 50,
active: false,
activeAt: 0,
updatedAt: 100,
metadata: {
path: '/work/hapi',
host: 'local',
flavor: 'pi',
piSessionId: 'pi-session-1',
lifecycleState: 'archived'
},
metadataVersion: 1,
agentState: null,
agentStateVersion: 0,
thinking: false,
thinkingAt: 0,
model: null,
modelReasoningEffort: null,
effort: null,
serviceTier: null
}
const summary = toSessionSummary(piSession)
expect(summary.metadata?.agentSessionId).toBe('pi-session-1')
expect(prepareSidebarSessions([summary]).map(session => session.id)).toEqual(['archived-pi'])
})
it('keeps the selected inactive stub visible', () => {
const sessions = [
makeSession({ id: 'stub', metadata: { path: '/work/hapi' } }),