Repeat request until response will return proper value

Where is taskId being set?

Just added the missing line - taskId is taken from environment variables.

Can you clarify what you mean by “but in some of them is not working”.
What is the console log showing for those instances?

Let say I am using exact same request (function) 6 times within a collection. For the first 5-times of usage it works properly - meaning it waits for task to be unlocked and proceed with further subsequent request.
The 6th time of usage - it waits for task to be unlocked, but then it is skipping next subsequent (very relevant) request within collection.

I am using exact same script, there is nothing else in post-script and nothing in pre-script.

Here is screenshot with console which shows that it is skipping two subsequent requests: