fix(heartbeat): add subagent guard to resolveHeartbeatSession production code

This commit is contained in:
EVA
2026-04-06 16:27:59 +07:00
committed by Josh Lehman
parent aa56b9670d
commit cb3ab1a40c

View File

@@ -44,7 +44,6 @@ import { CommandLane } from "../process/lanes.js";
import {
isSubagentSessionKey,
normalizeAgentId,
parseAgentSessionKey,
resolveAgentIdFromSessionKey,
toAgentStoreSessionKey,
} from "../routing/session-key.js";
@@ -593,11 +592,7 @@ export async function runHeartbeatOnce(opts: {
}): Promise<HeartbeatRunResult> {
const cfg = opts.cfg ?? loadConfig();
const explicitAgentId = typeof opts.agentId === "string" ? opts.agentId.trim() : "";
const forcedSessionAgentId =
explicitAgentId.length > 0 ? undefined : parseAgentSessionKey(opts.sessionKey)?.agentId;
const agentId = normalizeAgentId(
explicitAgentId || forcedSessionAgentId || resolveDefaultAgentId(cfg),
);
const agentId = normalizeAgentId(explicitAgentId || resolveDefaultAgentId(cfg));
const heartbeat = opts.heartbeat ?? resolveHeartbeatConfig(cfg, agentId);
if (!areHeartbeatsEnabled()) {
return { status: "skipped", reason: "disabled" };