After the Tang dynasty recaptured its two capitals, An Qingxu fled to Hebei, seized control of sixty cities, and continued to resist fiercely. Emperor Suzong of Tang decided to send a large army to suppress An Qingxu. This campaign saw the Tang forces concentrate a massive army of six hundred thousand troops led by nine regional military governors (jiedushi). Who should command these nine armies? By rank and prestige, it should have been Guo Ziyi and Li Guangbi. However, the deeply suspicious Emperor Suzong, fearing that Guo and Li might become too powerful, deliberately appointed no supreme commander. Instead, he sent Yu Chao'en, a eunuch who knew nothing of warfare, to serve as the "Guan Jun Rong Shi" (a military supervisor tasked with monitoring the generals on campaign), forcing all nine jiedushi to obey his orders.
When the Tang army attacked the city of Ye, Shi Siming raised troops again to rebel against the Tang, leading reinforcements from Fanyang to rescue An Qingxu. The six hundred thousand Tang troops were preparing for a decisive battle with the rebel forces, but before they could even form their battle lines, a sudden violent wind arose, filling the air with sand and dust, darkening the sky. With no unified command, the nine armies scattered like frightened horses.
After the Tang army suffered defeat, Yu Chao'en blamed the entire failure on Guo Ziyi. Emperor Suzong believed Yu Chao'en's words, removed Guo Ziyi from his post as Jiedushi of Shuofang, and appointed Li Guangbi to replace him.
At this time, the rebel forces experienced another internal conflict. Shi Siming killed An Qingxu in Ye, declared himself emperor of the Great Yan, reorganized his troops, and advanced toward Luoyang.
When Li Guangbi arrived in Luoyang, the local officials, hearing of Shi Siming's powerful army, grew fearful, and some advocated retreating to Tongguan. Li Guangbi said, "The two sides are evenly matched. If we retreat, the enemy will grow even more aggressive. It would be better to relocate our forces to Heyang (modern Meng County, Henan), where we can advance to attack or retreat to defend."
Li Guangbi ordered all officials and civilians to evacuate Luoyang and led his troops to Heyang. By the time Shi Siming entered Luoyang, the city had become an empty shell. Shi Siming found no people and no supplies, and fearing a surprise attack by Li Guangbi, he was forced to lead his army out of the city, building a defensive position south of Heyang to face Li Guangbi's Tang forces.
Li Guangbi was a seasoned general with long experience on the battlefield. Knowing his current forces were inferior to the rebels, he decided to rely on strategy rather than brute force. Hearing that Shi Siming had brought over a thousand warhorses from Hebei, which were daily taken to a sandbank by the river to bathe and graze, Li Guangbi ordered his subordinates to gather all their mares and tie their foals in the stables. When the rebel horses came to the sandbank, the Tang troops released the mares to mingle with the enemy horses. Soon, the mares, remembering their foals, whinnied and galloped back to the Tang camp, and the enemy's warhorses followed them into the Tang army's position.
Shi Siming suddenly lost over a thousand warhorses and was furious. He immediately ordered his men to assemble several hundred warships for a waterborne assault, sending a fire ship ahead to burn down the Tang army's floating bridge.
Li Guangbi, having learned of this plan, prepared hundreds of thick, long bamboo poles, with their tips wrapped in iron armor. When the rebel fire ship approached, hundreds of soldiers stood on the floating bridge, using the bamboo poles to push against the fire ship. Unable to advance, the fire ship burned until its masts collapsed and its hull cracked, sinking rapidly. The Tang troops then launched stone-throwing catapults from the bridge, smashing the enemy ships and leaving the rebel soldiers on board with broken heads and bleeding wounds. Some sank to the river bottom with their ships; others struggled ashore and fled for their lives.
Shi Siming repeatedly sent his generals to attack Heyang, but each time Li Guangbi used clever tactics to repel them.
Finally, Shi Siming resolved to commit his full strength. He sent the rebel general Zhou Zhi to attack the northern fortress of Heyang, while he personally led an elite force to assault the southern fortress.
In the morning, Li Guangbi led his officers up onto the northern fortress to observe the enemy. They saw a vast, dark mass of rebel troops advancing in formation toward the northern fortress. Though the Tang officers said nothing, they were already afraid in their hearts. Seeing their mood, Li Guangbi calmly said, "Don't be afraid. Although the rebels are numerous, their ranks are disorderly, and they appear somewhat arrogant. Rest assured, before noon we will surely defeat them!"
Li Guangbi then ordered his troops to launch a coordinated attack. Although the soldiers fought bravely, after the enemy retreated briefly, fresh reinforcements arrived. By the time the sun was high overhead, neither side had gained an advantage.
Li Guangbi gathered his officers again and asked, "Observe the enemy formation—where is their strongest fighting force?"
The officers replied, "The northwest and southeast corners."
Li Guangbi nodded, immediately dispatching five hundred cavalry under two commanders to attack the northwest and southeast corners separately.
He then assembled the remaining troops, solemnly announcing his orders: "Soldiers, follow my banner. If I wave my flag slowly, you may act independently. But if I wave it rapidly and bring it down to the ground, that is the signal for a general assault. When you see this signal, you must charge forward courageously—no retreating from the battlefield." At this, he drew a short dagger and thrust it into his boot, saying, "War is a matter of life and death. As a minister of the state, I will never die at the hands of the enemy. If you fall in battle, I will commit suicide right here."
Inspired by Li Guangbi's words, the soldiers surged forward with redoubled courage. Soon, the officer Hao Tingyu turned back from the front lines. Li Guangbi immediately dispatched soldiers with his sword to intercept Hao and execute him on the spot.
Seeing the soldiers coming to kill him, Hao Tingyu shouted loudly, "My horse was hit by an arrow; I wasn't retreating!"
When the soldiers reported this to Li Guangbi, he immediately ordered a fresh warhorse to be given to Hao Tingyu, who returned to the battlefield to resume command.
Seeing the Tang army's morale at its peak, Li Guangbi rapidly brought his flag down to the ground, signaling the general assault. Seeing the signal from the fortress walls, the Tang troops charged into the enemy ranks, shouting so loudly the sky and earth seemed to shake. The rebels, under fierce attack, could no longer hold their ground and fled in disarray. Over a thousand were killed or captured, another thousand were crushed into the river and drowned, and the rebel general Zhou Zhi fled.
Shi Siming was still attacking the southern fortress when Li Guangbi drove the rebel prisoners captured from the north toward the riverbank. Shi Siming, learning that Zhou Zhi's entire army had collapsed, dared not fight any longer. He immediately ordered a retreat and fled back to Luoyang.
Li Guangbi repeatedly repelled Shi Siming's attacks, and the two sides remained locked in stalemate for nearly two years. Emperor Suzong, listening to Yu Chao'en, ordered Li Guangbi to attack Luoyang. Li Guangbi believed the enemy forces were still too strong and that they should not rashly assault the city. But Emperor Suzong repeatedly sent eunuchs to pressure him into attacking. Li Guangbi reluctantly launched the assault and suffered a defeat. As a result, he was stripped of his position as commander-in-chief.
With Shi Siming's powerful rival removed, he advanced victoriously toward Chang'an. Fortunately, at this moment the rebel forces experienced a third internal conflict: Shi Siming was killed by his own son, Shi Chaoyi.
The rebel forces fragmented and split apart. In 763 AD, Shi Chaoyi, defeated in battle, committed suicide.
From An Lushan's initial rebellion to Shi Chaoyi's final defeat, the Central Plains had endured eight years of civil war. Historically, this event is known as the "An-Shi Rebellion."