openclaw - 💡(How to fix) Fix Heartbeat: treat shipped markdown-fenced HEARTBEAT scaffold as effectively empty [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#61486Fetched 2026-04-08 02:58:03
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

Fresh OpenClaw installs can end up running heartb optimization, so deployed workspaces now carry a shape the compatibility check does not understand.

Root Cause

  • src/agents/workspace.ts seeds the workspace HEARTBEAT.md from the docs template after stripping only frontmatter.
  • src/auto-reply/heartbeat.ts:isHeartbeatContentEffectivelyEmpty() does not recognize the shipped markdown-fenced scaffold as empty.
RAW_BUFFERClick to expand / collapse

Summary

Fresh OpenClaw installs can end up running heartbeat every interval even when the seeded workspace HEARTBEAT.md is just the stock scaffold.

Expected behavior

A stock scaffolded HEARTBEAT.md should be treated as effectively empty, so interval heartbeat skips the LLM/API call until the user adds real tasks.

Actual behavior

The currently shipped workspace template includes a markdown fence wrapper around comment-only guidance. The runtime emptiness check only treats blank lines, markdown headers, and empty checklist-style lines as skippable. The fence lines are treated as content, so the seeded file is no longer considered empty.

Root cause

  • src/agents/workspace.ts seeds the workspace HEARTBEAT.md from the docs template after stripping only frontmatter.
  • src/auto-reply/heartbeat.ts:isHeartbeatContentEffectivelyEmpty() does not recognize the shipped markdown-fenced scaffold as empty.

Summary

Fresh OpenClaw installs can end up running heartb optimization, so deployed workspaces now carry a shape the compatibility check does not understand.

Impact

  • Standard installs keep running heartbeat every interval even though the seeded file says it should skip.
  • This increases token/API usage unnecessarily.
  • It also increases the chance of heartbeat prompt or internal text surfacing in user-visible threads.

Version

Confirmed on:

  • v2026.4.2
  • current main as of 2026-04-05

Suggested fix

Make the runtime emptiness check backward-compatible with the shipped scaffold by treating markdown-fenced comment-only scaffold content as effectively empty, while still treating fenced content with real tasks as actionable.

This fixes already-deployed instances without mutating user files.

extent analysis

TL;DR

Update the isHeartbeatContentEffectivelyEmpty() function in src/auto-reply/heartbeat.ts to recognize markdown-fenced comment-only scaffold content as empty.

Guidance

  • Review the isHeartbeatContentEffectivelyEmpty() function to understand how it currently checks for empty content and identify why markdown-fenced scaffold content is not treated as empty.
  • Modify the function to specifically handle markdown-fenced comment-only scaffold content, ensuring it is treated as empty while still recognizing fenced content with real tasks as actionable.
  • Test the updated function with various scenarios, including empty files, files with only comment-only scaffold content, and files with real tasks, to ensure the fix works as expected.
  • Consider adding unit tests to cover these scenarios and prevent regressions.

Example

// Example of how the updated isHeartbeatContentEffectivelyEmpty() function might handle markdown-fenced comment-only scaffold content
function isHeartbeatContentEffectivelyEmpty(content: string): boolean {
  // ... existing checks for blank lines, markdown headers, and empty checklist-style lines ...
  // Add a check for markdown-fenced comment-only scaffold content
  if (content.trim().startsWith('```') && content.trim().endsWith('```')) {
    const fencedContent = content.trim().replace(/```/g, '').trim();
    if (fencedContent.startsWith('//') || fencedContent.startsWith('#')) {
      return true; // Treat as empty if fenced content is a comment
    }
  }
  // ... existing logic to check for real tasks ...
}

Notes

The suggested fix should be backward-compatible with existing workspaces and should not mutate user files. However, it's essential to thoroughly test the updated function to ensure it works correctly in all scenarios.

Recommendation

Apply the workaround by updating the isHeartbeatContentEffectivelyEmpty() function to recognize markdown-fenced comment-only scaffold content as empty, as this fix addresses the root cause of the issue and prevents unnecessary token/API usage.

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

A stock scaffolded HEARTBEAT.md should be treated as effectively empty, so interval heartbeat skips the LLM/API call until the user adds real tasks.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Heartbeat: treat shipped markdown-fenced HEARTBEAT scaffold as effectively empty [1 participants]