Here in the printer’s manuscript, Oliver Cowdery initially wrote “these sons of Mosiah were with Alma when the angel first appeared unto him”. Almost immediately Oliver corrected 𝓟 to read “at the time the angel first appeared unto him”; the ink flow for his supralinearly inserted at the time is unchanged. Either reading is, of course, possible, so there was no motivation for Oliver to have made this change except that 𝓞 read that way. Typically, the text uses when in this context, but there are 11 other examples of at the time that are equivalent to the subordinate conjunction when, including the following one that also refers to when the angel first appeared to Alma and the sons of Mosiah:
The critical text will therefore accept in Alma 17:2 the corrected reading in 𝓟, “these sons of Mosiah were with Alma at the time the angel first appeared unto him”.
Summary: Maintain in Alma 17:2 the corrected reading in 𝓟 that uses at the time as an equivalent for when.