Honor delay when postin state update
Bugfix: Use random, not Agent.http_retry_delay

Agent.http_retry_delay is not available and trying to import it leads to
a circular import
Retry setting state on 5xx return code
Fixed TODO line