Recently ive been doing a little reading into the Korean War. People seem to view a modern conflict of China or Russia vs the US as basically an apocalyptic scenario, yet we had a China+Russia+North Kora vs UN+US+Britain+South Korea war less than 70 years ago and it has been mostly forgotten. Its like all the powers formally agreed to only fight in this one little area and then just go back home like nothing happened. How did this conflict not escalate into an all out assault on China and possibly a third World War? Sorry if it seems like a super vague question, but like i mentioned earlier, the same forces in a conflict in modern times is pretty much accepted as the end of the world, yet when this actually happened, it was so inconsequential that we dont even talk about it in school.
Scope of the war
The Korean War, as envisioned by Kim Il-Sung, was to be a quick attack with the people of the South rising up in communist revolution. The US wouldn't intervene as they had signaled that Korea was outside of their sphere of interest.
Stalin kept holding Kim back. Stalin's concerns were European - Berlin, East Germany, Turkey, Greece. If a war started in Korea and the Soviets got involved, would the US strike them in Europe? This is why Stalin's support for the war was mostly moral. He told Mao to support Kim, and he said he'd offer air cover, which he did although it was not as much as had been hoped for. With the assurance that Kim would make quick work of the South and, if he failed, Mao would do the heavy lifting, Stalin gave the green light for war in the spring of 1950.
When the war started, the UN resolution only authorized the defense of the South. Conquering the north, invading China, expanding the war - these were NOT authorized by the UN mandate.
Possible scenarios
MacArthur wanted to do expand the war to China, but he didn't have the supplies or the forces to achieve it AND he underestimated the Chinese forces. His subordinate, Ned Almond, made racist remarks about the "chinese laundrymen" - and then he got destroyed at the Chosun Reservoir. The view of the Chinese was very wrong - racism, faulty intelligence, hubris, all of the above.
MacArthur pushed to use nuclear weapons against the Chinese. Truman put the brakes on that. At the time, the Chinese didn't have nuclear weapons. If nuclear weapons had been used, the Soviets might have taken a more aggressive approach to the situation. But if that had happened, then Stalin could have gotten exactly what he didn't want - a war in Europe using nuclear weapons.
Also, the war was confined to Korea. The UN forces could have bombed Chinese airbases, but it was decided against in part because of Japan. US forces were stationed in Japan and if strikes were made against China, then strikes against Japanese bases would have been justifiable. In this situation, the war could have expanded beyond Korea.
As far as attacking Chinese cities, Mao made comments to the effect of not caring about US nuclear weapons. China was so large with so many cities and so many people that the US would have had to expend its entire nuclear arsenal and then some, and it still wouldn't have had a significant impact. If that's true - debatable, but it's what Mao believed.
TLDR - it didn't escalate because the Soviets and Americans had interests elsewhere - Europe - that they weren't willing to sacrifice with a war in Korea. Some forces, namely MacArthur and Mao, were very interested in an all out war between China and the US - mainly because of Taiwan, but also for pure ideological reasons.