refactor(heartbeat): remove Completed section and tighten section gating
- Remove ## Completed section from HEARTBEAT.md template; completed tasks should be deleted, not accumulated - Change in_active_section from tri-state (None/True/False) to bool (True/False) so stray text before any ## heading no longer triggers heartbeat - Add test cases for stray pre-heading text and ## Notes section - Update docs/chat-commands.md to reference ## Active Tasks
This commit is contained in:
@@ -107,7 +107,7 @@ _HEARTBEAT_PREAMBLE = (
|
||||
def _heartbeat_has_active_tasks(content: str) -> bool:
|
||||
"""True if HEARTBEAT.md has task lines, ignoring headers, blanks and comments."""
|
||||
in_comment = False
|
||||
in_active_section: bool | None = None
|
||||
in_active_section: bool = False
|
||||
for line in content.splitlines():
|
||||
stripped = line.strip()
|
||||
if in_comment:
|
||||
|
||||
@@ -5,14 +5,10 @@ This file is checked periodically by your nanobot agent.
|
||||
Register it as a cron job (e.g. `cron add --name heartbeat --schedule "every 30m" --message "Check HEARTBEAT.md"`) to get the same behavior as the legacy heartbeat service.
|
||||
|
||||
If this file has no tasks (only headers and comments), the agent will skip it.
|
||||
Completed tasks should be deleted, not kept — heartbeat only reads "Active Tasks".
|
||||
-->
|
||||
|
||||
## Active Tasks
|
||||
|
||||
<!-- Add your periodic tasks below this line -->
|
||||
|
||||
|
||||
## Completed
|
||||
|
||||
<!-- Move completed tasks here or delete them -->
|
||||
|
||||
|
||||
Reference in New Issue
Block a user