Improve retry task timeout logic and interaction with invoked tasks.