From 2c4aecb9c33e793a405ffd712dd3ca655c53e937 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 8 May 2026 15:29:43 +0100 Subject: [PATCH] test: use sqlite locator for codex compaction --- extensions/codex/src/app-server/compact.test.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/extensions/codex/src/app-server/compact.test.ts b/extensions/codex/src/app-server/compact.test.ts index 7e4e38a9e86..53c6955ce6a 100644 --- a/extensions/codex/src/app-server/compact.test.ts +++ b/extensions/codex/src/app-server/compact.test.ts @@ -2,6 +2,7 @@ import fs from "node:fs/promises"; import os from "node:os"; import path from "node:path"; import type { HarnessContextEngine as ContextEngine } from "openclaw/plugin-sdk/agent-harness-runtime"; +import { createSqliteSessionTranscriptLocator } from "openclaw/plugin-sdk/session-store-runtime"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import type { CodexAppServerClient } from "./client.js"; import { maybeCompactCodexAppServerSession, __testing } from "./compact.js"; @@ -14,8 +15,12 @@ import { let tempDir: string; +function testSessionFile(suffix = "session-1"): string { + return createSqliteSessionTranscriptLocator({ agentId: "main", sessionId: suffix }); +} + async function writeTestBinding(options: { authProfileId?: string } = {}): Promise { - const sessionFile = path.join(tempDir, "session.jsonl"); + const sessionFile = testSessionFile(); await writeCodexAppServerBinding( { sessionKey: "agent:main:session-1", sessionFile }, { @@ -164,7 +169,7 @@ describe("maybeCompactCodexAppServerSession", () => { const fake = createFakeCodexClient(); const factory = vi.fn(async () => fake.client); __testing.setCodexAppServerClientFactoryForTests(factory); - const sessionFile = path.join(tempDir, "session.jsonl"); + const sessionFile = testSessionFile("auth-profile-mismatch"); await writeCodexAppServerBinding(sessionFile, { threadId: "thread-1", cwd: tempDir,