How do plants balance microbial friends and foes?

Plants are constantly exposed to microbes: Pathogens that cause disease, commensals that cause no harm or benefit, and mutualists that promote plant growth or help fend off pathogens. For example, most land plants can form positive relationships with arbuscular mycorrhizal fungi to improve nutrient uptake. How plants fight off pathogens without also killing beneficial microbes or wasting energy on commensal microbes is a largely unanswered question.