Evidence for competing magnetic instabilities in underdoped $\rm YBa_2Cu_3O_{6+x}$