mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-25 05:07:05 +00:00
修复 Codex 会话导入合并后列表为空的问题。 Fix Codex session import merge so a session is not detected as a duplicate of itself and deleted during merge.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { ListCodexSessionsRpcResponseSchema } from './apiTypes'
|
||||
|
||||
describe('ListCodexSessionsRpcResponseSchema', () => {
|
||||
it('preserves Codex session messages when parsing runner RPC responses', () => {
|
||||
const parsed = ListCodexSessionsRpcResponseSchema.parse({
|
||||
success: true,
|
||||
sessions: [{
|
||||
id: 'codex-session-id',
|
||||
title: 'Codex Session',
|
||||
file: '/home/user/.codex/sessions/session.jsonl',
|
||||
modifiedAt: 1_000,
|
||||
messages: [{
|
||||
role: 'user',
|
||||
content: {
|
||||
type: 'text',
|
||||
text: 'hello'
|
||||
},
|
||||
meta: {
|
||||
sentFrom: 'cli'
|
||||
}
|
||||
}]
|
||||
}]
|
||||
})
|
||||
|
||||
expect(parsed.success).toBe(true)
|
||||
if (parsed.success) {
|
||||
expect(parsed.sessions[0]?.messages).toHaveLength(1)
|
||||
}
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user