Never. It is possible, and almost certain that humans will create machines that are capable of destroying the earth. Senior scientists like Stephen Hawkins have warned us that the way things are moving is not healthy. Just as developments in nuclear physics led to the nuclear bombs, machine learning can lead to a machine that can be taught to destroy the earth. In fact, the defense research institutions around the world have already done most of that job. But just like any other machine, these machines will remain a slave of the operator.
As we discussed before, machines can only calculate and adopt measurable facts, to repeat what was done before. This so called intelligence and emotions in the machines is only an effect that we conceive. On the ground level, the AI algorithms can only map a binary input to a binary output. The machine has no idea of this source of the input or the target of the output. It has no idea if the output results in an automated surgery or a driverless car or a nuclear missile destroying the world. The dumb machine only knows of the electrons flowing from the input port to the output port.
Any amount of development in these algorithms will not lead to intuition, the ability to innovate, emotions or desires or ego. A machine will never have the desire to defeat humans and conquer the earth. The Terminators will remain a fiction.
Some time back, the world was shocked by the sensational news that Chat Bots in Facebook started communicating with each other in language apart from English, and hence had to be terminated. It sounded as if Facebook just sacrificed their servers to save humanity from an invasion by the machines - they had created machines that were capable of conquering the world... Pure nonsense! Well, they did not lie. All that they said is that they killed the bots because they were communicating in a language other than English. That is only because the machines could not learn English correctly.
Don't worry, the world is safe!