唐僖宗
With this army Zhu Wen attacked and captured nearby Tong Prefecture (同州, in modern Weinan, Shaanxi), becoming defense commissioner of that prefecture. Many of the military governors had submitted to Huang Chao following his capture of Chang'an, but soon reverted to the Tang court once they realized that cause was not yet lost. By 882 Huang Chao was effectively surrounded, controlling only two prefectures outside Chang'an, one of which was Zhu Wen's Tong Prefecture. Wen now found the time opportune to change sides. After first assassinating his military overseer Yan Shi (), sent by Huang Chao to guard against just such a possibility, Zhu Wen surrendered to the Hezhong Circuit (河中, headquartered in modern Yuncheng, Shanxi)'s military governor ("Jiedushi"), Wang Chongrong. As reward for his timely defection Emperor Xizong of Tang appointed Zhu Wen Grand General of the Imperial Guards and deputy field commander of the armies stationed at Hezhong, also conferring the new personal name Quanzhong – "wholeheartedly loyal."