fix: stabilize qa lab capture store cleanup

This commit is contained in:
Peter Steinberger
2026-04-26 09:13:18 +01:00
parent 7e376e5aba
commit 1323683d72
5 changed files with 86 additions and 5 deletions

View File

@@ -113,6 +113,10 @@ const captureMock = vi.hoisted(() => {
});
vi.mock("openclaw/plugin-sdk/proxy-capture", () => ({
acquireDebugProxyCaptureStore: () => ({
store: captureMock.store,
release: captureMock.store.close,
}),
getDebugProxyCaptureStore: () => captureMock.store,
resolveDebugProxySettings: () => ({
dbPath: process.env.OPENCLAW_DEBUG_PROXY_DB_PATH ?? "",

View File

@@ -3,7 +3,7 @@ import { createServer, type IncomingMessage } from "node:http";
import path from "node:path";
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
import {
getDebugProxyCaptureStore,
acquireDebugProxyCaptureStore,
resolveDebugProxySettings,
} from "openclaw/plugin-sdk/proxy-capture";
import { closeQaHttpServer, handleQaBusRequest, writeError, writeJson } from "./bus-server.js";
@@ -168,7 +168,11 @@ export async function startQaLabServer(
): Promise<QaLabServerHandle> {
const repoRoot = path.resolve(params?.repoRoot ?? process.cwd());
const captureSettings = resolveDebugProxySettings();
const captureStore = getDebugProxyCaptureStore(captureSettings.dbPath, captureSettings.blobDir);
const captureStoreLease = acquireDebugProxyCaptureStore(
captureSettings.dbPath,
captureSettings.blobDir,
);
const captureStore = captureStoreLease.store;
const state = createQaBusState();
let latestReport: QaLabLatestReport | null = null;
let latestScenarioRun: QaLabScenarioRun | null = null;
@@ -639,7 +643,7 @@ export async function startQaLabServer(
await runnerModelCatalogPromise?.catch(() => undefined);
await gateway?.stop();
await closeQaHttpServer(server);
captureStore.close();
captureStoreLease.release();
},
};
labHandle = lab;