Ask you favorite historian and you'll get one of two irrelevant explanations:
(1) Lincoln appointed McClellan to command the armies against Lee after Second Manassas.
(2) Halleck appointed McClellan to command the armies against Lee after Second Manassas.
I have seen a third very rare explanation, cunning in the way it hides critical information:
(3) Lincoln appointed McClellan commander of the Washington defenses and acquiesced in McClellan's taking a force against Lee.
This (3) is so infrequent, we need not consider it at length.
The idea that Lincoln appointed McClellan to lead the armies has as its basis Halleck's testimony to the CCW. They asked him how in blazes McClellan ended up in command of the field force and that was Halleck's reply. There is no document or other evidence to substantiate Halleck's claim. The whole "Lincoln ordered McClellan" rests on one assertion made after the fact by a man expert at evading responsibility.
The idea that Halleck appointed McClellan rests on what Lincoln privately told a couple of political visitors who were giving him grief. A second-hand report of that conversation is the whole case (lock, stock, barrel) for Halleck appointing McClellan.
Lincoln initially told his Cabinet that McClellan's command was restricted to the Washington defenses. Halleck reinforced this in replying to a query from GBM as to the limits of his authority. In his response and in following communications, Halleck explained to GBM that McClellan was to prepare a force for the field, that McClellan would not lead that force, and that the naming of that commander would be GBM's prerogative.
The OR then contains some messages on the lines of, "and have you chosen the field commander yet?"
McClellan breaks the ice by appointing Pope on September 5. As I wrote here:
McClellan’s orders to Pope are clear and unambiguous – read them yourself - Pope commands in the field. And the orders to Pope have a context – McClellan was directed to name a commander of the field army. More generally, McClellan had also earlier been assured by Halleck that when the forces were united, Mac would command Pope. On September 5, the armies are together and Mac commands Pope.I also wrote, long ago, a compressed timeline of the command crisis that excludes Pope's command of the combined armies but which is otherwise useful. It also contains some technical notes on the idea of GBM being "restored" to command of the AoP, as if it were the AoP which had sallied against Lee!
The McClellan/Pope team emerges. But it lasts only a short time.
Many of you could do better than I have with the underlying material; have at it.
Meanwhile, if a book tells you that Pope was relieved after Second Manassas or McClellan restored to command the AoP against Lee's invasion, put that book away, far away.