@@ -1151,10 +1151,6 @@ describe('watchdog completion provenance', () => {
11511151
11521152 await failPendingToolCall ( toolCall . id , context , execContext )
11531153 const persisted = completeAsyncToolCall . mock . calls [ 0 ] [ 0 ]
1154- expect ( persisted . result ) . toEqual ( {
1155- __sealedClientToolCompletionV1 : expect . any ( String ) ,
1156- __sealedClientToolContextV1 : expect . any ( String ) ,
1157- } )
11581154 waitForToolConfirmation . mockResolvedValue ( {
11591155 status : 'error' ,
11601156 message : persisted . error ,
@@ -1391,18 +1387,34 @@ describe('watchdog completion provenance', () => {
13911387 expect ( registry . isComplete ( ) ) . toBe ( true )
13921388 } )
13931389
1394- it ( 'retains structural failure compatibility when no provenance registry exists ' , async ( ) => {
1390+ it ( 'restores a trusted timeout when its writer had no provenance registry' , async ( ) => {
13951391 const { toolCall, context } = createHungClient ( )
13961392
13971393 await failPendingToolCall ( toolCall . id , context , { userId : 'user-1' } )
13981394
13991395 expect ( toolCall . status ) . toBe ( 'error' )
1400- expect ( completeAsyncToolCall ) . toHaveBeenCalledWith (
1401- expect . objectContaining ( {
1402- result : { error : expect . any ( String ) , outcomeUnknown : true , doNotRetry : true } ,
1403- } )
1404- )
1405- expect ( encryptSecret ) . not . toHaveBeenCalled ( )
1396+ const persisted = completeAsyncToolCall . mock . calls [ 0 ] [ 0 ]
1397+ waitForToolConfirmation . mockResolvedValue ( {
1398+ status : 'error' ,
1399+ message : persisted . error ,
1400+ data : persisted . result ,
1401+ } )
1402+ const completion = await waitForClientToolCompletion ( {
1403+ toolCallId : toolCall . id ,
1404+ runId : context . runId ,
1405+ userId : 'user-1' ,
1406+ timeoutMs : 1 ,
1407+ registry : new ResolvedSecretTraceRegistry ( ) ,
1408+ } )
1409+ expect ( completion ) . toEqual ( {
1410+ status : 'error' ,
1411+ message : expect . stringContaining ( 'outcome is unknown' ) ,
1412+ data : {
1413+ error : expect . stringContaining ( 'never came back' ) ,
1414+ outcomeUnknown : true ,
1415+ doNotRetry : true ,
1416+ } ,
1417+ } )
14061418 } )
14071419
14081420 it . each ( [
0 commit comments