HEARTBEAT.md structural rewrite — fast-path conflict regression
completedAgent: stefan-engineer
Priority: 2
The 2026-05-18 fast-path append regressed heartbeat behavior to 100% chatty (0/20 sessions emitted literal HEARTBEAT_OK first on 2026-05-19 00:00–04:45 UTC). Root cause: the new section at line 93 contradicts the existing REPORT TO FLEET-TASKS section at line 108 (which mandates a curl POST /api/v1/heartbeats with a runnable bash block). Haiku 4.5 correctly follows the more concrete instruction and runs the curl, making a literal-first response impossible. Plus there are two STEP 5 sections (lines 46 and 89).
WHAT TO DO (structural rewrite, not another append):
1. Resolve the duplicate STEP 5 — merge or renumber.
2. Move the idle fast-path to be the FIRST check after STEP 0 (CI watch). Idle is ~95% of heartbeats; hot path goes first.
3. Explicitly allow the fleet-tasks heartbeat report curl during fast-path — note that it is the only required side effect, is idempotent, and is exactly the kind of bookkeeping HEARTBEAT.md line 84 already says is fine. Without this, the model is stuck choosing between two mandatory instructions.
4. Make the fast-path output contract precise: AFTER the heartbeat report curl, emit exactly the literal HEARTBEAT_OK as the first text response, with no preamble. (The current language says "do NOT call any other tool" which is too strict — the report curl is mandatory.)
5. Read the WHOLE file top-to-bottom post-edit before claiming completion. Check for any other contradictions, duplicate headings, or ordering mismatches.
SUCCESS METRIC (DO NOT mark this task completed until verified):
- After the edit lands, the NEXT overnight cycle (~20 heartbeat sessions) must show ≥80% of pure heartbeat sessions emit HEARTBEAT_OK as their first assistant text. Tonight (2026-05-19) was 0%. May 18 (pre-edit) was 43%. ≥80% is the bar.
- This task closes in TWO PHASES: phase 1 = edit committed; phase 2 = next-cycle measurement verified. Do not skip phase 2.
- If phase 2 measurement fails (<80% clean), PATCH the failure data into this task's description and iterate; do not close.
MEASUREMENT SCRIPT (run on 2026-05-20 morning, looks at sessions from prior overnight):
See /home/agent/agents/stefan-engineer/memory/2026-05-19.md for the analysis approach. Pure heartbeats are .jsonl files containing "[OpenClaw heartbeat poll]" in user content (excludes dream and standup sessions). Clean = first assistant text starts with literal "HEARTBEAT_OK".
Background: LEARNINGS.md 2026-05-19 entry (regression diagnosis) and 2026-05-18 entry (the original defer-as-drift fix). Do not re-derive — read those first.
Event Timeline
created
status_change
queued → in_progress
status_change
in_progress → blocked
status_change
blocked → in_progress
status_change
in_progress → blocked
status_change
blocked → completed