perf(test): speed up vitest by skipping plugins + LLM slug

This commit is contained in:
Peter Steinberger
2026-02-07 07:57:50 +00:00
parent 626a1d0699
commit 9f507112b5
6 changed files with 61 additions and 9 deletions

View File

@@ -122,8 +122,15 @@ const saveSessionToMemory: HookHandler = async (event) => {
messageCount,
});
// Avoid calling the model provider in unit tests, keep hooks fast and deterministic.
if (sessionContent && cfg && !process.env.VITEST && process.env.NODE_ENV !== "test") {
// Avoid calling the model provider in unit tests; keep hooks fast and deterministic.
const isTestEnv =
process.env.OPENCLAW_TEST_FAST === "1" ||
process.env.VITEST === "true" ||
process.env.VITEST === "1" ||
process.env.NODE_ENV === "test";
const allowLlmSlug = !isTestEnv && hookConfig?.llmSlug !== false;
if (sessionContent && cfg && allowLlmSlug) {
log.debug("Calling generateSlugViaLLM...");
// Use LLM to generate a descriptive slug
slug = await generateSlugViaLLM({ sessionContent, cfg });