A plan carried on in the real world may be affected by a number of unexpected events, plan threats, which cause significant deviations between the intended behavior of the plan executor (i.e., the agent) and the observed one. These deviations are typically considered as action failures. This paper addresses the problem of recovering from action failures caused by a specific class of plan threats: faults in the functionalities of the agent. The problem is approached by exploiting techniques of the Model-Based Diagnosis (MBD) for detecting failures (plan execution monitoring) and for explaining these failures in terms of faulty functionalities (agent diagnosis). The recovery process is modeled as a replanning problem aimed at fixing the faulty components identified by the agent diagnosis. However, since the diagnosis is in general ambiguous (a failure may be explained by alternative faults), the recovery has to deal with such an uncertainty. The paper advocates the adoption of a conformant planner, which guarantees that the recovery plan, if it exists, is executable no matter what the actual cause of the failure. The paper focuses on a single agent performing its own plan, however the proposed methodology takes also into account that agents are typically situated into a multiagent scenario and that commitments between agents may exist. The repair strategy is therefore conceived to overcome the causes of a failure while assuring the commitments an agent has agreed with other team members.