#6094: auto-reply: ignore HTML comments in heartbeat check
Cluster:
Heartbeat Functionality Improvements
- strip single-line and multi-line HTML comments before testing heartbeat content
- preserve state across lines so trailing comments don’t trigger false positives
- add unit coverage for comment-only files and mixed comment/task scenarios
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates `isHeartbeatContentEffectivelyEmpty` to strip HTML comments (`<!-- ... -->`) before evaluating whether HEARTBEAT.md contains actionable content, including support for multi-line comments by tracking “in comment” state across lines. It also adds unit tests covering comment-only files, mixed comment/task content, and multi-line HTML comment blocks.
The change fits into the auto-reply heartbeat flow by reducing false positives when HEARTBEAT.md contains only HTML comments (or comments around tasks), so the heartbeat check more accurately decides when there is meaningful work to do.
<h3>Confidence Score: 4/5</h3>
- This PR is likely safe to merge; changes are small, localized, and covered by new unit tests.
- The logic change is confined to comment-stripping within `isHeartbeatContentEffectivelyEmpty` and is exercised by added tests for single-line and multi-line HTML comments plus mixed content. Main remaining risk is semantic: stripping `<!-- -->` sequences could remove intended literal content if users include them in tasks, so clarifying intended behavior with an additional test would improve confidence.
- src/auto-reply/heartbeat.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#3335: Fixes cron jobs
by hkirat · 2026-01-28
81.7%
#12365: test(heartbeat): don't skip empty HEARTBEAT.md for cron wake events
by tyclaudius-ai · 2026-02-09
81.6%
#23588: fix(auto-reply): suppress repetitive HEARTBEAT_OK loops
by mohandshamada · 2026-02-22
79.1%
#11859: fix: filter HEARTBEAT_OK messages from chat.history when showOk is ...
by Zjianru · 2026-02-08
77.8%
#15575: fix(heartbeat): suppress prefixed HEARTBEAT_OK ack replies (#15505)
by TsekaLuk · 2026-02-13
75.5%
#17371: fix(heartbeat): always strip HEARTBEAT_OK token from reply text
by BinHPdev · 2026-02-15
75.4%
#15422: fix(auto-reply): keep cron systemEvent payloads that start with 'Re...
by liuxiaopai-ai · 2026-02-13
75.4%
#11647: fix(webchat): filter HEARTBEAT_OK messages from chat.history response
by liuxiaopai-ai · 2026-02-08
75.0%
#11889: fix(chat): filter HEARTBEAT_OK messages in chat.history when showOk...
by bendyclaw · 2026-02-08
74.8%
#6110: refactor: simplify boolean logic using nullish coalescing
by T1mn · 2026-02-01
74.7%