The Union army recovered quickly, because the man in charge that morning kept his head. With Major General George G. Meade (North) away at City Point, command of the Army of the Potomac fell to Major General John G. Parke (North), who also led the IX Corps holding this part of the line. Parke did not panic at the hole in his center. He ordered his reserve division forward to seal it and called up the reserve artillery, sending it onto a ridge behind the lost forts where the guns could fire straight into the lodgement.
The reserve division belonged to Brigadier General John F. Hartranft (North), and it was made up largely of new Pennsylvania regiments, some of them barely trained. Hartranft fed his regiments in piece by piece as they came up, first to slow the Confederates short of the supply railroad just behind the line, then to pen them in. By mid-morning he had built a curving wall of troops, something close to a mile and a half long, around the entire Confederate penetration. The bulge that was supposed to widen toward City Point was instead sealed inside a tightening ring.

The trap reverses
Now the ground that had fallen so easily became a killing pocket. The captured forts sat at the front of a Union semicircle, with guns on the flanks and on the ridge behind, all of them able to fire into the same patch of trench at once. The Confederates packed into Fort Stedman and the batteries were under fire from three sides with almost nowhere to shelter. The artillery that had looked like a prize at dawn had become a cage.
A little before 8:00 in the morning, Hartranft ordered his ring forward in a general assault. His Pennsylvanians swept in and retook Fort Stedman and the batteries on either side, and the lodgement collapsed. For the Confederates still inside, the choice was now to surrender where they stood or to run back across the open ground between the lines, the same few hundred yards they had crossed in the dark, now in full daylight under the fire of every Union gun that could reach it. Hundreds were shot down crossing back. Hundreds more, deciding the run was worse than the cage, simply threw down their rifles and gave themselves up.

Gordon, watching the attack die with Lee himself now looking on, pulled back the men he could. By about 8:00 a.m. it was over. The whole affair, from the first rush in the dark to the last man scrambling back into the Confederate trenches, had lasted roughly four hours, and the Union line stood almost exactly where it had at midnight.