@@ -866,7 +866,7 @@ describe("createTelegramBot", () => {
866866 expect ( answerCallbackQuerySpy ) . toHaveBeenCalledWith ( "cbq-approve-target" ) ;
867867 } ) ;
868868
869- it ( "keeps legacy plugin fallback approval failures retryable for target-only recipients" , async ( ) => {
869+ it ( "treats expired approval callbacks as handled for target-only recipients" , async ( ) => {
870870 onSpy . mockClear ( ) ;
871871 editMessageReplyMarkupSpy . mockClear ( ) ;
872872 editMessageTextSpy . mockClear ( ) ;
@@ -898,23 +898,21 @@ describe("createTelegramBot", () => {
898898 throw new Error ( "Expected Telegram callback_query handler" ) ;
899899 }
900900
901- await expect (
902- callbackHandler ( {
903- callbackQuery : {
904- id : "cbq-legacy-plugin-fallback-blocked" ,
905- data : "/approve 138e9b8c allow-once" ,
906- from : { id : 9 , first_name : "Ada" , username : "ada_bot" } ,
907- message : {
908- chat : { id : 1234 , type : "private" } ,
909- date : 1736380800 ,
910- message_id : 25 ,
911- text : "Legacy plugin approval required." ,
912- } ,
901+ await callbackHandler ( {
902+ callbackQuery : {
903+ id : "cbq-expired-approval" ,
904+ data : "/approve 138e9b8c allow-once" ,
905+ from : { id : 9 , first_name : "Ada" , username : "ada_bot" } ,
906+ message : {
907+ chat : { id : 1234 , type : "private" } ,
908+ date : 1736380800 ,
909+ message_id : 25 ,
910+ text : "Legacy plugin approval required." ,
913911 } ,
914- me : { username : "openclaw_bot" } ,
915- getFile : async ( ) => ( { download : async ( ) => new Uint8Array ( ) } ) ,
916- } ) ,
917- ) . rejects . toThrow ( "unknown or expired approval id" ) ;
912+ } ,
913+ me : { username : "openclaw_bot" } ,
914+ getFile : async ( ) => ( { download : async ( ) => new Uint8Array ( ) } ) ,
915+ } ) ;
918916
919917 const approvalCall = execApprovalCall ( ) ;
920918 const execApprovals = execApprovalTargetConfig ( approvalCall ) ;
@@ -924,10 +922,13 @@ describe("createTelegramBot", () => {
924922 expect ( approvalCall . decision ) . toBe ( "allow-once" ) ;
925923 expect ( approvalCall . allowPluginFallback ) . toBe ( false ) ;
926924 expect ( approvalCall . senderId ) . toBe ( "9" ) ;
927- expect ( editMessageReplyMarkupSpy ) . not . toHaveBeenCalled ( ) ;
925+ expect ( editMessageReplyMarkupSpy ) . toHaveBeenCalledTimes ( 1 ) ;
926+ expect ( editMessageReplyMarkupSpy ) . toHaveBeenCalledWith ( 1234 , 25 , {
927+ reply_markup : { inline_keyboard : [ ] } ,
928+ } ) ;
928929 expect ( replySpy ) . not . toHaveBeenCalled ( ) ;
929930 expect ( sendMessageSpy ) . not . toHaveBeenCalled ( ) ;
930- expect ( answerCallbackQuerySpy ) . toHaveBeenCalledWith ( "cbq-legacy-plugin-fallback-blocked " ) ;
931+ expect ( answerCallbackQuerySpy ) . toHaveBeenCalledWith ( "cbq-expired-approval " ) ;
931932 } ) ;
932933
933934 it ( "keeps plugin approval callback buttons for target-only recipients" , async ( ) => {
0 commit comments