Problem
isHeartbeatEnabledForAgent in src/infra/heartbeat-runner.ts:113-123 has two bugs:
Bug 1: Default agent gets heartbeat with zero configuration
When no heartbeat is configured anywhere (no agents.defaults.heartbeat, no per-agent heartbeat), the fallback at line 122 returns true for the default agent:
return resolvedAgentId === resolveDefaultAgentId(cfg);
This silently enables heartbeat at the default 1h interval for the default agent even though nobody asked for it. If no heartbeat is configured, heartbeat should be disabled for all agents.
Bug 2: agents.defaults.heartbeat is ignored for enabled/disabled decision
When agents.defaults.heartbeat IS configured but no individual agent has a per-agent heartbeat property, hasExplicitHeartbeatAgents() returns false (it only scans list[].heartbeat, not defaults). The function then falls through to the same default-agent-only fallback, meaning only the default agent gets heartbeat — even though the user explicitly configured heartbeat defaults intending it for all agents.
Affected code
hasExplicitHeartbeatAgents() (line 108-111): Only checks per-agent heartbeat, ignores agents.defaults.heartbeat
isHeartbeatEnabledForAgent() (line 113-123): Fallback logic unconditionally enables heartbeat for default agent
Expected behavior
| Configuration |
Expected |
| No heartbeat anywhere |
All agents disabled |
agents.defaults.heartbeat set, no per-agent |
All agents enabled (using defaults) |
Per-agent heartbeat on some agents |
Only those agents enabled |
| Both defaults and per-agent |
Per-agent agents enabled; agents without per-agent inherit defaults |
Existing tests encode the bug
Test at line 228-237 asserts the broken behavior as correct:
it("falls back to default agent when no explicit heartbeat entries", () => {
// cfg has agents.defaults.heartbeat but no per-agent heartbeat
// asserts only default agent enabled — THIS IS THE BUG
});
Problem
isHeartbeatEnabledForAgentinsrc/infra/heartbeat-runner.ts:113-123has two bugs:Bug 1: Default agent gets heartbeat with zero configuration
When no heartbeat is configured anywhere (no
agents.defaults.heartbeat, no per-agentheartbeat), the fallback at line 122 returnstruefor the default agent:This silently enables heartbeat at the default 1h interval for the default agent even though nobody asked for it. If no heartbeat is configured, heartbeat should be disabled for all agents.
Bug 2:
agents.defaults.heartbeatis ignored for enabled/disabled decisionWhen
agents.defaults.heartbeatIS configured but no individual agent has a per-agentheartbeatproperty,hasExplicitHeartbeatAgents()returnsfalse(it only scanslist[].heartbeat, not defaults). The function then falls through to the same default-agent-only fallback, meaning only the default agent gets heartbeat — even though the user explicitly configured heartbeat defaults intending it for all agents.Affected code
hasExplicitHeartbeatAgents()(line 108-111): Only checks per-agentheartbeat, ignoresagents.defaults.heartbeatisHeartbeatEnabledForAgent()(line 113-123): Fallback logic unconditionally enables heartbeat for default agentExpected behavior
agents.defaults.heartbeatset, no per-agentheartbeaton some agentsExisting tests encode the bug
Test at line 228-237 asserts the broken behavior as correct: