On Aug. 20, Tesla and SpaceX CEO Elon Musk and dozens of other tech leaders wrote an open letter sounding the alarm about “lethal autonomous weapons,” the combination of robotics and artificial intelligence that is likely to define the battlefield of the future. Such weapons, they wrote, “will permit armed conflict to be fought at a scale greater than ever, and at timescales faster than humans can comprehend,” and they could fall into the hands of terrorists and despots. The tech leaders urged the U.N. to pre-empt an arms race in these technologies by acting immediately, before “this Pandora’s box is opened.”

Mr....