[RJA-2342][fix] - Race condition when checking agent status