fix: preserve complete remote tool details
Managed SSH Runtime events could complete successfully and then fail local conversation persistence when tool details exceeded a second, smaller renderer-to-Main schema limit. Conversation persistence now stores the complete tool details already accepted from the Runtime, so long remote results no longer leave the final assistant message stuck in a streaming state. Release note: 修复远程项目工具结果较长时会话持久化失败的问题;Runtime 已返回的工具详情现在会完整保存到本地会话。
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
conversationBranchInputSchema,
|
||||
conversationSnapshotSchema,
|
||||
isUntouchedBuiltInDefaultProject,
|
||||
localConversationSaveBatchSchema,
|
||||
persistedProjectExecutionSpaceSchema,
|
||||
projectCreateSchema,
|
||||
projectExecutionSpaceSchema,
|
||||
@@ -203,3 +204,42 @@ describe('conversation branch contracts', () => {
|
||||
).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('conversation persistence contracts', () => {
|
||||
it('preserves complete tool details without persistence length limits', () => {
|
||||
const input = 'input'.repeat(10_000)
|
||||
const output = 'output'.repeat(20_000)
|
||||
const error = 'error'.repeat(10_000)
|
||||
const batch = [
|
||||
{
|
||||
header: {
|
||||
id: '00000000-0000-4000-8000-000000000301',
|
||||
title: '远程工具会话',
|
||||
updatedAt: 1
|
||||
},
|
||||
messages: [
|
||||
{
|
||||
id: '00000000-0000-4000-8000-000000000302',
|
||||
role: 'assistant',
|
||||
content: '',
|
||||
createdAt: 1,
|
||||
state: 'complete',
|
||||
tools: [
|
||||
{
|
||||
callId: 'remote-tool-call',
|
||||
name: '远程工具',
|
||||
state: 'completed',
|
||||
summary: '完整远程工具结果',
|
||||
input,
|
||||
output,
|
||||
error
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
expect(localConversationSaveBatchSchema.parse(batch)).toEqual(batch)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user