Skip to content

Commit 82b345f

Browse files
committed
test(gateway): document legacy image row retention
1 parent 4b6677a commit 82b345f

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

‎src/gateway/cli-session-history.test.ts‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,36 @@ describe("cli session history", () => {
736736
expect(merged).toEqual([localMessage, importedMessage]);
737737
});
738738

739+
it("retains legacy captioned imports near matching local image turns", () => {
740+
const timestamp = Date.parse("2026-03-26T16:29:54.500Z");
741+
const importedMessage = {
742+
role: "user",
743+
content: "look at this\n\n@/Users/demo/workspace/.openclaw-cli-images/cafe06.png",
744+
timestamp: timestamp + 60_000,
745+
__openclaw: {
746+
importedFrom: "claude-cli",
747+
cliSessionId: "session-1",
748+
externalId: "legacy-captioned-image-user",
749+
},
750+
};
751+
const localMessage = {
752+
role: "user",
753+
content: "look at this",
754+
timestamp,
755+
__openclaw: {
756+
id: "local-captioned-image",
757+
media: [{ kind: "image", contentType: "image/png", path: "/media/inbound/cafe06.png" }],
758+
},
759+
};
760+
761+
const merged = mergeImportedChatHistoryMessages({
762+
localMessages: [localMessage],
763+
importedMessages: [importedMessage],
764+
});
765+
766+
expect(merged).toEqual([localMessage, importedMessage]);
767+
});
768+
739769
it("matches same-caption image imports to their exact local turns", () => {
740770
const timestamp = Date.parse("2026-03-26T16:29:54.500Z");
741771
const localEntryId = "local-image-b";

0 commit comments

Comments
 (0)