@@ -831,6 +831,44 @@ describe("TriggerChatTransport", function () {
831831 expect ( errors [ 0 ] ?. error . message ) . toBe ( "cleanup delete string failure" ) ;
832832 } ) ;
833833
834+ it ( "normalizes object inactive reconnect cleanup delete failures through onError" , async function ( ) {
835+ const errors : TriggerChatTransportError [ ] = [ ] ;
836+ const runStore = new FailingCleanupDeleteValueRunStore ( {
837+ reason : "cleanup delete object failure" ,
838+ } ) ;
839+ runStore . set ( {
840+ chatId : "chat-inactive-delete-object-failure" ,
841+ runId : "run_inactive_delete_object_failure" ,
842+ publicAccessToken : "pk_inactive_delete_object_failure" ,
843+ streamKey : "chat-stream" ,
844+ lastEventId : "10-0" ,
845+ isActive : false ,
846+ } ) ;
847+
848+ const transport = new TriggerChatTransport ( {
849+ task : "chat-task" ,
850+ stream : "chat-stream" ,
851+ accessToken : "pk_trigger" ,
852+ runStore,
853+ onError : function onError ( error ) {
854+ errors . push ( error ) ;
855+ } ,
856+ } ) ;
857+
858+ const stream = await transport . reconnectToStream ( {
859+ chatId : "chat-inactive-delete-object-failure" ,
860+ } ) ;
861+
862+ expect ( stream ) . toBeNull ( ) ;
863+ expect ( errors ) . toHaveLength ( 1 ) ;
864+ expect ( errors [ 0 ] ) . toMatchObject ( {
865+ phase : "reconnect" ,
866+ chatId : "chat-inactive-delete-object-failure" ,
867+ runId : "run_inactive_delete_object_failure" ,
868+ } ) ;
869+ expect ( errors [ 0 ] ?. error . message ) . toBe ( "[object Object]" ) ;
870+ } ) ;
871+
834872 it ( "returns null when inactive reconnect string cleanup delete and onError both fail" , async function ( ) {
835873 const runStore = new FailingCleanupDeleteValueRunStore ( "cleanup delete string failure" ) ;
836874 runStore . set ( {
0 commit comments