Commits
Click on a commit to change the comparison rangefix: prevent heartbeat events after flow run completes
Fixes a race condition where heartbeat events could be emitted after a
flow run has already completed. This could incorrectly trigger zombie
flow detection automations.
The issue occurred because the periodic heartbeat loop iterates over
_flow_run_process_map and collects flow runs to emit heartbeats for.
Between iteration and actual emission (which involves async lookups),
a flow run could complete and be removed from the map. The heartbeat
would still be emitted, appearing after the terminal state event.
The fix adds a check_incomplete parameter to _emit_flow_run_heartbeat.
When True (used by the periodic heartbeat loop), it verifies the flow
run is still in the process map before emitting. This prevents emitting
heartbeats for flow runs that completed during heartbeat preparation.
Closes #19598
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>13 hours ago
by zzstoatzz