Here's the basic flow of the the problem, this occurs in the same state:
Initial state: createTask
Eventdriven: onTaskCreated (here I set the permissions for the task)
EventDriven: onTaskChanged (check if completed, and when completed, setState to the same state for a new task)
This system worked fine until I tried to add the onTaskCreated for the permissions, because here's what I get:
The first task is fine with the right permissions
The second task is created, but it doesn't trigger the onTaskCreated, so the permissions aren't set
After I complete the second task, the onTaskCreated is triggered, but by then the task is locked and I get an error.
What could be the cause of this?