@@ -3384,6 +3384,43 @@ describe("createTelegramBot", () => {
33843384 expect ( editMessageTextSpy ) . toHaveBeenCalledTimes ( 1 ) ;
33853385 } ) ;
33863386
3387+ it ( "does not swallow unprefixed command pagination edit failures" , async ( ) => {
3388+ createTelegramBot ( { token : "tok" } ) ;
3389+ const callbackHandler = getOnHandler ( "callback_query" ) ;
3390+
3391+ const ctx = {
3392+ update : { update_id : 778 } ,
3393+ callbackQuery : {
3394+ id : "cbq-commands-non-telegram-edit-1" ,
3395+ data : "commands_page_2:main" ,
3396+ from : { id : 9 , first_name : "Ada" , username : "ada_bot" } ,
3397+ message : {
3398+ chat : { id : 1234 , type : "private" } ,
3399+ date : 1736380800 ,
3400+ message_id : 21 ,
3401+ } ,
3402+ } ,
3403+ me : { username : "openclaw_bot" } ,
3404+ getFile : async ( ) => ( { download : async ( ) => new Uint8Array ( ) } ) ,
3405+ } ;
3406+
3407+ editMessageTextSpy . mockRejectedValueOnce ( new Error ( "message can't be edited" ) ) ;
3408+
3409+ await expect (
3410+ runTelegramMiddlewareChain ( {
3411+ ctx,
3412+ finalHandler : callbackHandler ,
3413+ } ) ,
3414+ ) . rejects . toThrow ( "message can't be edited" ) ;
3415+
3416+ await runTelegramMiddlewareChain ( {
3417+ ctx,
3418+ finalHandler : callbackHandler ,
3419+ } ) ;
3420+
3421+ expect ( editMessageTextSpy ) . toHaveBeenCalledTimes ( 2 ) ;
3422+ } ) ;
3423+
33873424 it ( "retries command pagination callbacks after a bubbled preflight failure" , async ( ) => {
33883425 const listSkillCommandsMock = listSkillCommandsForAgents as unknown as ReturnType < typeof vi . fn > ;
33893426 listSkillCommandsMock . mockClear ( ) ;
0 commit comments