In fall 618, Li, knowing that Yuwen's food supplies were running out, pretended to offer peace to Yuwen, agreeing to supply Yuwen's army with food, but instead planning to withhold food and, once Yuwen's food supplies did run out, attack. Li's plans, however, became known by Yuwen, and he in turn made a surprise attack on Li, nearly killing Li, but Qin Shubao protected Li from death, and eventually Yuwen was repelled. Yuwen, unable to gain food, headed north away from Li, and Li did not trail him.