Skip to content

fix(heartbeat): honor top-level heartbeat.enabled=false setting#276

Open
ZVNC28 wants to merge 1 commit intoTinyAGI:mainfrom
ZVNC28:fix/heartbeat-global-disable
Open

fix(heartbeat): honor top-level heartbeat.enabled=false setting#276
ZVNC28 wants to merge 1 commit intoTinyAGI:mainfrom
ZVNC28:fix/heartbeat-global-disable

Conversation

@ZVNC28
Copy link
Copy Markdown

@ZVNC28 ZVNC28 commented Apr 10, 2026

Description

The Settings type declared heartbeat.enabled only at the per-agent level (AgentConfig.heartbeat.enabled). A top-level heartbeat.enabled flag in settings.json was silently ignored, and startHeartbeat() was called unconditionally in packages/main/src/index.ts:272, so users had no way to disable the heartbeat interval globally without editing every agent entry.

This came up in practice running an 8-agent team against a single shared inference backend: every hour, all 8 heartbeats fire concurrently and serialize through the same GPU, creating a large backlog. The natural workaround — heartbeat: { enabled: false } at the top of settings.json — compiled fine (TypeScript didn't complain because the field wasn't in the type) but did nothing at runtime.

Changes

  • Add optional top-level heartbeat?: { enabled?: boolean } to the Settings interface in packages/core/src/types.ts
  • Add isHeartbeatEnabled() helper in packages/main/src/heartbeat.ts
  • Short-circuit startHeartbeat() when disabled, logging a clear "Heartbeat disabled (heartbeat.enabled=false in settings)" message instead of silently still creating the interval
  • Also check in tick() as a safety net, so runtime config changes take effect without a daemon restart

Default behavior is unchanged — when the flag is undefined (the common case), heartbeat continues to run exactly as before. Per-agent agent.heartbeat.enabled remains fully supported.

Testing

  • npm run build — clean compile, no new warnings
  • Verified locally that heartbeat: { enabled: false } at the top level now logs "Heartbeat disabled" on daemon start and the interval is never created

Checklist

  • PR title follows conventional commit format
  • I have tested these changes locally
  • My changes don't introduce new warnings or errors
  • I have updated documentation if needed — no existing docs mention heartbeat.enabled; happy to add a note to the README if you'd prefer

The Settings type declared heartbeat.enabled only at the per-agent level
(AgentConfig.heartbeat.enabled). A top-level heartbeat.enabled flag in
settings.json was silently ignored, and startHeartbeat() was called
unconditionally in packages/main/src/index.ts, so users had no way to
disable the heartbeat interval globally without editing every agent entry.

- Add optional top-level heartbeat.enabled to the Settings interface
- Add isHeartbeatEnabled() helper in heartbeat.ts
- Short-circuit startHeartbeat() and tick() when the flag is false
- Log a clear "Heartbeat disabled" message on startup when skipped

Default behavior is unchanged (flag undefined = enabled).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant