Problem
isHeartbeatEnabledForAgent in src/infra/heartbeat-runner.ts 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 returns true for the default agent:
return resolvedAgentId === resolveDefaultAgentId(cfg);
This silently enables heartbeat at the default 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(): Only checks per-agent heartbeat, ignores agents.defaults.heartbeat
isHeartbeatEnabledForAgent(): 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
The test "falls back to default agent when no explicit heartbeat entries" asserts the broken behavior as correct — it expects only the default agent to be enabled when agents.defaults.heartbeat is set without per-agent entries.
Also tracked downstream: remoteclaw#623
Problem
isHeartbeatEnabledForAgentinsrc/infra/heartbeat-runner.tshas 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 returnstruefor the default agent:This silently enables heartbeat at the default 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(): Only checks per-agentheartbeat, ignoresagents.defaults.heartbeatisHeartbeatEnabledForAgent(): Fallback logic unconditionally enables heartbeat for default agentExpected behavior
agents.defaults.heartbeatset, no per-agentheartbeaton some agentsExisting tests encode the bug
The test
"falls back to default agent when no explicit heartbeat entries"asserts the broken behavior as correct — it expects only the default agent to be enabled whenagents.defaults.heartbeatis set without per-agent entries.Also tracked downstream: remoteclaw#623