@@ -2,6 +2,7 @@ import { describe, expect, it } from 'vitest'
22import { copilotChatStopBodySchema } from '@/lib/api/contracts/copilot'
33import type { PersistedToolState } from '@/lib/api/contracts/copilot-messages'
44import { toDisplayMessage } from '@/lib/mothership/chat/display-message'
5+ import { getLiveAssistantMessageId } from '@/lib/mothership/chat/live-message-id'
56import type { OrchestratorResult } from '@/lib/mothership/request/types'
67import { getToolDisplayTitle } from '@/lib/mothership/tools/tool-display'
78import { resolveMessageCitations } from '@/app/workspace/[workspaceId]/home/components/message-content/resolve-citations'
@@ -635,22 +636,25 @@ describe('compactToolCallParams', () => {
635636 } )
636637
637638 it . each ( [ 'pending' , 'executing' , 'awaiting_approval' ] as const ) (
638- 'keeps a %s call whole: it can still run or await approval from these params' ,
639+ 'keeps a live %s call whole: it can still run or await approval from these params' ,
639640 ( state ) => {
640- const message = sandboxCall ( state )
641+ const message = { ... sandboxCall ( state ) , id : getLiveAssistantMessageId ( 'stream-1' ) }
641642 expect ( compactToolCallParams ( message ) ) . toBe ( message )
642643 }
643644 )
644645
645- it ( 'bounds an interrupted call, which no reload re-runs or asks to approve' , ( ) => {
646- const compacted = compactToolCallParams ( sandboxCall ( 'interrupted' ) )
647- const stdout = (
648- compacted . contentBlocks ?. [ 0 ] . toolCall ?. params ?. request as {
649- invocation : { stdout : string }
650- }
651- ) . invocation . stdout
652- expect ( stdout . length ) . toBeLessThanOrEqual ( 1024 )
653- } )
646+ it . each ( [ 'pending' , 'executing' , 'awaiting_approval' , 'interrupted' ] as const ) (
647+ 'bounds a stored %s call, which renders as interrupted and never re-runs or asks to approve' ,
648+ ( state ) => {
649+ const compacted = compactToolCallParams ( sandboxCall ( state ) )
650+ const stdout = (
651+ compacted . contentBlocks ?. [ 0 ] . toolCall ?. params ?. request as {
652+ invocation : { stdout : string }
653+ }
654+ ) . invocation . stdout
655+ expect ( stdout . length ) . toBeLessThanOrEqual ( 1024 )
656+ }
657+ )
654658
655659 it ( 'is idempotent and keeps the reference once compacted' , ( ) => {
656660 const compacted = compactToolCallParams ( sandboxCall ( 'error' ) )
0 commit comments