STAR: A Foundation Model-driven Framework for Robust Task Planning and Failure Recovery in Robotic Systems