In August 2017, shortly after John F. Kelly became White House chief of staff, he convened crucial meetings on Afghanistan at President Trump’s golf club in Bedminster, N.J.

Top officials from the Pentagon and the CIA, the director of national intelligence, diplomats and lawmakers huddled with Trump as Kelly and others urged him not to give up in Afghanistan.