Retry task a number of times in failure handler results in infinite loop

Following the example at https://docs.xebialabs.com/v.9.8/release/how-to/task-failure-handler/#scripts to retry a task a number of time using a release variable, i wound up with an infinite loop scenario. The issue seems to be that the updated value of releaseVariables['attempt'] in the failure handler doesn’t actually get persisted until the task completes/fails. So despite incrementing it, when I actually outputted the value for each retry, it was never showing an incremented value. It DOES work if instead of taskApi.retryTask, I instead skip the failed task and create a new duplicated task (there, I see the continually incremented release variable values).

We have resolved this problem in XL-Release versions: 9.7.10, 10.1.0, 10.0.2 and above.