From 7b27c0495ed0aa92da2a929ea8b6920ea2e1281e Mon Sep 17 00:00:00 2001 From: Shakker Date: Mon, 25 May 2026 16:10:12 +0100 Subject: [PATCH] test: cover text-only media followups --- .../reply/get-reply-run.media-only.test.ts | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/auto-reply/reply/get-reply-run.media-only.test.ts b/src/auto-reply/reply/get-reply-run.media-only.test.ts index eaa8956ed63..848ca99e27c 100644 --- a/src/auto-reply/reply/get-reply-run.media-only.test.ts +++ b/src/auto-reply/reply/get-reply-run.media-only.test.ts @@ -1076,6 +1076,35 @@ describe("runPreparedReply media-only handling", () => { }); }); + it("does not copy prior session media onto text-only followups", async () => { + await runPreparedReply( + baseParams({ + ctx: { + Body: "follow up without media", + RawBody: "follow up without media", + CommandBody: "follow up without media", + OriginatingChannel: "telegram", + OriginatingTo: "42", + ChatType: "direct", + }, + sessionCtx: { + Body: "follow up without media", + BodyStripped: "follow up without media", + Provider: "telegram", + OriginatingChannel: "telegram", + OriginatingTo: "42", + ChatType: "direct", + MediaPath: "/tmp/previous-image.png", + MediaPaths: ["/tmp/previous-image.png"], + MediaTypes: ["image/png"], + }, + }), + ); + + const call = requireRunReplyAgentCall(); + expect(call.followupRun.userMessageForPersistence).toBeUndefined(); + }); + it("does not rehydrate current MediaPaths after image understanding enriched the prompt", async () => { const tmpDir = await mkdtemp(path.join(os.tmpdir(), "openclaw-followup-image-")); cleanupPaths.push(tmpDir);