new retry controller logic and some fixed tests

Seems to pass e2e, blackbox and unit tests. Docker tests need to be run before merging.

Any comments?