openclaw - ✅(Solved) Fix Heartbeat: treat shipped fenced HEARTBEAT scaffold as effectively empty [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#61492Fetched 2026-04-08 02:58:00
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×1

Freshly bootstrapped workspaces can end up with a HEARTBEAT.md scaffold that is no longer treated as effectively empty, so interval heartbeats keep running even though the file text says to leave it empty/comment-only to skip heartbeat API calls.

Root Cause

The runtime emptiness check in src/auto-reply/heartbeat.ts only treats blank lines, markdown headers, and empty checklist markers as skippable.

The workspace bootstrap path strips only frontmatter from the template and then writes the remaining template body into the real workspace HEARTBEAT.md.

The currently shipped template includes a fenced markdown code block:

`# HEARTBEAT.md Template`
```markdown
comment-only guidance lines

That means the deployed scaffold contains fence lines that are not recognized as empty/comment-only, so the file is no longer considered effectively empty.

Fix Action

Fixed

PR fix notes

PR #61493: Heartbeat: treat shipped scaffold as empty

Description (problem / solution / changelog)

Summary

Treat the shipped markdown-fenced HEARTBEAT.md scaffold as effectively empty so already deployed workspaces stop running interval heartbeats unless the file contains real tasks.

Changes

  • add a narrow scaffold-aware compatibility check in isHeartbeatContentEffectivelyEmpty
  • keep fenced blocks with actionable content treated as non-empty
  • add regression tests for the shipped fenced scaffold, actionable fenced content, and unclosed fences

Validation

  • pnpm test -- src/auto-reply/heartbeat.test.ts

Issue

Closes https://github.com/openclaw/openclaw/issues/61492

Changed files

  • src/auto-reply/heartbeat.test.ts (modified, +33/-7)
  • src/auto-reply/heartbeat.ts (modified, +35/-9)

Code Example

`# HEARTBEAT.md Template`
RAW_BUFFERClick to expand / collapse

Summary

Freshly bootstrapped workspaces can end up with a HEARTBEAT.md scaffold that is no longer treated as effectively empty, so interval heartbeats keep running even though the file text says to leave it empty/comment-only to skip heartbeat API calls.

Root cause

The runtime emptiness check in src/auto-reply/heartbeat.ts only treats blank lines, markdown headers, and empty checklist markers as skippable.

The workspace bootstrap path strips only frontmatter from the template and then writes the remaining template body into the real workspace HEARTBEAT.md.

The currently shipped template includes a fenced markdown code block:

`# HEARTBEAT.md Template`
```markdown
comment-only guidance lines

That means the deployed scaffold contains fence lines that are not recognized as empty/comment-only, so the file is no longer considered effectively empty.

User-visible impact

  • Standard installs can run interval heartbeat API calls when users expect them to be skipped.
  • Some users then see heartbeat prompt noise in the main thread every 30 minutes.
  • Already deployed instances keep the bad scaffold in their workspace even if the docs template is fixed later.

Expected behavior

The shipped scaffold template, including the markdown fence wrapper that current releases seeded into workspaces, should be treated as effectively empty unless it contains real actionable content.

Actual behavior

A scaffolded HEARTBEAT.md that only contains wrapper formatting plus comment-only guidance still triggers heartbeat runs.

Repro

  1. Bootstrap a workspace on a version that seeds the current docs/reference/templates/HEARTBEAT.md content.
  2. Leave HEARTBEAT.md unchanged.
  3. Wait for an interval heartbeat.
  4. Observe that the heartbeat still runs instead of skipping with empty-heartbeat-file.

Scope of fix

This issue is specifically about backward compatibility for already deployed scaffold files. It is not about treating arbitrary fenced code blocks as empty. Fenced blocks with real task content should still count as actionable.

Version

Reproduced on v2026.4.2 and current main.

extent analysis

TL;DR

Update the src/auto-reply/heartbeat.ts to recognize markdown fence lines as skippable to fix the issue with interval heartbeats running on empty HEARTBEAT.md files.

Guidance

  • Review the src/auto-reply/heartbeat.ts file to understand the current emptiness check logic and identify how to extend it to recognize markdown fence lines as skippable.
  • Update the HEARTBEAT.md template to remove the fenced markdown code block or modify it to be recognized as empty by the heartbeat logic.
  • Consider adding a check to remove or modify existing HEARTBEAT.md files in deployed workspaces to ensure backward compatibility.
  • Test the updated logic with different types of markdown content to ensure it correctly identifies empty files.

Example

// Example of updated emptiness check logic in src/auto-reply/heartbeat.ts
const isEffectivelyEmpty = (fileContent: string) => {
  // ... existing logic ...
  const fenceLines = fileContent.match(/^```.*$/gm);
  if (fenceLines && fenceLines.length === fileContent.split('\n').length) {
    return true; // consider file empty if only contains fence lines
  }
  // ... existing logic ...
};

Notes

The fix should focus on updating the emptiness check logic to recognize markdown fence lines as skippable, while ensuring that fenced blocks with real task content are still counted as actionable.

Recommendation

Apply workaround by updating the src/auto-reply/heartbeat.ts file to recognize markdown fence lines as skippable, as this will fix the issue with interval heartbeats running on empty HEARTBEAT.md files without requiring a full template update.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The shipped scaffold template, including the markdown fence wrapper that current releases seeded into workspaces, should be treated as effectively empty unless it contains real actionable content.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING