Steps to reproduce:
- Create and register a custom incident handler for external tasks.
- Create a process instance containing an external task.
- Notify the engine about a failure during external task execution without retries. An incident will be created.
- Delete the corresponding process instance via Cockpit application.
Observed behavior:
ProcessInstance is deleted along with related jobs and incidents, but IncidentHandler is not called.
Expected behavior:
when the incidents are removed, the IncidentHandler is called.
Possible root cause:
When removing the execution it is cleared of all Jobs and Incidents attached to it.
Incidents that belong to a Job will call the handler while other incidents will not.