diff --git a/extensions/feishu/src/test-support/lifecycle-test-support.ts b/extensions/feishu/src/test-support/lifecycle-test-support.ts index beb926ccb867..79acc29ecd3d 100644 --- a/extensions/feishu/src/test-support/lifecycle-test-support.ts +++ b/extensions/feishu/src/test-support/lifecycle-test-support.ts @@ -3,7 +3,7 @@ import { randomUUID } from "node:crypto"; import { createPluginRuntimeMock } from "openclaw/plugin-sdk/channel-test-helpers"; import { expect, vi, type Mock } from "vitest"; import type { ClawdbotConfig, PluginRuntime, RuntimeEnv } from "../../runtime-api.js"; -import { setFeishuRuntime } from "../runtime.js"; +import { getFeishuRuntime, setFeishuRuntime } from "../runtime.js"; import type { ResolvedFeishuAccount } from "../types.js"; const FEISHU_LIFECYCLE_WAIT_TIMEOUT_MS = 10_000; @@ -437,6 +437,9 @@ export async function setupFeishuLifecycleHandler(params: { } else { params.createEventDispatcherMock.mockReturnValue({ register }); } + getFeishuRuntime().config.current = vi.fn( + () => params.cfg, + ) as unknown as PluginRuntime["config"]["current"]; const monitorSingleAccount = await loadMonitorSingleAccount(); await monitorSingleAccount({ diff --git a/src/gateway/session-transcript-files.fs.ts b/src/gateway/session-transcript-files.fs.ts index e7282c7dbb50..afdabcd4e26b 100644 --- a/src/gateway/session-transcript-files.fs.ts +++ b/src/gateway/session-transcript-files.fs.ts @@ -371,7 +371,7 @@ export async function resolveSessionTranscriptResetArchiveCandidatesAsync( ).flatMap((identityArchives) => identityArchives .flatMap((archive) => (archive ? [archive] : [])) - .sort( + .toSorted( (left, right) => right.timestamp - left.timestamp || right.name.localeCompare(left.name), ) .slice(0, 1), diff --git a/src/gateway/session-utils.fs.test.ts b/src/gateway/session-utils.fs.test.ts index cb0ed301178a..4783c7bfd1f9 100644 --- a/src/gateway/session-utils.fs.test.ts +++ b/src/gateway/session-utils.fs.test.ts @@ -839,7 +839,7 @@ describe("readSessionMessages", () => { ]); clearSessionTranscriptIndexCache(); - const originalReaddir = fs.promises.readdir.bind(fs.promises) as typeof fs.promises.readdir; + const originalReaddir = fs.promises.readdir.bind(fs.promises); let wroteActiveTranscript = false; const readdirSpy = vi.spyOn(fs.promises, "readdir").mockImplementation((async ( ...args: unknown[]