How to query started but failed activity in a process instance


once an activity failed (after retries), it seems like runtime service dose not have info about the process instance anymore, but historyservice.createHistoricActivityInstanceQuery does not seem to have any info about failed activity either. how can i draw a diagram so that users know which activities succeeded and which one failed?