From 2b8da13d36600474009af8f67080e931305cfa37 Mon Sep 17 00:00:00 2001 From: hope Date: Tue, 17 Mar 2026 09:04:55 +0800 Subject: [PATCH] test: fix per-agent timeoutSeconds test to use correct session key - Import resolveAgentMainSessionKey from sessions.js - Use resolveAgentMainSessionKey({ cfg, agentId: 'ops' }) instead of resolveMainSessionKey(cfg) - Matches established pattern in heartbeat-runner.returns-default-unset.test.ts Addresses Greptile review feedback: per-agent test was seeding wrong session key, causing test to pass for wrong reason (missing session triggers unconditional heartbeat). --- src/infra/heartbeat-runner.timeout.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/infra/heartbeat-runner.timeout.test.ts b/src/infra/heartbeat-runner.timeout.test.ts index 9ba53d6e2c5..3ffbb3c2454 100644 --- a/src/infra/heartbeat-runner.timeout.test.ts +++ b/src/infra/heartbeat-runner.timeout.test.ts @@ -5,7 +5,7 @@ import { whatsappPlugin } from "../../extensions/whatsapp/src/channel.js"; import { setWhatsAppRuntime } from "../../extensions/whatsapp/src/runtime.js"; import * as replyModule from "../auto-reply/reply.js"; import type { OpenClawConfig } from "../config/config.js"; -import { resolveMainSessionKey } from "../config/sessions.js"; +import { resolveAgentMainSessionKey, resolveMainSessionKey } from "../config/sessions.js"; import { setActivePluginRegistry } from "../plugins/runtime.js"; import { createPluginRuntime } from "../plugins/runtime/index.js"; import { createTestRegistry } from "../test-utils/channel-plugins.js"; @@ -198,7 +198,7 @@ describe("runHeartbeatOnce – timeoutOverrideSeconds passthrough", () => { channels: { whatsapp: { allowFrom: ["*"] } }, session: { store: storePath }, }; - const sessionKey = resolveMainSessionKey(cfg); + const sessionKey = resolveAgentMainSessionKey({ cfg, agentId: "ops" }); await seedSessionStore(storePath, sessionKey, { updatedAt: 0, lastChannel: "whatsapp",