As the new White House chief of staff, John Kelly routes all calls to and from President Trump through the White House switchboard, where he can sign off on them. He stanches the flow of information reaching the president’s desk. And he requires that all staffers — including Trump’s own family members — go through him to reach the president.

But none of those attempts at discipline mattered this week. Instead, Kelly stood to the side as Trump upended his new chief of staff’s carefully scripted plans — pin-balling through an impromptu and combative New York news conference in which he inflamed another self-inflicted controversy by comparing the actions of white supremacist groups at a deadly Charlottesville, Va., rally with the counter-protesters who came to oppose them.

The uproar — which has consumed not only the White House but the Republican Party as a whole — left Kelly deeply frustrated and dismayed just over two weeks into his job, according to people familiar with his thinking. The episode also underscored the difficult challenges that even a four-star general faces in instilling a sense of order around Trump, whose first instinct when cornered is to lash out, even self-destructively.