Improved handling of other thread receive() for shell agent