





















@@ -11,14 +11,11 @@ import { afterEach, describe, expect, test, vi } from "vitest";
1111import type { OpenClawConfig } from "../config/types.openclaw.js";
1212import {
1313captureCompactionCheckpointSnapshotAsync,
14-captureRuntimeCompactionCheckpointSnapshotAsync,
1514cleanupCompactionCheckpointSnapshot,
1615forkCompactionCheckpointTranscriptAsync,
1716MAX_COMPACTION_CHECKPOINT_LEAF_SCAN_BYTES,
1817MAX_COMPACTION_CHECKPOINT_RETAINED_BYTES_PER_SESSION,
1918persistSessionCompactionCheckpoint,
20-readRuntimeSessionLeafIdFromTranscriptAsync,
21-readSessionLeafIdFromTranscriptAsync,
2219readSessionLeafStateFromTranscriptAsync,
2320resolveCompactionCheckpointTranscriptPosition,
2421} from "./session-compaction-checkpoints.js";
@@ -180,25 +177,6 @@ describe("session-compaction-checkpoints", () => {
180177});
181178});
182179183-test("runtime checkpoint probes do not create session metadata for missing transcripts", async () => {
184-const { storePath, sessionKey } = await makeTempSessionStore(
185-"openclaw-checkpoint-runtime-probe-",
186-"missing-session",
187-);
188-await fs.writeFile(storePath, "{}\n", "utf-8");
189-const scope = {
190-agentId: MAIN_AGENT_ID,
191-sessionId: "missing-session",
192- sessionKey,
193- storePath,
194-};
195-196-await expect(readRuntimeSessionLeafIdFromTranscriptAsync(scope)).resolves.toBeNull();
197-await expect(captureRuntimeCompactionCheckpointSnapshotAsync({ scope })).resolves.toBeNull();
198-199-expect(await fs.readFile(storePath, "utf-8")).toBe("{}\n");
200-});
201-202180test("async capture stores pre-compaction identity without copying the transcript", async () => {
203181const dir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-checkpoint-async-"));
204182tempDirs.push(dir);
@@ -280,7 +258,7 @@ describe("session-compaction-checkpoints", () => {
280258const sessionManagerOpenSpy = vi.spyOn(SessionManager, "open");
281259let snapshot: Awaited<ReturnType<typeof captureCompactionCheckpointSnapshotAsync>> | undefined;
282260try {
283-expect(await readSessionLeafIdFromTranscriptAsync(sessionFile)).toBe(leafId);
261+expect((await readSessionLeafStateFromTranscriptAsync(sessionFile))?.leafId).toBe(leafId);
284262snapshot = await captureCompactionCheckpointSnapshotAsync({
285263 sessionFile,
286264});
@@ -355,7 +333,6 @@ describe("session-compaction-checkpoints", () => {
355333"utf-8",
356334);
357335358-expect(await readSessionLeafIdFromTranscriptAsync(sessionFile)).toBe("active-tail");
359336expect(await readSessionLeafStateFromTranscriptAsync(sessionFile)).toEqual({
360337entryId: "post-leaf-metadata",
361338leafId: "active-tail",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。