Heat oil in the pan. Sauté onions and garlic until translucent, about 4 minutes. Add mushrooms. Sauté until they release liquid, about 4 minutes. Add tomatoes with their liquid, oregano, basil, and pepper flakes, if using. Season with salt and pepper.

Return chicken to the skillet. Simmer until chicken is white at the bone, about 40 minutes, turning it after 25 minutes.

Transfer chicken pieces to plate and set sauce aside. When cool enough to handle, pull the chicken meat from the bones. There will be about 8 ounces of white meat and 6 of dark meat. Wrap the white meat in plastic wrap or foil and refrigerate until ready to use another time. Mix the dark meat into the sauce.

Cook pasta according to package directions. Drain and divide among 4 bowls. Reheat chicken/sauce under low heat until hot. Spoon sauce over pasta. Sprinkle with cheese and serve.