mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
fix(pi): keep archived sessions visible (#1297)
This commit is contained in:
@@ -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' } }),
|
||||
|
||||
Reference in New Issue
Block a user