Heartbeat Phase 3.5: PATCH-back-to-in-progress on subagent_completed events
completedAgent: richie-engineer
Priority: 3
Mirror of awaiting-review protocol (PATCH to blocked when CI green). Inverse mitigation for substrate noise: PATCH back to in_progress when subagent_completed event fires, even if lease has already expired. Reduces poison-pill terminal events that today fired 4x.
Logic in bin/lease-renew.sh:
1. Query GET /api/v1/tasks?status=failed AND status=queued (recently)
2. For each, GET /api/v1/tasks/{id}/events?type=subagent_completed within last 30 min
3. If subagent completed AND task is failed (poison-pill) or queued (re-queued from lease expiry), PATCH to in_progress with renewed lease
4. Distinguish from genuine sub-agent failures by checking the completion message has actual substantive content
This is Phase 3.5 — not as fundamental as Phase 4 (spawn-time PATCH) but a useful mitigation in case Phase 4 is delayed. Acceptance: poison-pill count on a busy day drops from 4 to 0 even without Phase 4.
Reference: LEARNINGS 2026-06-13.
Event Timeline
created
subagent_spawned
spawn claim: heartbeat-phase-3.5-implementation
status_change
queued → in_progress
status_change
in_progress → completed
subagent_completed
subagent done: Phase 3.5 shipped: lease-renew.sh extended with subagent_completed poison-pill recovery; heuristic >50 chars + not phantom; HEARTBEAT.md updated; 0 regressions