Migrate iMessage monitor state to SQLite (#88797)

* refactor: move imessage monitor state to sqlite

* test: use OpenClaw temp root in iMessage state helper

* test: avoid pending promise lint in chat tests

* test: harden gateway ci flakes

* test: align session list merge expectation
This commit is contained in:
Peter Steinberger
2026-06-01 00:19:51 +01:00
committed by GitHub
parent 12cf34a8ea
commit 3491834d49
33 changed files with 1691 additions and 745 deletions

View File

@@ -215,6 +215,9 @@ describe("ensureConfigReady", () => {
["Telegram sticker cache", "telegram/sticker-cache.json"],
["Telegram thread bindings", "telegram/thread-bindings-default.json"],
["Telegram pairing allowFrom", "credentials/telegram-allowFrom.json"],
["iMessage reply short-id cache", "imessage/reply-cache.jsonl"],
["iMessage sent echo cache", "imessage/sent-echoes.jsonl"],
["iMessage catchup cursor", "imessage/catchup/default.json"],
["WhatsApp root auth", "credentials/creds.json"],
])("runs doctor flow for bundled channel legacy state: %s", async (_label, relativePath) => {
const root = useTempOpenClawHome();

View File

@@ -66,6 +66,14 @@ function isLegacyTelegramStateFile(name: string): boolean {
);
}
function hasLegacyIMessageStateFiles(stateDir: string): boolean {
return (
fileOrDirExists(path.join(stateDir, "imessage", "reply-cache.jsonl")) ||
fileOrDirExists(path.join(stateDir, "imessage", "sent-echoes.jsonl")) ||
dirHasFile(path.join(stateDir, "imessage", "catchup"), (name) => name.endsWith(".json"))
);
}
function hasBundledChannelLegacyStateMigrationInputs(stateDir: string, oauthDir: string): boolean {
if (fileOrDirExists(path.join(stateDir, "discord", "model-picker-preferences.json"))) {
return true;
@@ -73,6 +81,9 @@ function hasBundledChannelLegacyStateMigrationInputs(stateDir: string, oauthDir:
if (dirHasFile(path.join(stateDir, "feishu", "dedup"), (name) => name.endsWith(".json"))) {
return true;
}
if (hasLegacyIMessageStateFiles(stateDir)) {
return true;
}
if (
fileOrDirExists(path.join(oauthDir, "telegram-allowFrom.json")) ||
dirHasFile(path.join(stateDir, "telegram"), isLegacyTelegramStateFile)