Heartbeat: resolve main session key for session store

This commit is contained in:
Sash Zats
2026-01-06 20:14:30 -05:00
parent eb8d7a19af
commit f1643a5b8d

View File

@@ -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];