Fix #21734: Use wildcard in zombie flow detection docs for custom state names#21736
Conversation
Update the detect-zombie-flows docs to use prefect.flow-run.* wildcard in the expect set instead of listing individual state names. This ensures the automation works correctly when flows return custom-named states, since flow run event names use the state's name rather than its type. Co-authored-by: Alexander Streed <alexander.streed@prefect.io>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
This doesn't fix the issue in #21734 Matching a wild card would mean matching ANY state, which means that no detection of zombie flow is made. What one should be able to do is specify state types in the expect block of an automation trigger, so that I can expect any COMPLETED state type regardless of its name. |
|
@NicholasPini, matching any state won't break zombie detection; it will broaden the conditions necessary to disarm the automation after each heartbeat event. Every heartbeat event arms the automation and may also disarm the previously armed proactive trigger. The proposed update to the automation will improve behavior for flow runs with retries and long retry delays since those flows will transition to Another possible solution is to include custom state names in your automation for finer-grained control. I'm working on a design to bring zombie flow run detection directly into the orchestration engine, so I think updating the documentation to show how to modify this automation for different use cases is a reasonable short-term solution. |
Document the alternative approach of explicitly listing custom state names in the expect set for finer-grained control, alongside the wildcard approach. Co-authored-by: Alexander Streed <alexander.streed@prefect.io>
closes #21734
Updates the zombie flow detection guide to use a
prefect.flow-run.*wildcard in the automation'sexpectset instead of listing individual terminal state names (Completed,Failed,Cancelled,Crashed).Flow run event names are based on the state's name, not its type. This means a flow finishing in a
COMPLETEDstate with a custom name (e.g.,Completed(name="SuccessfullyProcessed")) emitsprefect.flow-run.SuccessfullyProcessed, which wouldn't match the previously documentedexpectset. Using the wildcard ensures the automation works correctly regardless of custom state names.The wildcard approach is also simpler and more robust — any flow run event (heartbeat or state change) resets the proactive trigger timer, which is the correct behavior for zombie detection: if a flow is emitting any events at all, it's not a zombie.
Also adds a new "Custom state names" section that:
expectset for finer-grained controlChecklist
<link to issue>"mint.json.Link to Devin session: https://app.devin.ai/sessions/33a9bba0680f42b490d3b072c3e06f2e