Reproducible on IDM 220.127.116.11.
Not reproducible on IDM 7.0.0-SNAPSHOT (build: 20200608083929, revision: ca359bb).
Using a filtered-query with var-<process-variable> on workflow/processinstance/history, duplicates are returned for processinstances that have been accepted or rejected.
1. IDM 18.104.22.168.
(I used MySQL as repo, but this is also reproducible with Activiti's default H2 db.)
2. Enable workflow.
3. Copy workflow from samples/provisioning-with-workflow/workflow.
4. Login to end-user UI, start workflow.
5. In admin UI, assign the workflow to a user.
At this point, filtered-query "var-mail=..." returns one processinstance, as expected:
6. In end-user UI, process the task, either "accept" or reject" the request.
Now, filtered-query "var-mail=..." returns the processinstance, duplicated:
Looking at Activiti tables in repo: