diff --git a/src/infra/heartbeat-runner.ts b/src/infra/heartbeat-runner.ts index 1fa7065bc..f75e37fef 100644 --- a/src/infra/heartbeat-runner.ts +++ b/src/infra/heartbeat-runner.ts @@ -12,6 +12,7 @@ import type { ClawdbotConfig } from "../config/config.js"; import { loadConfig } from "../config/config.js"; import { loadSessionStore, + resolveMainSessionKey, resolveStorePath, type SessionEntry, saveSessionStore, @@ -113,8 +114,8 @@ function resolveHeartbeatAckMaxChars(cfg: ClawdbotConfig) { function resolveHeartbeatSession(cfg: ClawdbotConfig) { const sessionCfg = cfg.session; const scope = sessionCfg?.scope ?? "per-sender"; - const mainKey = (sessionCfg?.mainKey ?? "main").trim() || "main"; - const sessionKey = scope === "global" ? "global" : mainKey; + const sessionKey = + scope === "global" ? "global" : resolveMainSessionKey(cfg); const storePath = resolveStorePath(sessionCfg?.store); const store = loadSessionStore(storePath); const entry = store[sessionKey];