@@ -433,6 +433,58 @@ describe("getReplyFromConfig message hooks", () => {
433433 expect ( mocks . applyLinkUnderstanding ) . not . toHaveBeenCalled ( ) ;
434434 } ) ;
435435
436+ it ( "keeps cached sticker media attached without repeating media understanding" , async ( ) => {
437+ const stickerPath = "/tmp/cached-sticker.webp" ;
438+
439+ await getReplyFromConfig (
440+ buildCtx ( {
441+ Body : "[Sticker] Cached description" ,
442+ BodyForAgent : "[Sticker] Cached description" ,
443+ RawBody : "[Sticker] Cached description" ,
444+ CommandBody : "[Sticker] Cached description" ,
445+ BodyForCommands : "[Sticker] Cached description" ,
446+ MediaPath : stickerPath ,
447+ MediaUrl : stickerPath ,
448+ MediaPaths : [ stickerPath ] ,
449+ MediaUrls : [ stickerPath ] ,
450+ MediaType : "image/webp" ,
451+ MediaTypes : [ "image/webp" ] ,
452+ Sticker : { cachedDescription : "Cached description" } ,
453+ StickerMediaIncluded : true ,
454+ SkipStickerMediaUnderstanding : true ,
455+ } ) ,
456+ undefined ,
457+ withFastReplyConfig ( { } ) ,
458+ ) ;
459+
460+ expect ( mocks . applyMediaUnderstanding ) . not . toHaveBeenCalled ( ) ;
461+ } ) ;
462+
463+ it ( "still understands supplemental media attached to a cached sticker reply" , async ( ) => {
464+ await getReplyFromConfig (
465+ buildCtx ( {
466+ Body : "[Sticker] Cached description" ,
467+ BodyForAgent : "[Sticker] Cached description" ,
468+ RawBody : "[Sticker] Cached description" ,
469+ CommandBody : "[Sticker] Cached description" ,
470+ BodyForCommands : "[Sticker] Cached description" ,
471+ MediaPath : "/tmp/cached-sticker.webp" ,
472+ MediaUrl : "/tmp/cached-sticker.webp" ,
473+ MediaPaths : [ "/tmp/cached-sticker.webp" , "/tmp/replied-audio.ogg" ] ,
474+ MediaUrls : [ "/tmp/cached-sticker.webp" , "/tmp/replied-audio.ogg" ] ,
475+ MediaType : "image/webp" ,
476+ MediaTypes : [ "image/webp" , "audio/ogg" ] ,
477+ Sticker : { cachedDescription : "Cached description" } ,
478+ StickerMediaIncluded : true ,
479+ SkipStickerMediaUnderstanding : true ,
480+ } ) ,
481+ undefined ,
482+ withFastReplyConfig ( { } ) ,
483+ ) ;
484+
485+ expect ( mocks . applyMediaUnderstanding ) . toHaveBeenCalledOnce ( ) ;
486+ } ) ;
487+
436488 it ( "continues dispatching when media understanding fails before reply routing" , async ( ) => {
437489 mocks . applyMediaUnderstanding . mockRejectedValueOnce (
438490 new Error ( "Cannot find module '/tmp/openclaw/dist/media-understanding/apply.runtime-old.js'" ) ,
0 commit comments