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).
This commit is contained in:
hope 2026-03-17 09:04:55 +08:00
parent 950ed293d3
commit 2b8da13d36

View File

@ -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",